towhee-io / examples

Analyze the unstructured data with Towhee, such as reverse image search, reverse video search, audio classification, question and answer systems, molecular search, etc.
Apache License 2.0
436 stars 111 forks source link

How to free GPU memory #235

Open boatingMen opened 1 year ago

boatingMen commented 1 year ago

When I write the text video retrieval function as a Python script, when using the function, GPU video memory increases with the increase of the number of uses (search), and the kill script is released, I want to ask whether the existing method can release video memory?

riichg5 commented 12 months ago

you can use torch.cuda.empty_cache() in you code at any where.

import torch
torch.cuda.empty_cache()