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

Torch CPU Support #2

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open

Torch CPU Support #2

wants to merge 7 commits into from

Conversation

krmchal
Copy link

@krmchal krmchal commented Mar 14, 2024

In the original code there were fragments that did not allow a user to run the code via CPU processing. In the new code I have added a simple Torch pattern as described in their migration guide:

device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")

With this addition added to each A2CU and A3CU class instantiations it allows a user to not have to pass any device information if they do not want or know how to. The code will auto detect and run the code as expected.

I also have made a few edits to the README file to make the install dependencies more verbose as I detected the need for SentencePiece was required due to the T5 Tokenizer class you implemented. I also added a few edits to make the sample Python code inserts provided to be valid in compilation when running (missing some commas).

Important:: I did not make any changes to the logic of your solution. I only added simplicity for users who just wish to download and run the code without knowledge of Torch under their belts to know CPU and GPU specifics.

krmchal added 7 commits March 14, 2024 09:45
Removed indications of GPU usage as this is updated within the class definitions to perform this check
Updated device recognition to be in the class init. Used basic Torch instantiation for GPU and CPU detection.
Updated Torch device instantiation to match simplified use case of detection.
fixed code samples to be python compliant with added commas
Added in sample output of the models
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.

1 participant