prithivMLmods/Qwen-Image-2.1-PE-I2I-MLX
1518
Qwen-Image-2.1-PE-I2I-MLX
Qwen-Image-2.1-PE-I2I is an image-editing prompt rewriting model for Qwen-Image-2.1, a fine-tuned Qwen3.5-VL-9B that takes a vague editing instruction plus one or more input images and expands it into a precise, actionable prompt suitable for downstream image editing. It supports multi-image inputs (referenced as<image1>,<image2>, etc.) for tasks like compositing a subject from one image into another's scene, reasons through a<think>block before outputting a structured JSON result containing the rewritten prompt plus either awh_ratio(new aspect ratio for compositions) orratio_follow(inherited aspect ratio for in-place edits) — the two fields being mutually exclusive. The rewritten prompt is designed to feed directly into the Qwen-Image-2.1 diffusion pipeline via Diffusers for the actual image edit, and the model is loaded through standard Transformers (AutoModelForImageTextToText) with a system prompt shipped alongside the checkpoint; it's released under the Qwen Research License Agreement.
[!NOTE]
System Prompt — https://huggingface.co/Qwen/Qwen-Image-2.1-PE-I2I/blob/main/system_prompt.txt
prithivMLmods/Qwen-Image-2.1-PE-I2I-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-I2I is an Image-to-Image prompt enhancer/rewriter (fine-tuned from Qwen 9B VL). It takes an input image along with an edit instruction (e.g. "Change the background to a sunset beach") and expands it into a detailed prompt suitable for downstream diffusion generation.BF16 Variant (Base Weights)
The BF16 weights reside directly in the root directory:
CLI (Terminal)
python -m mlx_vlm generate \
--model prithivMLmods/Qwen-Image-2.1-PE-I2I-MLX \
--max-tokens 256 \
--temperature 0.2 \
--prompt "Change the lighting to golden hour and add cinematic fog." \
--image <path_to_image>
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-I2I-MLX"
model, processor = load(model_path)
config = load_config(model_path)
image = ["<path_to_image>"]
prompt = "Change the lighting to golden hour and add cinematic fog."
formatted_prompt = apply_chat_template(processor, config, prompt, num_images=len(image))
output = generate(model, processor, formatted_prompt, image=image, max_tokens=256, 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-I2I-MLX/8bit \
--max-tokens 256 \
--temperature 0.2 \
--prompt "Change the lighting to golden hour and add cinematic fog." \
--image <path_to_image>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-I2I-MLX"
model, processor = load(model_path, subfolder="8bit")
config = load_config(model_path, subfolder="8bit")
image = ["<path_to_image>"]
prompt = "Change the lighting to golden hour and add cinematic fog."
formatted_prompt = apply_chat_template(processor, config, prompt, num_images=len(image))
output = generate(model, processor, formatted_prompt, image=image, max_tokens=256, 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-I2I-MLX/4bit \
--max-tokens 256 \
--temperature 0.2 \
--prompt "Change the lighting to golden hour and add cinematic fog." \
--image <path_to_image>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-I2I-MLX"
model, processor = load(model_path, subfolder="4bit")
config = load_config(model_path, subfolder="4bit")
image = ["<path_to_image>"]
prompt = "Change the lighting to golden hour and add cinematic fog."
formatted_prompt = apply_chat_template(processor, config, prompt, num_images=len(image))
output = generate(model, processor, formatted_prompt, image=image, max_tokens=256, temperature=0.2)
print(output.text)Licence and Attribution
- Base Model: Qwen/Qwen-Image-2.1-PE-I2I
- License: Qwen Research License
- MLX-VLM: Blaizzy/mlx-vlm
- MLX: ml-explore/mlx
