Text-to-Image
Diffusers
Safetensors
image-to-image
quantization
w4a4
svdquant
gptq
nunchaku
8-bit precision
Instructions to use ModelsLab/Qwen-Image-2.1-W4A4-int4 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use ModelsLab/Qwen-Image-2.1-W4A4-int4 with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("ModelsLab/Qwen-Image-2.1-W4A4-int4", dtype=torch.bfloat16, device_map="cuda") prompt = "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k" image = pipe(prompt).images[0] - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- Draw Things
- DiffusionBee
Download w4a4_build.json from ModelsLab/Qwen-Image-2.1-W4A4-int4: direct link, hf CLI and curl.
- Browser
- Download file 3.77 kB
-
https://huggingface.co/ModelsLab/Qwen-Image-2.1-W4A4-int4/resolve/e5a75281f67c3e6c0381c6c1131270b398dcb4f4/w4a4_build.json
- Command line
-
hf download hf://ModelsLab/Qwen-Image-2.1-W4A4-int4@e5a75281f67c3e6c0381c6c1131270b398dcb4f4/w4a4_build.json
-
curl -L -o w4a4_build.json https://huggingface.co/ModelsLab/Qwen-Image-2.1-W4A4-int4/resolve/e5a75281f67c3e6c0381c6c1131270b398dcb4f4/w4a4_build.json
3.77 kB
| { | |
| "model": "Qwen/Qwen-Image-2.1", | |
| "rank": 128, | |
| "alpha": 0.5, | |
| "gptq": true, | |
| "scheme": "nvfp4", | |
| "stages": { | |
| "grid_check": { | |
| "max_delta": 0.0, | |
| "idempotent": true | |
| }, | |
| "channel_stats": { | |
| "layers": 224, | |
| "seconds": 253.9 | |
| }, | |
| "input_groups": { | |
| "groups": 128, | |
| "shared_groups": 64, | |
| "example": [ | |
| "transformer_blocks.0.attn.to_k", | |
| "transformer_blocks.0.attn.to_q", | |
| "transformer_blocks.0.attn.to_v" | |
| ] | |
| }, | |
| "hessians": { | |
| "seconds": 300.6, | |
| "token_sample": 512 | |
| }, | |
| "convert": { | |
| "layers": 224, | |
| "seconds": 17.3 | |
| }, | |
| "gptq": { | |
| "sampled": 7, | |
| "beat_rtn": 0, | |
| "clipped": [], | |
| "layers": [ | |
| { | |
| "layer": "transformer_blocks.0.attn.to_k", | |
| "method": "gptq", | |
| "precision": "int4", | |
| "dead_channels": 0, | |
| "max_drift": 1.0, | |
| "headroom": null, | |
| "clipped": false, | |
| "gptq_weight_error": 0.138597, | |
| "rtn_weight_error": 0.128178 | |
| }, | |
| { | |
| "layer": "transformer_blocks.12.img_mlp.gate_layer", | |
| "method": "gptq", | |
| "precision": "int4", | |
| "dead_channels": 0, | |
| "max_drift": 1.018, | |
| "headroom": null, | |
| "clipped": false, | |
| "gptq_weight_error": 0.152526, | |
| "rtn_weight_error": 0.1273 | |
| }, | |
| { | |
| "layer": "transformer_blocks.17.attn.to_out.0", | |
| "method": "gptq", | |
| "precision": "int4", | |
| "dead_channels": 0, | |
| "max_drift": 1.003, | |
| "headroom": null, | |
| "clipped": false, | |
| "gptq_weight_error": 0.141176, | |
| "rtn_weight_error": 0.117945 | |
| }, | |
| { | |
| "layer": "transformer_blocks.20.img_mlp.out", | |
| "method": "gptq", | |
| "precision": "int4", | |
| "dead_channels": 0, | |
| "max_drift": 1.016, | |
| "headroom": null, | |
| "clipped": false, | |
| "gptq_weight_error": 0.17955, | |
| "rtn_weight_error": 0.139057 | |
| }, | |
| { | |
| "layer": "transformer_blocks.25.attn.to_q", | |
| "method": "gptq", | |
| "precision": "int4", | |
| "dead_channels": 0, | |
| "max_drift": 1.013, | |
| "headroom": null, | |
| "clipped": false, | |
| "gptq_weight_error": 0.156766, | |
| "rtn_weight_error": 0.126401 | |
| }, | |
| { | |
| "layer": "transformer_blocks.29.img_mlp.proj", | |
| "method": "gptq", | |
| "precision": "int4", | |
| "dead_channels": 0, | |
| "max_drift": 1.019, | |
| "headroom": null, | |
| "clipped": false, | |
| "gptq_weight_error": 0.154812, | |
| "rtn_weight_error": 0.128077 | |
| }, | |
| { | |
| "layer": "transformer_blocks.5.attn.to_v", | |
| "method": "gptq", | |
| "precision": "int4", | |
| "dead_channels": 0, | |
| "max_drift": 1.007, | |
| "headroom": null, | |
| "clipped": false, | |
| "gptq_weight_error": 0.165468, | |
| "rtn_weight_error": 0.130482 | |
| } | |
| ] | |
| }, | |
| "residual_quantize": { | |
| "layers": 0, | |
| "seconds": 0.0, | |
| "resident_gb": 21.34 | |
| }, | |
| "save": { | |
| "path": "/workspace/ckpt-int4", | |
| "layers": 224, | |
| "bytes": 4655346432, | |
| "gb": 4.34 | |
| } | |
| }, | |
| "calibration_set": { | |
| "total": 30, | |
| "text_to_image": 20, | |
| "with_negative_prompt": 2, | |
| "edits": 10, | |
| "reference_images_total": 19, | |
| "max_references": 5, | |
| "sizes": [ | |
| [ | |
| 768, | |
| 1344 | |
| ], | |
| [ | |
| 832, | |
| 1216 | |
| ], | |
| [ | |
| 1024, | |
| 1024 | |
| ], | |
| [ | |
| 1216, | |
| 832 | |
| ], | |
| [ | |
| 1344, | |
| 768 | |
| ] | |
| ], | |
| "estimated_seconds": 465 | |
| }, | |
| "reference_images": 6 | |
| } |