huggingface / diffusers

🤗 Diffusers: State-of-the-art diffusion models for image and audio generation in PyTorch and FLAX.
https://huggingface.co/docs/diffusers
Apache License 2.0
25.13k stars 5.19k forks source link

PNDMScheduler Inference Timesteps Bug => Repeated Inference Timestep #9090

Open liming-ai opened 1 month ago

liming-ai commented 1 month ago

Describe the bug

from diffusers import PNDMScheduler

scheduler = PNDMScheduler.from_pretrained('runwayml/stable-diffusion-v1-5', subfolder="scheduler")
scheduler.set_timesteps(20)
print(scheduler.timesteps)

# there are 21 timesteps with repeated step
# tensor([951, 901, 901, 851, 801, 751, 701, 651, 601, 551, 501, 451, 401, 351,
#         301, 251, 201, 151, 101,  51,   1])

Reproduction

from diffusers import PNDMScheduler

scheduler = PNDMScheduler.from_pretrained('runwayml/stable-diffusion-v1-5', subfolder="scheduler")
scheduler.set_timesteps(20)
print(scheduler.timesteps)

# there are 21 timesteps with repeated step
# tensor([951, 901, 901, 851, 801, 751, 701, 651, 601, 551, 501, 451, 401, 351,
#         301, 251, 201, 151, 101,  51,   1])

Logs

No response

System Info

Who can help?

No response

a-r-r-o-w commented 1 month ago

Could you provide more context as to why you think this is incorrect? If possible, could you compare against the original implementation and verify if the Diffusers behaviour is indeed different from the original formulation? If yes, feel free to PR and tag @yiyixuxu