-
I created an interface for audio to text transcription requests. I load a model for each request, and after the request is complete I want to destroy the model, how should I handle it? I have tried many methods but failed to destroy the model. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
To fully release the model from memory, you'll need to |
Beta Was this translation helpful? Give feedback.
To fully release the model from memory, you'll need to
del
all references to the model, followed bytorch.cuda.empty_cache()
and potentiallygc.collect()
as well. But generally, it's not a very good idea to load the model for each request because it takes long to load the model from the disk and to the memory just to handle one request.