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

fix: handle device in GPT model properly #143

Merged
merged 5 commits into from
Oct 23, 2024
Merged

fix: handle device in GPT model properly #143

merged 5 commits into from
Oct 23, 2024

Conversation

aaronkl
Copy link
Collaborator

@aaronkl aaronkl commented Oct 21, 2024

What does this implement/fix? Explain your changes.

The GPT module automatically sets device to cuda if CUDA is available. This causes a runtime error, if we move the model to another device via .to(device) after initialization, since the rope cache is still on the original device.

Any other comments?

This fixes also the unit test and handle the handling of devices properly as discussed here.


By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the
terms of your choice.

@aaronkl aaronkl merged commit 4cdfcca into main Oct 23, 2024
7 checks passed
@aaronkl aaronkl deleted the device_handling branch October 23, 2024 12:29
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