Skip to content

Commit

Permalink
add comments about empty_cache
Browse files Browse the repository at this point in the history
Signed-off-by: daquexian <[email protected]>
  • Loading branch information
daquexian committed Jul 7, 2023
1 parent 1e26431 commit 3d49dc2
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions rwkv_pip_package/src/rwkv/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -703,6 +703,8 @@ def forward(self, tokens, state, full_output=False):
del pb[vw_key]
del pb[rw_key]
del pb[ow_key]
# PyTorch's memory pool fails to reuse the freed memory.
# So we empty the cache manually.
torch.cuda.empty_cache()

if prefetch:
Expand Down

0 comments on commit 3d49dc2

Please sign in to comment.