Stable Diffusion 3.5
Generate high-fidelity images with accurate text rendering using Stable Diffusion 3.5 on Clore.ai GPUs.
Last updated
Was this helpful?
Was this helpful?
pip install torch torchvision --index-url https://download.pytorch.org/whl/cu124
pip install diffusers transformers accelerate sentencepiece protobuf
python -c "import torch; print(torch.cuda.get_device_name(0))"import torch
from diffusers import StableDiffusion3Pipeline
pipe = StableDiffusion3Pipeline.from_pretrained(
"stabilityai/stable-diffusion-3.5-large",
torch_dtype=torch.bfloat16,
)
pipe.to("cuda")
image = pipe(
prompt=(
"A weathered wooden sign reading 'OPEN 24 HOURS' hanging from "
"a rusty chain outside a neon-lit diner, rainy night, reflections "
"on wet asphalt, cinematic photography"
),
negative_prompt="blurry, deformed text, low quality",
guidance_scale=3.5,
num_inference_steps=28,
width=1024,
height=1024,
generator=torch.Generator("cuda").manual_seed(42),
).images[0]
image.save("diner_sign.png")
print("Saved diner_sign.png")import torch
from diffusers import StableDiffusion3Pipeline
pipe = StableDiffusion3Pipeline.from_pretrained(
"stabilityai/stable-diffusion-3.5-large-turbo",
torch_dtype=torch.bfloat16,
).to("cuda")
# Turbo variant: only 4 steps needed, guidance_scale=0 (distilled)
image = pipe(
prompt="Macro photo of a mechanical watch movement, intricate gears, golden light",
guidance_scale=0.0,
num_inference_steps=4,
width=1024,
height=1024,
).images[0]
image.save("watch_turbo.png")import torch
from diffusers import StableDiffusion3Pipeline
pipe = StableDiffusion3Pipeline.from_pretrained(
"stabilityai/stable-diffusion-3.5-medium",
torch_dtype=torch.float16,
).to("cuda")
image = pipe(
prompt="Isometric view of a cozy coffee shop interior, pixel art style, warm lighting",
guidance_scale=4.0,
num_inference_steps=28,
width=1024,
height=1024,
).images[0]
image.save("coffee_shop_medium.png")import torch
from diffusers import StableDiffusion3Pipeline
pipe = StableDiffusion3Pipeline.from_pretrained(
"stabilityai/stable-diffusion-3.5-large",
torch_dtype=torch.bfloat16,
).to("cuda")
jobs = [
{"prompt": "Portrait of an astronaut in a field of sunflowers", "w": 768, "h": 1344},
{"prompt": "Panoramic landscape of Icelandic highlands, moody skies", "w": 1344, "h": 768},
{"prompt": "Product photo of a perfume bottle on marble surface", "w": 1024, "h": 1024},
]
for i, job in enumerate(jobs):
img = pipe(
prompt=job["prompt"],
guidance_scale=3.5,
num_inference_steps=28,
width=job["w"],
height=job["h"],
).images[0]
img.save(f"batch_{i:03d}.png")
print(f"[{i+1}/{len(jobs)}] {job['w']}x{job['h']} done")