-
Notifications
You must be signed in to change notification settings - Fork 65
Add support for GPU to similarity. #999
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
Conversation
Issue 2 - pickle deserialization gets confused. Once I got past the above issue, I started getting a different stack trace:
Upon further investigation, I found what I believe to be the same issue reported here - pytorch/pytorch#16797. The problem went away once I applied the workaround suggested in that Github issue. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Thanks!
def score(self, inputs: list[tuple[str, str]]) -> list[float]: | ||
import torch | ||
|
||
print(f"GPU: {torch.cuda.is_available()}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor: Might want to remove this (or change to log).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will do.
We want to be able to run the rerank transform on Ray on GPU, but we found a couple of issues while testing this using
test_rerank.py
. The tests in test_rerank.py currently run inExecMode.LOCAL
and I suspect most of the time they are run on CPU. If you change the execution mode to RAY and run the tests on a GPU machine, we find the following issues.Issue 1 - similarity does not properly run on GPU.
Here's the stack trace:
I took a suggestion from @HenryL27 and mirrored the GPU setup in
embed.py
and the above problem went away. This is the diff in similarity.py.