Skip to content

Commit

Permalink
add cuda empty cache to properly release cuda memory
Browse files Browse the repository at this point in the history
  • Loading branch information
Isalia20 committed Apr 19, 2024
1 parent 4ba6485 commit dfa4dd8
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions backgroundremover/u2net/detect.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,5 +151,6 @@ def predict(net, item):
img = Image.fromarray(predict_np * 255).convert("RGB")

del d1, d2, d3, d4, d5, d6, d7, pred, predict, predict_np, inputs_test, sample
torch.cuda.empty_cache() if torch.cuda.is_available() else None

return img

0 comments on commit dfa4dd8

Please sign in to comment.