myshell-ai / MeloTTS

High-quality multi-lingual text-to-speech library by MyShell.ai. Support English, Spanish, French, Chinese, Japanese and Korean.
MIT License
4.49k stars 561 forks source link

Loop memory leak on Mac M1 #36

Closed riddlegit closed 2 months ago

riddlegit commented 7 months ago

Maybe caused by hardcode release cuda cache only?

https://github.com/myshell-ai/MeloTTS/blob/9ec3cc2a73c93ea1dfc7507ff71cd540c54d62e8/melo/api.py#L123

louistiti commented 3 months ago

I encountered this problem. On my Mac M1 Pro there is a memory leak where the Python process memory usage keeps increasing after every new inference. I tried to use torch.mps.empty_cache() but it didn't solve the problem.

So my temporary fix is that when it runs on Apple Silicon I will simply set the device to cpu. It works fast enough on it.

riddlegit commented 2 months ago

I encountered this problem. On my Mac M1 Pro there is a memory leak where the Python process memory usage keeps increasing after every new inference. I tried to use torch.mps.empty_cache() but it didn't solve the problem.

So my temporary fix is that when it runs on Apple Silicon I will simply set the device to cpu. It works fast enough on it.

Thanks