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 the rewritten_prompt and a wh_ratio value (e.g., 16:9), which maps directly to standard render resolutions when passed into the Diffusers QwenImage21Pipeline. It's usable via standard Hugging Face AutoModelForCausalLM loading, 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-T2I is 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

Downloads last month
-
Safetensors
Model size
9B params
Tensor type
BF16
·
MLX
Hardware compatibility
Log In to add your hardware

4-bit

Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for prithivMLmods/Qwen-Image-2.1-PE-T2I-MLX

Quantized
(3)
this model

Collections including prithivMLmods/Qwen-Image-2.1-PE-T2I-MLX