Image-Text-to-Text
MLX
Safetensors
prism_hadamard_qwen35
zen6
hanzo
zenlm
apple-silicon
ternary
2-bit
mcp
multimodal
conversational
Instructions to use zenlm/zen6-mlx with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use zenlm/zen6-mlx with MLX:
# Make sure mlx-vlm is installed # pip install --upgrade mlx-vlm from mlx_vlm import load, generate from mlx_vlm.prompt_utils import apply_chat_template from mlx_vlm.utils import load_config # Load the model model, processor = load("zenlm/zen6-mlx") config = load_config("zenlm/zen6-mlx") # Prepare input image = ["http://images.cocodataset.org/val2017/000000039769.jpg"] prompt = "Describe this image." # Apply chat template formatted_prompt = apply_chat_template( processor, config, prompt, num_images=1 ) # Generate output output = generate(model, processor, formatted_prompt, image) print(output) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- LM Studio
- Pi
How to use zenlm/zen6-mlx with Pi:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "zenlm/zen6-mlx"
Configure the model in Pi
# Install Pi: npm install -g @earendil-works/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "mlx-lm": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "zenlm/zen6-mlx" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Hermes Agent
How to use zenlm/zen6-mlx with Hermes Agent:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "zenlm/zen6-mlx"
Configure Hermes
# Install Hermes: curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash hermes setup # Point Hermes at the local server: hermes config set model.provider custom hermes config set model.base_url http://127.0.0.1:8080/v1 hermes config set model.default zenlm/zen6-mlx
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use zenlm/zen6-mlx with OpenClaw:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "zenlm/zen6-mlx"
Configure OpenClaw
# Install OpenClaw: npm install -g openclaw@latest # Register the local server and set it as the default model: openclaw onboard --non-interactive --mode local \ --auth-choice custom-api-key \ --custom-base-url http://127.0.0.1:8080/v1 \ --custom-model-id "zenlm/zen6-mlx" \ --custom-provider-id mlx-lm \ --custom-compatibility openai \ --custom-text-input \ --accept-risk \ --skip-health
Run OpenClaw
openclaw agent --local --agent main --message "Hello from Hugging Face"
Download quickstart.py from zenlm/zen6-mlx: direct link, hf CLI and curl.
- Browser
- Download file 3.88 kB
-
https://huggingface.co/zenlm/zen6-mlx/resolve/main/quickstart.py
- Command line
-
hf download hf://zenlm/zen6-mlx/quickstart.py
-
curl -L -o quickstart.py https://huggingface.co/zenlm/zen6-mlx/resolve/main/quickstart.py
3.88 kB
| #!/usr/bin/env python3 | |
| """Generate text from this pack. Run: python quickstart.py "your prompt here" | |
| This pack carries its own loader because the weights need transforms that stock | |
| MLX loaders do not apply. That is why `mlx_lm.load()` reports an unsupported | |
| model type; there is no patched mlx-lm to install. | |
| Packs with a vision tower (config.json `components.vision`) load through | |
| runtime/vision_artifact.py on mlx-vlm; text-only packs through runtime/artifact.py. | |
| The sampler comes from generation_config.json and is passed explicitly, because | |
| mlx-lm and mlx-vlm do not read that file. | |
| """ | |
| import json | |
| import sys | |
| from pathlib import Path | |
| PACK = Path(__file__).resolve().parent | |
| sys.path.insert(0, str(PACK / "runtime")) | |
| MAX_TOKENS = 256 | |
| def read_json(name, default): | |
| path = PACK / name | |
| return json.loads(path.read_text()) if path.is_file() else default | |
| def sampler_settings(): | |
| gen = read_json("generation_config.json", {}) | |
| out = {"temperature": gen.get("temperature", 1.0), "top_p": gen.get("top_p", 0.95), "top_k": gen.get("top_k", 20)} | |
| if gen.get("do_sample") is False: | |
| out["temperature"] = 0.0 | |
| if gen.get("min_p"): | |
| out["min_p"] = gen["min_p"] | |
| if gen.get("repetition_penalty") not in (None, 1.0): | |
| out["repetition_penalty"] = gen["repetition_penalty"] | |
| return out | |
| def render(prompt): | |
| template_path = PACK / "chat_template.jinja" | |
| if not template_path.is_file(): | |
| return prompt | |
| from jinja2.sandbox import ImmutableSandboxedEnvironment | |
| return ( | |
| ImmutableSandboxedEnvironment(trim_blocks=True, lstrip_blocks=True) | |
| .from_string(template_path.read_text()) | |
| .render( | |
| messages=[{"role": "user", "content": prompt}], | |
| add_generation_prompt=True, | |
| enable_thinking=False, | |
| ) | |
| ) | |
| def generate_vision(prompt, settings): | |
| from mlx_vlm import generate | |
| from vision_artifact import load_vl_model | |
| model, processor, _ = load_vl_model(PACK) | |
| result = generate(model, processor, render(prompt), max_tokens=MAX_TOKENS, **settings) | |
| return result if isinstance(result, str) else result.text | |
| def generate_text(prompt, settings): | |
| import mlx.core as mx | |
| from artifact import load_model | |
| from mlx_lm.sample_utils import make_logits_processors, make_sampler | |
| from tokenizers import Tokenizer | |
| model, _ = load_model(PACK) | |
| tokenizer = Tokenizer.from_file(str(PACK / "tokenizer.json")) | |
| eos = read_json("generation_config.json", {}).get("eos_token_id") | |
| stop = set(eos if isinstance(eos, list) else [] if eos is None else [eos]) | |
| stop |= {i for i in (tokenizer.token_to_id("<|im_end|>"), tokenizer.token_to_id("<|endoftext|>")) if i is not None} | |
| sample = make_sampler( | |
| temp=settings["temperature"], top_p=settings["top_p"], top_k=settings["top_k"], | |
| min_p=settings.get("min_p", 0.0), | |
| ) | |
| processors = make_logits_processors(repetition_penalty=settings.get("repetition_penalty")) | |
| x = mx.array([tokenizer.encode(render(prompt), add_special_tokens=False).ids]) | |
| cache = model.make_cache() | |
| generated = [] | |
| for _ in range(MAX_TOKENS): | |
| logits = model.lm_head(model.model(x, cache=cache)[:, -1:, :])[:, -1, :] | |
| for processor in processors: | |
| logits = processor(mx.array(generated), logits) | |
| x = sample(logits)[:, None] | |
| mx.eval(x) | |
| token = int(x.item()) | |
| if token in stop: | |
| break | |
| generated.append(token) | |
| return tokenizer.decode(generated) | |
| def main(): | |
| prompt = " ".join(sys.argv[1:]) or "What is 2 plus 2? Answer with the number only." | |
| settings = sampler_settings() | |
| if read_json("config.json", {}).get("components", {}).get("vision"): | |
| print(generate_vision(prompt, settings)) | |
| else: | |
| print(generate_text(prompt, settings)) | |
| if __name__ == "__main__": | |
| main() | |