--- license: other license_name: qwen-research license_link: LICENSE base_model: Qwen/Qwen-Image-2.1 pipeline_tag: image-to-image language: - en datasets: - osunlp/MagicBrush tags: - image-editing - lora - diffusion - research - 8-step - custom-adapter --- # Qwen-Image-2.1-UltraFast ![Qwen-Image-2.1-UltraFast](assets/banner.png) **8-step image editing** based on Qwen-Image-2.1. **Built with Qwen · Non-commercial research.** [Detailed documentation & benchmarks](docs/DETAILS.md) · [Setup & usage](docs/USAGE.md) · [GGUF download](https://huggingface.co/Haverbex/Qwen-Image-2.1-UltraFast-GGUF) ## Image comparisons **Input → original model (40 steps) → UltraFast (8 steps).** These are two recorded BF16 training examples. Each detail view is a crop of the same example. ### Expression edit “What if she had a sad face?” ![Expression edit: full comparison](assets/comparisons/expression-full.png) ![Expression edit: same-example detail](assets/comparisons/expression-detail.png) ### Add a flower sticker “Let's add a flower sticker on the fridge.” ![Flower sticker: full comparison](assets/comparisons/flower-sticker-full.png) ![Flower sticker: same-example detail](assets/comparisons/flower-sticker-detail.png) [Original image files](https://huggingface.co/Haverbex/Qwen-Image-2.1-UltraFast/tree/main/assets) · [Image credits](ATTRIBUTION.md) ## At a glance | | Original | UltraFast | |---|---:|---:| | Denoising steps | 40 | 8 | | Recorded mean denoising time | 69.23 s | 17.89 s | Historical comparison on two training cases, with loading, encoding and VAE decoding excluded; T40 includes recording callbacks. **Quality retention is unmeasured.** [Full Flint charts and limitations](docs/DETAILS.md#benchmark-charts). ## Code: load the adapter Use the included custom loader in a CUDA/BF16 environment. [Installation instructions](docs/USAGE.md). ```python from pathlib import Path import sys import torch from huggingface_hub import snapshot_download from diffusers import QwenImage21Transformer2DModel local = Path(snapshot_download( "Haverbex/Qwen-Image-2.1-UltraFast", allow_patterns=["adapter/*", "ultraedit_adapter.py", "configs/*", "LICENSE", "NOTICE"], )) sys.path.insert(0, str(local)) from ultraedit_adapter import inject_dit_lora, load_adapter transformer = QwenImage21Transformer2DModel.from_pretrained( "Qwen/Qwen-Image-2.1", subfolder="transformer", revision="790c92633540aa0cb11d9abf19eb46d861714758", torch_dtype=torch.bfloat16, device_map={"": "cuda:0"}, ) adapters = inject_dit_lora( transformer, rank=32, alpha=32, adapter_dtype=torch.bfloat16, ) load_adapter(adapters, local / "adapter") transformer.eval() ``` [Download the loading script](examples/load_adapter.py). This loads weights only. The full generation components and recorded eight-step schedule are explained in the [usage guide](docs/USAGE.md#3-use-the-recorded-generation-setup). **Formats:** [BF16 adapter](https://huggingface.co/Haverbex/Qwen-Image-2.1-UltraFast/tree/main/adapter) · [Merged Q4_K GGUF, 3.77 GiB](https://huggingface.co/Haverbex/Qwen-Image-2.1-UltraFast-GGUF). GGUF image quality and speed have not been benchmarked. [License](LICENSE) · [Notice](NOTICE) · [Training and verification details](docs/DETAILS.md)