From 86f7a7d98515fffe1bf90fa7f6fe70fc27134aa4 Mon Sep 17 00:00:00 2001 From: Intro Date: Thu, 13 Mar 2025 05:04:23 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=B7=A5=E4=BD=9C=E7=9B=AE?= =?UTF-8?q?=E5=BD=95=E5=AF=BC=E5=85=A5=EF=BC=8C=E7=A1=AE=E4=BF=9D=E6=A8=A1?= =?UTF-8?q?=E5=9D=97=E5=AF=BC=E5=85=A5=E6=AD=A3=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- GPT_SoVITS/BigVGAN/bigvgan.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/GPT_SoVITS/BigVGAN/bigvgan.py b/GPT_SoVITS/BigVGAN/bigvgan.py index 214672e..6f52d8f 100644 --- a/GPT_SoVITS/BigVGAN/bigvgan.py +++ b/GPT_SoVITS/BigVGAN/bigvgan.py @@ -14,6 +14,12 @@ import torch.nn as nn from torch.nn import Conv1d, ConvTranspose1d from torch.nn.utils import weight_norm, remove_weight_norm +import sys + +# 确保工作目录包含该目录,否则无法导入 activations +now_dir = os.getcwd() +sys.path.append("%s/GPT_SoVITS/BigVGAN" % (now_dir)) + import activations from utils0 import init_weights, get_padding from alias_free_activation.torch.act import Activation1d as TorchActivation1d @@ -431,7 +437,8 @@ class BigVGAN( """Load Pytorch pretrained weights and return the loaded model.""" # Download and load hyperparameters (h) used by BigVGAN - if os.path.isdir(model_id): + isLocal = os.path.isdir(model_id) + if isLocal: # print("Loading config.json from local directory") config_file = os.path.join(model_id, "config.json") else: