Instructions to use prithivMLmods/Qwen-Image-2.1-PE-T2I-MLX with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use prithivMLmods/Qwen-Image-2.1-PE-T2I-MLX with MLX:
# Make sure mlx-lm is installed # pip install --upgrade mlx-lm # Generate text with mlx-lm from mlx_lm import load, generate model, tokenizer = load("prithivMLmods/Qwen-Image-2.1-PE-T2I-MLX") prompt = "Write a story about Einstein" messages = [{"role": "user", "content": prompt}] prompt = tokenizer.apply_chat_template( messages, add_generation_prompt=True ) text = generate(model, tokenizer, prompt=prompt, verbose=True) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- LM Studio
- Pi
How to use prithivMLmods/Qwen-Image-2.1-PE-T2I-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 "prithivMLmods/Qwen-Image-2.1-PE-T2I-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": "prithivMLmods/Qwen-Image-2.1-PE-T2I-MLX" } ] } } }Run Pi
# Start Pi in your project directory: pi
- MLX LM
How to use prithivMLmods/Qwen-Image-2.1-PE-T2I-MLX with MLX LM:
Generate or start a chat session
# Install MLX LM uv tool install mlx-lm # Interactive chat REPL mlx_lm.chat --model "prithivMLmods/Qwen-Image-2.1-PE-T2I-MLX"
Run an OpenAI-compatible server
# Install MLX LM uv tool install mlx-lm # Start the server mlx_lm.server --model "prithivMLmods/Qwen-Image-2.1-PE-T2I-MLX" # Calling the OpenAI-compatible server with curl curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "prithivMLmods/Qwen-Image-2.1-PE-T2I-MLX", "messages": [ {"role": "user", "content": "Hello"} ] }' - Hermes Agent
How to use prithivMLmods/Qwen-Image-2.1-PE-T2I-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 "prithivMLmods/Qwen-Image-2.1-PE-T2I-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 prithivMLmods/Qwen-Image-2.1-PE-T2I-MLX
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use prithivMLmods/Qwen-Image-2.1-PE-T2I-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 "prithivMLmods/Qwen-Image-2.1-PE-T2I-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 "prithivMLmods/Qwen-Image-2.1-PE-T2I-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"
Qwen-Image-2.1-PE-T2I-MLX
Qwen-Image-2.1-PE-T2I is the text-to-image prompt-rewriting model for Qwen-Image-2.1, a fine-tuned Qwen3.5-VL-9B that turns a brief image request in any language into a detailed, expanded English prompt paired with a recommended aspect ratio, acting as the bridge between casual multilingual user requests (e.g., a short Chinese phrase describing a corgi playing guitar in the rain) and the precise, richly-detailed instructions the downstream 7B-parameter DiT-based Qwen-Image-2.1 generator needs for best results. After a
<think>reasoning block, it outputs a structured JSON object containing therewritten_promptand awh_ratiovalue (e.g.,16:9), which maps directly to standard render resolutions when passed into the DiffusersQwenImage21Pipeline. It's usable via standard Hugging FaceAutoModelForCausalLMloading, is intended purely as a preprocessing step ahead of image generation rather than a general-purpose chat model, and is released under the Qwen Research License Agreement.
System Prompt — https://huggingface.co/Qwen/Qwen-Image-2.1-PE-T2I/blob/main/system_prompt.txt
prithivMLmods/Qwen-Image-2.1-PE-T2I-MLX (main) [~32.82 GB Total]
├── 4bit/ [~5.58 GB]
│ ├── model shards: 2 safetensors (~5.56 GB)
│ └── metadata & configs (~19.1 MB)
│
├── 8bit/ [~9.72 GB]
│ ├── model shards: 2 safetensors (~9.70 GB)
│ └── metadata & configs (~19.1 MB)
│
└── [BF16 Base Files] [~17.52 GB]
├── model shards: 4 safetensors (~17.50 GB)
└── metadata & configs (~19.1 MB)
Use with mlx
Install the required library:
pip install -U mlx-vlm
Task Note:
Qwen-Image-2.1-PE-T2Iis a Text-to-Image prompt enhancer/rewriter (based on Qwen VL). It takes a short, simple user prompt (e.g., "A cybernetic tiger in Tokyo") and outputs an expanded, high-detail English diffusion prompt along with the optimal aspect ratio (wh_ratio).
BF16 Variant (Base Weights)
The BF16 weights reside directly in the root repository path:
CLI (Terminal)
python -m mlx_vlm generate \
--model prithivMLmods/Qwen-Image-2.1-PE-T2I-MLX \
--max-tokens 512 \
--temperature 0.2 \
--prompt "A neon cybernetic samurai standing under rainy Tokyo streets, cinematic lighting"
Python API
from mlx_vlm import load, generate
from mlx_vlm.prompt_utils import apply_chat_template
from mlx_vlm.utils import load_config
model_path = "prithivMLmods/Qwen-Image-2.1-PE-T2I-MLX"
model, processor = load(model_path)
config = load_config(model_path)
prompt = "A neon cybernetic samurai standing under rainy Tokyo streets, cinematic lighting"
formatted_prompt = apply_chat_template(processor, config, prompt)
output = generate(model, processor, formatted_prompt, max_tokens=512, temperature=0.2)
print(output.text)
8-bit Variant
Target the 8bit subfolder:
CLI (Terminal)
python -m mlx_vlm generate \
--model prithivMLmods/Qwen-Image-2.1-PE-T2I-MLX/8bit \
--max-tokens 512 \
--temperature 0.2 \
--prompt "A neon cybernetic samurai standing under rainy Tokyo streets, cinematic lighting"
Python API
from mlx_vlm import load, generate
from mlx_vlm.prompt_utils import apply_chat_template
from mlx_vlm.utils import load_config
model_path = "prithivMLmods/Qwen-Image-2.1-PE-T2I-MLX"
model, processor = load(model_path, subfolder="8bit")
config = load_config(model_path, subfolder="8bit")
prompt = "A neon cybernetic samurai standing under rainy Tokyo streets, cinematic lighting"
formatted_prompt = apply_chat_template(processor, config, prompt)
output = generate(model, processor, formatted_prompt, max_tokens=512, temperature=0.2)
print(output.text)
4-bit Variant
Target the 4bit subfolder:
CLI (Terminal)
python -m mlx_vlm generate \
--model prithivMLmods/Qwen-Image-2.1-PE-T2I-MLX/4bit \
--max-tokens 512 \
--temperature 0.2 \
--prompt "A neon cybernetic samurai standing under rainy Tokyo streets, cinematic lighting"
Python API
from mlx_vlm import load, generate
from mlx_vlm.prompt_utils import apply_chat_template
from mlx_vlm.utils import load_config
model_path = "prithivMLmods/Qwen-Image-2.1-PE-T2I-MLX"
model, processor = load(model_path, subfolder="4bit")
config = load_config(model_path, subfolder="4bit")
prompt = "A neon cybernetic samurai standing under rainy Tokyo streets, cinematic lighting"
formatted_prompt = apply_chat_template(processor, config, prompt)
output = generate(model, processor, formatted_prompt, max_tokens=512, temperature=0.2)
print(output.text)
License and Attribution
- Base Model: Qwen/Qwen-Image-2.1-PE-T2I
- License: Qwen Research License
- MLX-VLM: Blaizzy/mlx-vlm
- MLX: ml-explore/mlx
- Downloads last month
- -
4-bit
Model tree for prithivMLmods/Qwen-Image-2.1-PE-T2I-MLX
Base model
Qwen/Qwen-Image-2.1-PE-T2I