DiffSynth-Studio/Qwen-Image-Distill-Full
099
1---2license: apache-2.03---4# Qwen-Image Full Distillation Accelerated Model5 67 8## Model Introduction9 10This model is a distilled and accelerated version of [Qwen-Image](https://www.modelscope.cn/models/Qwen/Qwen-Image). The original model requires 40 inference steps and classifier-free guidance (CFG), resulting in a total of 80 forward passes. In contrast, the distilled accelerated model only requires 15 inference steps without CFG, totaling just 15 forward passes—**achieving approximately 5x speedup**. Of course, the number of inference steps can be further reduced based on requirements, though this may lead to some degradation in generation quality.11 12The training framework is built upon [DiffSynth-Studio](https://github.com/modelscope/DiffSynth-Studio). The training data consists of 16,000 images generated by the original model using randomly sampled prompts from [DiffusionDB](https://www.modelscope.cn/datasets/AI-ModelScope/diffusiondb). The training process was conducted on 8 * MI308X GPUs and took approximately one day.13 14## Performance Comparison15 16||Original Model|Original Model|Accelerated Model|17|-|-|-|-|18|Inference Steps|40|15|15|19|CFG Scale|4|1|1|20|Forward Passes|80|15|15|21|Example 1||||22|Example 2||||23|Example 3||||24 25## Inference Code26 27```shell28git clone https://github.com/modelscope/DiffSynth-Studio.git 29cd DiffSynth-Studio30pip install -e .31```32 33```python34from diffsynth.pipelines.qwen_image import QwenImagePipeline, ModelConfig35import torch36 37 38pipe = QwenImagePipeline.from_pretrained(39 torch_dtype=torch.bfloat16,40 device="cuda",41 model_configs=[42 ModelConfig(model_id="DiffSynth-Studio/Qwen-Image-Distill-Full", origin_file_pattern="diffusion_pytorch_model*.safetensors"),43 ModelConfig(model_id="Qwen/Qwen-Image", origin_file_pattern="text_encoder/model*.safetensors"),44 ModelConfig(model_id="Qwen/Qwen-Image", origin_file_pattern="vae/diffusion_pytorch_model.safetensors"),45 ],46 tokenizer_config=ModelConfig(model_id="Qwen/Qwen-Image", origin_file_pattern="tokenizer/"),47)48prompt = "精致肖像,水下少女,蓝裙飘逸,发丝轻扬,光影透澈,气泡环绕,面容恬静,细节精致,梦幻唯美。"49image = pipe(prompt, seed=0, num_inference_steps=15, cfg_scale=1)50image.save("image.jpg")51```