Editing
Diffusion Models
(section)
Jump to navigation
Jump to search
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== <span style="color: #FFFFFF;">Applying</span> == '''Generating images with Stable Diffusion using diffusers:''' <syntaxhighlight lang="python"> from diffusers import StableDiffusionPipeline, DPMSolverMultistepScheduler import torch # Load Stable Diffusion XL pipe = StableDiffusionPipeline.from_pretrained( "stabilityai/stable-diffusion-xl-base-1.0", torch_dtype=torch.float16, variant="fp16" ) # Use fast DPM-Solver++ scheduler (25 steps instead of 50+) pipe.scheduler = DPMSolverMultistepScheduler.from_config(pipe.scheduler.config) pipe = pipe.to("cuda") # Generate image image = pipe( prompt="A futuristic library with glowing holographic books, cinematic lighting, 8K", negative_prompt="blurry, low quality, distorted, watermark", num_inference_steps=25, guidance_scale=7.5, width=1024, height=1024, generator=torch.Generator("cuda").manual_seed(42) ).images[0] image.save("output.png") </syntaxhighlight> ; Key diffusion model parameters : '''num''inference''steps''' β More steps = higher quality but slower. 20-50 is typical; use DDIM or DPM-Solver for efficiency. : '''guidance_scale''' β 7β12 for good prompt adherence. Too high β oversaturation and artifacts. Too low β prompt ignored. : '''negative_prompt''' β Tells the model what to avoid. Useful for removing common quality issues. : '''seed''' β Set for reproducibility; vary for diversity. </div> <div style="background-color: #8B4500; color: #FFFFFF; padding: 20px; border-radius: 8px; margin-bottom: 15px;">
Summary:
Please note that all contributions to BloomWiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
BloomWiki:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Navigation menu
Personal tools
Not logged in
Talk
Contributions
Create account
Log in
Namespaces
Page
Discussion
English
Views
Read
Edit
View history
More
Search
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Tools
What links here
Related changes
Special pages
Page information