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

Always call .to(device) if it was passed as an argument #583

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

mickvangelderen
Copy link

This fixes #582 where if setting torch.set_default_device('not cpu'), the device for the tensor ends up being the default device rather than the passed device.

What does this PR do?

Fixes #582

NOTE: I could not find any development instructions in the repository after a brief search. This PR would be better with a test case that shows the problem and then another commit that fixes it but I am unfamiliar with maturin. Feel free to provide instructions or take my work and finish it.

This fixes huggingface#582 where if setting torch.set_default_device('not cpu'), the device for the tensor ends up being the default device rather than the passed device.
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.

load_file does apply to(device) when device = "cpu"
1 participant