diff --git a/src/f5_tts/infer/utils_infer.py b/src/f5_tts/infer/utils_infer.py index 6b33bb8..1251f79 100644 --- a/src/f5_tts/infer/utils_infer.py +++ b/src/f5_tts/infer/utils_infer.py @@ -21,7 +21,7 @@ import numpy as np import torch import torchaudio import tqdm -from huggingface_hub import snapshot_download, hf_hub_download +from huggingface_hub import hf_hub_download from pydub import AudioSegment, silence from transformers import pipeline from vocos import Vocos @@ -128,11 +128,12 @@ def load_vocoder(vocoder_name="vocos", is_local=False, local_path="", device=dev except ImportError: print("You need to follow the README to init submodule and change the BigVGAN source code.") if is_local: - """download from https://huggingface.co/nvidia/bigvgan_v2_24khz_100band_256x/tree/main""" + # download generator from https://huggingface.co/nvidia/bigvgan_v2_24khz_100band_256x/tree/main vocoder = bigvgan.BigVGAN.from_pretrained(local_path, use_cuda_kernel=False) else: - local_path = snapshot_download(repo_id="nvidia/bigvgan_v2_24khz_100band_256x", cache_dir=hf_cache_dir) - vocoder = bigvgan.BigVGAN.from_pretrained(local_path, use_cuda_kernel=False) + vocoder = bigvgan.BigVGAN.from_pretrained( + "nvidia/bigvgan_v2_24khz_100band_256x", use_cuda_kernel=False, cache_dir=hf_cache_dir + ) vocoder.remove_weight_norm() vocoder = vocoder.eval().to(device)