-
Couldn't load subscription status.
- Fork 6.5k
Closed
Labels
bugSomething isn't workingSomething isn't workingschedulerstaleIssues that haven't received updatesIssues that haven't received updates
Description
Describe the bug
The DPMSolverSinglestepScheduler throws a value error "step must be greater than zero" in terminal. No other scheduler had this issue. When I set clipped_idx to be a small value like 0.01, the error goes away.
Reproduction
import torch, random, os
from diffusers import (StableDiffusionXLPipeline, DPMSolverSinglestepScheduler)
model = "JuggernautXL-V11.safetensors"
prompt = "A beautiful sunrise over a mountain range in oregon during winter, high resolution photograph"
negative_prompt = "cartoon, anime, unrealistic, low resolution, low quality"
num_inference_steps = 20
guidance_scale = 7
width = 768
height = 1024
seed = None
scheduler = DPMSolverSinglestepScheduler
pipeline = StableDiffusionXLPipeline.from_single_file(f"models/{model}")
pipeline.scheduler = scheduler.from_config(pipeline.scheduler.config)
device = "cuda" if torch.cuda.is_available() else "cpu"
precision = torch.float16 if device == "cuda" else torch.float32
pipeline = pipeline.to(device=device, dtype=precision)
if seed is None:
seed = random.randint(0, 2**32 - 1)
generator = torch.Generator().manual_seed(seed)
output = pipeline(
prompt=prompt,
negative_prompt=negative_prompt,
num_inference_steps=num_inference_steps,
guidance_scale=guidance_scale,
width=width,
height=height,
generator=generator
)
os.makedirs("outputs", exist_ok=True)
filename = next(
(f"outputs/{seed}-{i}.png" for i in range(1, 1000)
if not os.path.exists(f"outputs/{seed}-{i}.png")),
f"outputs/{seed}.png"
)
output.images[0].save(filename)
print(f"Image saved to {filename}")
Logs
Values I printed from the scheduler out of curiosity:
Scheduler: DPMSolverSinglestepScheduler
num_inference_steps: 20
self.lambda_t values: [3.5346992015838623, 3.186542272567749, 2.982215166091919, 2.8367769718170166, 2.72361421585083, 2.630859851837158, 2.552189826965332, 2.483828544616699, 2.423344850540161, 2.3690710067749023 (AND MANY MANY MORE)
self.config.lambda_min_clipped: -inf
Clipping threshold index: 0
Error source:
File "/.venv/lib/python3.12/site-packages/diffusers/schedulers/scheduling_dpmsolver_singlestep.py", line 321, in set_timesteps
np.linspace(0, self.config.num_train_timesteps - 1 - clipped_idx, num_inference_steps + 1)
ValueError: step must be greater than zero
System Info
diffusers==0.30.2, StableDiffusionXLPipeline
on M1 iMac
Who can help?
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingschedulerstaleIssues that haven't received updatesIssues that haven't received updates