Merged
Conversation
…evice due to some torch.load issues
gsprochette
requested changes
Aug 20, 2025
Collaborator
gsprochette
left a comment
There was a problem hiding this comment.
Makes sense, the fix itself is ready to merge but could you add a test with Sana so we can see the before-after, and so the reason for this "inefficient" loading becomes clear to someone who would like to optimize it when they run the tests?
Member
Author
|
there are already tests with Sana, which are currently failing - this PR fixes these tests |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR does a little fix
When using torch.load, always load to cpu first and then move to target device.
Problem when loading to the device directly was, that every tensor within a pipeline e.g. was moved to cuda, also some which are not supposed to be - not every pipeline can handle this unexpected device (e.g. SanaPipeline)
By loading to cpu first and then moving to target device, we make sure that only the right parts are moved to the target_device
Related Issue
Type of Change
How Has This Been Tested?
Every test which is using torch.load has been re-run and is successful
Checklist
Additional Notes