Image-Text-to-Text
MLX
Safetensors
modilify_mk1
diffusion
multimodal
mixture-of-experts
conversational
Instructions to use modilify/Modilify-Mk1-MLX with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use modilify/Modilify-Mk1-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("modilify/Modilify-Mk1-MLX") config = load_config("modilify/Modilify-Mk1-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 modilify/Modilify-Mk1-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 "modilify/Modilify-Mk1-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": "modilify/Modilify-Mk1-MLX" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Hermes Agent
How to use modilify/Modilify-Mk1-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 "modilify/Modilify-Mk1-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 modilify/Modilify-Mk1-MLX
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use modilify/Modilify-Mk1-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 "modilify/Modilify-Mk1-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 "modilify/Modilify-Mk1-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"
| #!/usr/bin/env python3 | |
| # Copyright 2026 Modilify | |
| # SPDX-License-Identifier: LicenseRef-Modilify-Open-Model-1.0 | |
| """Standalone text trial-inference CLI for native Modilify Mk1 MLX.""" | |
| from __future__ import annotations | |
| import argparse | |
| import sys | |
| from pathlib import Path | |
| import mlx.core as mx | |
| ROOT = Path(__file__).resolve().parent | |
| if str(ROOT) not in sys.path: | |
| sys.path.insert(0, str(ROOT)) | |
| from modilify_mlx.generate import generate | |
| from modilify_mlx.modeling import load | |
| def _build_prompt_ids(model_path: Path, prompt: str, enable_thinking: bool): | |
| from transformers import AutoTokenizer | |
| tokenizer = AutoTokenizer.from_pretrained(str(model_path), trust_remote_code=True) | |
| messages = [{"role": "user", "content": prompt}] | |
| token_ids = tokenizer.apply_chat_template( | |
| messages, | |
| tokenize=True, | |
| add_generation_prompt=True, | |
| enable_thinking=enable_thinking, | |
| ) | |
| if hasattr(token_ids, "input_ids"): | |
| token_ids = token_ids.input_ids | |
| elif isinstance(token_ids, dict): | |
| token_ids = token_ids["input_ids"] | |
| if hasattr(token_ids, "tolist"): | |
| token_ids = token_ids.tolist() | |
| if token_ids and isinstance(token_ids[0], (list, tuple)): | |
| token_ids = token_ids[0] | |
| return [int(token) for token in token_ids], tokenizer | |
| def main() -> None: | |
| parser = argparse.ArgumentParser(description=__doc__) | |
| parser.add_argument("--model", type=Path, default=ROOT) | |
| parser.add_argument("--prompt", default="Explain why the sky is blue.") | |
| parser.add_argument("--max-new-tokens", type=int, default=128) | |
| parser.add_argument("--temperature", type=float, default=None) | |
| parser.add_argument("--enable-thinking", action="store_true") | |
| parser.add_argument("--seed", type=int, default=0) | |
| parser.add_argument( | |
| "--expert-bits", | |
| type=int, | |
| default=16, | |
| help="Quantize MoE experts to this bit width (16 keeps bf16).", | |
| ) | |
| parser.add_argument( | |
| "--profile", | |
| action="store_true", | |
| help="Print per-phase denoise timings.", | |
| ) | |
| args = parser.parse_args() | |
| print(f"[mk1] loading {args.model}", flush=True) | |
| model, config = load(args.model, expert_bits=args.expert_bits) | |
| if config.model_type != "modilify_mk1": | |
| raise SystemExit(f"Refusing model_type={config.model_type!r}") | |
| prompt_ids, tokenizer = _build_prompt_ids( | |
| args.model, args.prompt, args.enable_thinking | |
| ) | |
| print( | |
| f"[mk1] prompt_tokens={len(prompt_ids)} canvas={config.canvas_length} " | |
| f"temp={args.temperature if args.temperature is not None else config.denoise_temperature}", | |
| flush=True, | |
| ) | |
| profiler = None | |
| if args.profile: | |
| from modilify_mlx.profile import DenoiseProfiler | |
| profiler = DenoiseProfiler() | |
| output = generate( | |
| model, | |
| mx.array([prompt_ids], dtype=mx.int32), | |
| max_new_tokens=args.max_new_tokens, | |
| temperature=args.temperature, | |
| seed=args.seed, | |
| profiler=profiler, | |
| ) | |
| text = tokenizer.decode(output.generated_ids, skip_special_tokens=False) | |
| visible = tokenizer.decode(output.generated_ids, skip_special_tokens=True) | |
| print( | |
| f"[mk1] stop={output.stop_reason} denoise={output.denoise_steps} " | |
| f"committed={output.generated_length} avg_commit={output.average_commit_len:.2f} " | |
| f"tpf={output.tokens_per_forward:.2f} jumps={output.jump_count}", | |
| flush=True, | |
| ) | |
| print( | |
| f"[mk1] prefill={output.prefill_seconds:.3f}s " | |
| f"first_denoise={output.first_denoise_seconds:.3f}s " | |
| f"generate={output.generate_seconds:.3f}s " | |
| f"hd/s={output.heavy_denoise_per_second:.3f} " | |
| f"steady_hd/s={output.steady_heavy_denoise_per_second:.3f} " | |
| f"tok/s={output.tokens_per_second:.2f}", | |
| flush=True, | |
| ) | |
| if profiler is not None: | |
| print(profiler.summary(), flush=True) | |
| print("--- raw ---") | |
| print(text) | |
| print("--- visible ---") | |
| print(visible) | |
| if __name__ == "__main__": | |
| main() | |