fix: 卸载音色省显存

顺便将所有print换成了统一的logger
This commit is contained in:
源文雨
2023-09-01 15:18:08 +08:00
parent 8d5a77dbe9
commit 04a33b9709
23 changed files with 189 additions and 106 deletions

View File

@@ -3,7 +3,8 @@
对源特征进行检索
"""
import os
import pdb
import logging
logger = logging.getLogger(__name__)
import parselmouth
import torch
@@ -15,7 +16,6 @@ from time import time as ttime
# import pyworld
import librosa
import numpy as np
import scipy.signal as signal
import soundfile as sf
import torch.nn.functional as F
from fairseq import checkpoint_utils
@@ -34,7 +34,7 @@ from scipy.io import wavfile
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
model_path = r"E:\codes\py39\vits_vc_gpu_train\assets\hubert\hubert_base.pt" #
print("Load model(s) from {}".format(model_path))
logger.info("Load model(s) from {}".format(model_path))
models, saved_cfg, task = checkpoint_utils.load_model_ensemble_and_task(
[model_path],
suffix="",
@@ -77,7 +77,7 @@ net_g = SynthesizerTrn256(
# weights=torch.load("infer/ft-mi-freeze-vocoder_true_1k.pt")
# weights=torch.load("infer/ft-mi-sim1k.pt")
weights = torch.load("infer/ft-mi-no_opt-no_dropout.pt")
print(net_g.load_state_dict(weights, strict=True))
logger.debug(net_g.load_state_dict(weights, strict=True))
net_g.eval().to(device)
net_g.half()
@@ -198,4 +198,4 @@ for idx, name in enumerate(
wavfile.write("ft-mi-no_opt-no_dropout-%s.wav" % name, 40000, audio) ##
print(ta0, ta1, ta2) #
logger.debug(ta0, ta1, ta2) #