mirror of
https://github.com/RVC-Boss/GPT-SoVITS.git
synced 2025-04-06 03:57:44 +08:00
Merge pull request #319 from xiaokang00010/patch-1
Fix "AttributeError: module 'torch' has no attribute 'mps'" in api.py while running on non-Apple platform
This commit is contained in:
commit
06f23c4a0a
11
api.py
11
api.py
@ -104,8 +104,13 @@ RESP: 无
|
|||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
import os
|
import os
|
||||||
import signal
|
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
now_dir = os.getcwd()
|
||||||
|
sys.path.append(now_dir)
|
||||||
|
sys.path.append("%s/GPT_SoVITS" % (now_dir))
|
||||||
|
|
||||||
|
import signal
|
||||||
from time import time as ttime
|
from time import time as ttime
|
||||||
import torch
|
import torch
|
||||||
import librosa
|
import librosa
|
||||||
@ -439,7 +444,9 @@ def handle(refer_wav_path, prompt_text, prompt_language, text, text_language):
|
|||||||
wav.seek(0)
|
wav.seek(0)
|
||||||
|
|
||||||
torch.cuda.empty_cache()
|
torch.cuda.empty_cache()
|
||||||
torch.mps.empty_cache()
|
if device == "mps":
|
||||||
|
print('executed torch.mps.empty_cache()')
|
||||||
|
torch.mps.empty_cache()
|
||||||
return StreamingResponse(wav, media_type="audio/wav")
|
return StreamingResponse(wav, media_type="audio/wav")
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user