Skip to content

Torch CPU Support#2

Open
krmchal wants to merge 7 commits into
Yale-LILY:mainfrom
krmchal:main
Open

Torch CPU Support#2
krmchal wants to merge 7 commits into
Yale-LILY:mainfrom
krmchal:main

Conversation

@krmchal

@krmchal krmchal commented Mar 14, 2024

Copy link
Copy Markdown

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