From d796bd40b9e436eb374c08051680aeb1dc096f2f Mon Sep 17 00:00:00 2001 From: RVC-Boss <129054828+RVC-Boss@users.noreply.github.com> Date: Thu, 25 Jan 2024 23:28:08 +0800 Subject: [PATCH] Update 2-get-hubert-wav32k.py --- GPT_SoVITS/prepare_datasets/2-get-hubert-wav32k.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/GPT_SoVITS/prepare_datasets/2-get-hubert-wav32k.py b/GPT_SoVITS/prepare_datasets/2-get-hubert-wav32k.py index 31e8068..26c71b7 100644 --- a/GPT_SoVITS/prepare_datasets/2-get-hubert-wav32k.py +++ b/GPT_SoVITS/prepare_datasets/2-get-hubert-wav32k.py @@ -47,7 +47,12 @@ os.makedirs(wav32dir,exist_ok=True) maxx=0.95 alpha=0.5 -device="cuda:0" if torch.cuda.is_available() else "mps" +if torch.cuda.is_available(): + device = "cuda:0" +elif torch.backends.mps.is_available(): + device = "mps" +else: + device = "cpu" model=cnhubert.get_model() # is_half=False if(is_half==True): @@ -106,4 +111,4 @@ if(len(nan_fails)>0 and is_half==True): try: name2go(wav_name) except: - print(wav_name,traceback.format_exc()) \ No newline at end of file + print(wav_name,traceback.format_exc())