Skip to content

Theweekfoolish229/Qwen-Image-Lightning

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Qwen-Image-Lightning

We are excited to release the distilled version of Qwen-Image. It preserves the capability of complex text rendering.

🔥 Latest News

📑 Todo List

  • Qwen-Image-Lightning-8steps-V1.0
  • Qwen-Image-Lightning-4steps-V1.0
  • ComfyUI Workflow
  • Improve Quality

📑 Demo Images

The prompts are from Qwen-Image, Qwen-Image Blog and Qwen-Image-Service. Generated with seed 42, you can reproduce the results with examples/prompt_list.txt.

Prompt Base NEF=100 Qwen-Image-Lightning-8steps-V1.0 NEF=8
A coffee shop entrance features a chalkboard sign reading "Qwen Coffee 😊 $2 per cup," with a neon light beside it displaying "通义千问". Next to it hangs a poster showing a beautiful Chinese woman, and beneath the poster is written "π≈3.1415926-53589793-23846264-33832795-02384197". demo1 demo1
一幅精致细腻的工笔画,画面中心是一株蓬勃生长的红色牡丹,花朵繁茂,既有盛开的硕大花瓣,也有含苞待放的花蕾,层次丰富,色彩艳丽而不失典雅。牡丹枝叶舒展,叶片浓绿饱满,脉络清晰可见,与红花相映成趣。一只蓝紫色蝴蝶仿佛被画中花朵吸引,停驻在画面中央的一朵盛开牡丹上,流连忘返,蝶翼轻展,细节逼真,仿佛随时会随风飞舞。整幅画作笔触工整严谨,色彩浓郁鲜明,展现出中国传统工笔画的精妙与神韵,画面充满生机与灵动之感。 demo2 demo2
*A young girl wearing school uniform stands in a classroom, writing on a chalkboard. The text "Introducing Qwen-Image, a foundational image generation model that excels in complex text rendering and precise image editing" appears in neat white chalk at the center of the blackboard. Soft natural light filters through windows, casting gentle shadows. The scene is rendered in a realistic photography style with fine details, shallow depth of field, and warm tones. The girl's focused expression and chalk dust in the air add dynamism. Background elements include desks and educational posters, subtly blurred to emphasize the central action. Ultra-detailed 32K resolution, DSLR-quality, soft bokeh effect, documentary-style composition demo3 demo3
A coffee shop entrance features a chalkboard sign reading "Qwen Coffee 😊 $2 per cup," with a neon light beside it displaying "通义千问". Next to it hangs a poster showing a beautiful Chinese woman, and beneath the poster is written "π≈3.1415926-53589793-23846264-33832795-02384197". badcase1 badcase1

The last row shows a badcase of the distilled model.

📑 Limitation

Neither the distilled models nor the Qwen-Image base model can consistently generate perfect results. We observed that the same model exhibits varying performance for the same prompt under different resolutions. A specific test case might favor one model, while other cases might yield completely opposite results. We sampled a collection of prompts examples/prompt_list.txt, and you can compare the performance of the distilled models and the base model by running the following scripts.

🚀 Run Evaluation and Test

Installation

Please follow Qwen-Image to install the Python Environment and download the Base Model.

Model Download

Download models using huggingface-cli:

pip install "huggingface_hub[cli]"
huggingface-cli download lightx2v/Qwen-Image-Lightning --local-dir ./Qwen-Image-Lightning

Run 8-step Model

# 8 steps, cfg 1.0
python generate_with_diffusers.py \
--prompt_list_file examples/prompt_list.txt \
--out_dir test_lora_8_step_results \
--lora_path Qwen-Image-Lightning/Qwen-Image-Lightning-8steps-V1.0.safetensors \
--base_seed 42 --steps 8 --cfg 1.0

Run 4-step Model

# 4 steps, cfg 1.0
python generate_with_diffusers.py \
--prompt_list_file examples/prompt_list.txt \
--out_dir test_lora_4_step_results \
--lora_path Qwen-Image-Lightning/Qwen-Image-Lightning-4steps-V1.0.safetensors \
--base_seed 42 --steps 4 --cfg 1.0

Run base Model

# 50 steps, cfg 4.0
python generate_with_diffusers.py \
--prompt_list_file examples/prompt_list.txt \
--out_dir test_base_results \
--base_seed 42 --steps 50 --cfg 4.0

🎨 ComfyUI Workflow

ComfyUI workflow is available in the workflows/ directory. The workflow is based on the Qwen-Image ComfyUI tutorial and has been verified with ComfyUI repository at commit ID 37d620a6b85f61b824363ed8170db373726ca45a.

Workflow Files

  • workflows/qwen-image-8steps.json - 8-step lightning workflow for Qwen-Image
  • workflows/qwen-image-4steps.json - 4-step lightning workflow for Qwen-Image

Usage

  1. Install ComfyUI following the official instructions
  2. Download and place the Qwen-Image base model following the Qwen-Image ComfyUI tutorial (include UNet/CLIP/VAE files into proper ComfyUI folders)
  3. For 8-step workflow:
    • Load workflows/qwen-image-8steps.json
    • Put Qwen-Image-Lightning-8steps-V1.0.safetensors into ComfyUI/models/loras/
    • Ensure KSampler steps = 8
  4. For 4-step workflow:
    • Load workflows/qwen-image-4steps.json
    • Put Qwen-Image-Lightning-4steps-V1.0.safetensors into ComfyUI/models/loras/
    • Ensure KSampler steps = 4
  5. Run the workflow to generate images

License Agreement

The models in this repository are licensed under the Apache 2.0 License. We claim no rights over your generated contents, granting you the freedom to use them while ensuring that your usage complies with the provisions of this license. You are fully accountable for your use of the models, which must not involve sharing any content that violates applicable laws, causes harm to individuals or groups, disseminates personal information intended for harm, spreads misinformation, or targets vulnerable populations. For a complete list of restrictions and details regarding your rights, please refer to the full text of the license.

Acknowledgements

We built upon and reused code from the following projects: Qwen-Image, licensed under the Apache License 2.0.

The evaluation text prompts are from Qwen-Image, Qwen-Image Blog and Qwen-Image-Service.

Star History

Star History Chart

About

Qwen-Image-Lightning: Speed up Qwen-Image model with distillation

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Python 100.0%