-
Notifications
You must be signed in to change notification settings - Fork 39
[DO NOT MERGE]Add tutorial for stable diffusion #1528
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
BKC for reproducing the perf on PyTorch 2.6 vs PyTorch 2.7: Copy and create the PT2.7: conda create -n env_2.7 python=3.10
conda activate env_2.7
python -m pip install --pre torch==2.7.0.dev20250312+xpu --index-url https://download.pytorch.org/whl/nightly/xpu
pip install datasets accelerate einops torchmetrics transformers diffusers
# SD-v1-5 LCM
python -u stable_diffusion.py -m SimianLuo/LCM_Dreamshaper_v7 --precision fp16 --num_inference_steps 4 --gscale 8.0 --height 512 --width 512 --warmup_iter 1 --iteration 3
# SDXL
python -u stable_diffusion.py -m stabilityai/stable-diffusion-xl-base-1.0 --precision fp16 --num_inference_steps 20 --gscale 7.5 --height 512 --width 512 --warmup_iter 1 --iteration 3
# Additional Tests
python -u stable_diffusion.py -m runwayml/stable-diffusion-v1-5 --precision fp16 --num_inference_steps 20 --height 512 --width 512 --warmup_iter 1 --iteration 3
python -u stable_diffusion.py -m CompVis/stable-diffusion-v1-4 --precision fp16 --num_inference_steps 20 --gscale 8.0 --height 512 --width 512 --warmup_iter 1 --iteration 3
python -u stable_diffusion.py -m stabilityai/stable-diffusion-xl-base-1.0 --precision fp16 --num_inference_steps 20 --gscale 7.5 --height 768 --width 768 --warmup_iter 1 --iteration 3
python -u stable_diffusion.py -m stabilityai/stable-diffusion-2-1 --precision fp16 --num_inference_steps 20 --gscale 8.0 --height 512 --width 512 --warmup_iter 1 --iteration 3
# Run img2img mode
python -u stable_diffusion.py -m SimianLuo/LCM_Dreamshaper_v7 --precision fp16 --num_inference_steps 4 --gscale 8.0 --height 512 --width 512 --warmup_iter 1 --iteration 3 --pipeline_mode img2img
python -u stable_diffusion.py -m stabilityai/stable-diffusion-xl-base-1.0 --precision fp16 --num_inference_steps 20 --gscale 7.5 --height 512 --width 512 --warmup_iter 1 --iteration 3 img2img PT 2.6: conda create -n env_2.6 python=3.10
conda activate env_2.6
pip install --pre torch==2.6.0 --index-url https://download.pytorch.org/whl/xpu
pip install datasets accelerate einops torchmetrics transformers diffusers
# SD-v1-5 LCM
python -u stable_diffusion.py -m SimianLuo/LCM_Dreamshaper_v7 --precision fp16 --num_inference_steps 4 --gscale 8.0 --height 512 --width 512 --warmup_iter 1 --iteration 3
# SDXL
python -u stable_diffusion.py -m stabilityai/stable-diffusion-xl-base-1.0 --precision fp16 --num_inference_steps 20 --gscale 7.5 --height 512 --width 512 --warmup_iter 1 --iteration 3
# Additional Tests
python -u stable_diffusion.py -m runwayml/stable-diffusion-v1-5 --precision fp16 --num_inference_steps 20 --height 512 --width 512 --warmup_iter 1 --iteration 3
python -u stable_diffusion.py -m CompVis/stable-diffusion-v1-4 --precision fp16 --num_inference_steps 20 --gscale 8.0 --height 512 --width 512 --warmup_iter 1 --iteration 3
python -u stable_diffusion.py -m stabilityai/stable-diffusion-xl-base-1.0 --precision fp16 --num_inference_steps 20 --gscale 7.5 --height 768 --width 768 --warmup_iter 1 --iteration 3
python -u stable_diffusion.py -m stabilityai/stable-diffusion-2-1 --precision fp16 --num_inference_steps 20 --gscale 8.0 --height 512 --width 512 --warmup_iter 1 --iteration 3
# Run img2img mode
python -u stable_diffusion.py -m SimianLuo/LCM_Dreamshaper_v7 --precision fp16 --num_inference_steps 4 --gscale 8.0 --height 512 --width 512 --warmup_iter 1 --iteration 3 --pipeline_mode img2img
python -u stable_diffusion.py -m stabilityai/stable-diffusion-xl-base-1.0 --precision fp16 --num_inference_steps 20 --gscale 7.5 --height 512 --width 512 --warmup_iter 1 --iteration 3 img2img
You will find that the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot reviewed 1 out of 1 changed files in this pull request and generated no comments.
This is a PR for Stable Diffusion tutorial.
Will put into the Dev Discuss, and it is for review only.
For the GitHub auto-rendered doc, please see https://github.com/intel/torch-xpu-ops/blob/tongsu/sd_tutorial/docs/tutorials/stable_diffusion.ipynb
Co-author: @gaopengff