You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Mar 1, 2024. It is now read-only.
This func is repeatedly used for each batch when we run eval_biencoder.py, and if we stay the batch embeddings in GPU, we have to consume GPU memory every time, causing CUDA out of memory error. Therefore .cpu().detach() is required to free GPU memory. Note that the entire candidates are on GPU in get_topk_predictions()later, so we don't need to load GPU during this time.
If some of you have free time, please delete this misleading comment.
The text was updated successfully, but these errors were encountered:
@HelloRusk: Not sure if this has anything to do with CUDA versions, but I found that the GPU memory is not cleared unless embedding_cands.cpu() is reassigned to embedding_cands.
This is, in my case I wasn't able to clear GPU memory by return embedding_cands.cpu().detach(), but rather by modifying it to the following:
Perhaps you don't have to explicitly garbage college by calling torch.cuda.empty_cache() explicitly, but you do need to del the GPU tensor in order to free up the memory on GPU. Simply calling .cpu() on it will create a CPU copy but not vacate GPU memory.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
This is not a bug report but a personal reply to the comment
"# TODO: why do we need cpu here?"
BLINK/blink/biencoder/biencoder.py
Lines 135 to 144 in 5fe254d
This func is repeatedly used for each batch when we run
eval_biencoder.py
, and if we stay the batch embeddings in GPU, we have to consume GPU memory every time, causingCUDA out of memory
error. Therefore.cpu().detach()
is required to free GPU memory. Note that the entire candidates are on GPU inget_topk_predictions()
later, so we don't need to load GPU during this time.If some of you have free time, please delete this misleading comment.
The text was updated successfully, but these errors were encountered: