-
Notifications
You must be signed in to change notification settings - Fork 5.8k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Fix DDIM on Windows not using int64 for timesteps #819
Conversation
The documentation is not available anymore as the PR was closed or merged. |
Hey @hafriedlander, Thanks a lot for the issue. In general, we tend to check the library much more with Linux or Mac, but we want to be better at providing full support for Windows as well. Just to understand better, do you know why we need to cast the int values to 64. In general this change seems fine to me though - what do you think @anton-l ? |
Windows numpy uses int32 values as the standard integer, regardless of platform. So timesteps becomes an array of int32. We pass in individual timestep member into add_noise, and index alphas_cumprod with it. But you can't use an int32 as a tensor index in PyTorch, it complains. Linux defaults to int64 so you don't see it there. (This would probably also break on i386 Linux, just that there aren't many of those around any more :) ) |
Thanks a lot for the explanation! Just wondering - isn't int32 the better dtype here? I cannot really think of a case where we would need a number higher than 2**31 for time steps ? Does this PR solve a use case that currently doesn't work? |
Also cc @anton-l |
This line fails with int32
PyTorch requires index tensors to be Long |
Makes sense @hafriedlander, thanks for checking! |
Same fix as already in pndm - https://github.com/huggingface/diffusers/blob/main/src/diffusers/schedulers/scheduling_pndm.py#L190