From 956ae586776a154ea15868651ac579520868abf3 Mon Sep 17 00:00:00 2001 From: YongKang Zhou Date: Wed, 31 Jan 2024 10:47:13 +0800 Subject: [PATCH] Update api.py --- api.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/api.py b/api.py index 60ed9ff..9d5edb0 100644 --- a/api.py +++ b/api.py @@ -439,7 +439,8 @@ def handle(refer_wav_path, prompt_text, prompt_language, text, text_language): wav.seek(0) torch.cuda.empty_cache() - torch.mps.empty_cache() + if device == "mps": + torch.mps.empty_cache() return StreamingResponse(wav, media_type="audio/wav")