Instructions to use wavespeed/Qwen-Image-Edit-e4m3 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use wavespeed/Qwen-Image-Edit-e4m3 with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline from diffusers.utils import load_image # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("wavespeed/Qwen-Image-Edit-e4m3", dtype=torch.bfloat16, device_map="cuda") prompt = "Turn this cat into a dog" input_image = load_image("https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/cat.png") image = pipe(image=input_image, prompt=prompt).images[0] - Notebooks
- Google Colab
- Kaggle
Add model card metadata: base_model, license, pipeline_tag, tags
Browse files
README.md
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
base_model: Qwen/Qwen-Image-Edit
|
| 3 |
+
library_name: diffusers
|
| 4 |
+
license: apache-2.0
|
| 5 |
+
pipeline_tag: image-to-image
|
| 6 |
+
tags:
|
| 7 |
+
- qwen-image
|
| 8 |
+
- image-to-image
|
| 9 |
+
- image-editing
|
| 10 |
+
- quantized
|
| 11 |
+
- fp8
|
| 12 |
+
- e4m3
|
| 13 |
+
- diffusers
|
| 14 |
+
base_model_relation: quantized
|
| 15 |
+
---
|
| 16 |
+
# Qwen-Image-Edit-e4m3
|
| 17 |
+
|
| 18 |
+
FP8 (e4m3) dynamically-quantized [Qwen-Image-Edit](https://huggingface.co/Qwen/Qwen-Image-Edit),
|
| 19 |
+
saved as a complete `QwenImageEditPipeline`.
|
| 20 |
+
|
| 21 |
+
## What was changed
|
| 22 |
+
|
| 23 |
+
All 60 blocks of the `QwenImageTransformer2DModel` are quantized to
|
| 24 |
+
`e4m3_e4m3_dynamic` — `float8_e4m3fn` weights with dynamically scaled
|
| 25 |
+
`float8_e4m3fn` activations. The Qwen2.5-VL text encoder, the processor, the
|
| 26 |
+
VAE and the transformer's non-block tensors are untouched and stay in bf16. The
|
| 27 |
+
transformer drops from ~40.9 GB to ~20.5 GB.
|
| 28 |
+
|
| 29 |
+
Quantization was done with WaveSpeed's `xelerate.ao.quantize`. Weights are
|
| 30 |
+
stored as pickled `.bin` shards, so loading requires `use_safetensors=False`.
|
| 31 |
+
FP8 matmul needs Hopper (H100/H200) or newer to actually be faster than bf16.
|
| 32 |
+
|
| 33 |
+
## Usage
|
| 34 |
+
|
| 35 |
+
```python
|
| 36 |
+
import torch
|
| 37 |
+
from diffusers import QwenImageEditPipeline
|
| 38 |
+
from diffusers.utils import load_image
|
| 39 |
+
|
| 40 |
+
pipe = QwenImageEditPipeline.from_pretrained(
|
| 41 |
+
"wavespeed/Qwen-Image-Edit-e4m3",
|
| 42 |
+
torch_dtype=torch.bfloat16,
|
| 43 |
+
use_safetensors=False,
|
| 44 |
+
).to("cuda")
|
| 45 |
+
|
| 46 |
+
image = load_image("input.png")
|
| 47 |
+
out = pipe(image=image, prompt="make it a winter scene").images[0]
|
| 48 |
+
```
|
| 49 |
+
|
| 50 |
+
## Related
|
| 51 |
+
|
| 52 |
+
- [`wavespeed/Qwen-Image-Edit-l8v1.1-e4m3`](https://huggingface.co/wavespeed/Qwen-Image-Edit-l8v1.1-e4m3)
|
| 53 |
+
— the same quantization with an 8-step Lightning LoRA fused in.
|
| 54 |
+
|
| 55 |
+
## License
|
| 56 |
+
|
| 57 |
+
Apache-2.0, inherited from Qwen-Image-Edit.
|