-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
CUDA out of memory @ util.paraphrase_mining
#1712
Comments
I guess
|
Putting this before the "stack" might fix the bug: |
@nreimers the solution above works for me and fixes the issue. What do you think? Should I create a PR? Many thanks |
Hi @PhilipMay If your GPU has enough memory, you want to keep the tensors on the GPU, because:
So you only want this line if you run OOM. So maybe some option would be needed. Also torch.stack currently doubles the need for memory, as it has at some time all old tensors and the new tensors. Maybe a better solution would be to create the final matrix up-front in the encode method and to write the generated embeddings to this result matrix? Then we wouldn't have overhead of duplicating all embeddings. |
Hey @PhilipMay! Thank you for providing the fix. I was wondering whether you encountered an issue like that after using this solution: the task is finished according to the progress bar, but it's still running in Jupyter (having an asterisk)? |
No. I can not remember something like that. |
Hi,
I am using
util.paraphrase_mining
on 3,463,703 sentences and a 16 GB GPU:I am getting a CUDA out of memory error:
I am using a model based on
xlm-r-distilroberta-base-paraphrase-v1
and the folling packages:The text was updated successfully, but these errors were encountered: