Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Same device on DDPMScheduler #48

Merged
merged 1 commit into from
Feb 1, 2023
Merged

Conversation

mspronesti
Copy link
Contributor

@mspronesti mspronesti commented Feb 1, 2023

Now that I have the chance to use the GPU to run diffusion experiments I noticed one of the schedulers I implemented (DDPMScheduler) performs operations on tensors on different devices. This PR fixes it. I double checked all the other schedulers are sound from this point of view.

make sure variance is on same device as model output in the  method
@LaurentMazare LaurentMazare merged commit 44bb82f into LaurentMazare:main Feb 1, 2023
@LaurentMazare
Copy link
Owner

Thanks, out of curiosity what GPU do you end up using? How fast does the process run there compared to your cpu?

@mspronesti
Copy link
Contributor Author

mspronesti commented Feb 1, 2023

Thanks for merging! I used the environment I set up here #46. Compared to my CPU, it is around 45x faster, ignoring the time of the first compilation. I repeated the experiment 10 times using the DDIM scheduler with 50 inference steps:

Hardware avg inference time
Intel Xeon CPU @2.20 GHz 24 min
NVIDIA T4 Tensor Core GPU 32.4 s

As for the python version, it seems comparable. I was wondering a couple of days ago whether working with Vec<_>s instead of tch::Tensors slows down a little the inference process (even if we only access them, we don't perform operations with timesteps or sigmas and when we do we access data that we combine with Tensors)

@mspronesti
Copy link
Contributor Author

mspronesti commented Feb 2, 2023

Updated the above reply with some numbers and some more details on the experimental setup.

I also noticed all the checks failed when you merged this pull request. I'm a little surprised, because they all succeeded when I opened it. I mirrored the repo and re-run all the jobs. After the second attempt, 6 more passed. On the third re-run, they all passed. Perhaps some recent release of the actions broke something ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants