Format code (#1162)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
This commit is contained in:
parent
a86806b01a
commit
dace5a6f99
@ -718,7 +718,9 @@ if __name__ == "__main__":
|
|||||||
sd.default.device[1] = output_device_indices[
|
sd.default.device[1] = output_device_indices[
|
||||||
output_devices.index(output_device)
|
output_devices.index(output_device)
|
||||||
]
|
]
|
||||||
logger.info("Input device:" + str(sd.default.device[0]) + ":" + str(input_device))
|
logger.info(
|
||||||
|
"Input device:" + str(sd.default.device[0]) + ":" + str(input_device)
|
||||||
|
)
|
||||||
logger.info(
|
logger.info(
|
||||||
"Output device:" + str(sd.default.device[1]) + ":" + str(output_device)
|
"Output device:" + str(sd.default.device[1]) + ":" + str(output_device)
|
||||||
)
|
)
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import math
|
import math
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
@ -615,7 +616,9 @@ class SynthesizerTrnMs256NSFsid(nn.Module):
|
|||||||
inter_channels, hidden_channels, 5, 1, 3, gin_channels=gin_channels
|
inter_channels, hidden_channels, 5, 1, 3, gin_channels=gin_channels
|
||||||
)
|
)
|
||||||
self.emb_g = nn.Embedding(self.spk_embed_dim, gin_channels)
|
self.emb_g = nn.Embedding(self.spk_embed_dim, gin_channels)
|
||||||
logger.debug("gin_channels:", gin_channels, "self.spk_embed_dim:", self.spk_embed_dim)
|
logger.debug(
|
||||||
|
"gin_channels:", gin_channels, "self.spk_embed_dim:", self.spk_embed_dim
|
||||||
|
)
|
||||||
|
|
||||||
def remove_weight_norm(self):
|
def remove_weight_norm(self):
|
||||||
self.dec.remove_weight_norm()
|
self.dec.remove_weight_norm()
|
||||||
@ -731,7 +734,9 @@ class SynthesizerTrnMs768NSFsid(nn.Module):
|
|||||||
inter_channels, hidden_channels, 5, 1, 3, gin_channels=gin_channels
|
inter_channels, hidden_channels, 5, 1, 3, gin_channels=gin_channels
|
||||||
)
|
)
|
||||||
self.emb_g = nn.Embedding(self.spk_embed_dim, gin_channels)
|
self.emb_g = nn.Embedding(self.spk_embed_dim, gin_channels)
|
||||||
logger.debug("gin_channels:", gin_channels, "self.spk_embed_dim:", self.spk_embed_dim)
|
logger.debug(
|
||||||
|
"gin_channels:", gin_channels, "self.spk_embed_dim:", self.spk_embed_dim
|
||||||
|
)
|
||||||
|
|
||||||
def remove_weight_norm(self):
|
def remove_weight_norm(self):
|
||||||
self.dec.remove_weight_norm()
|
self.dec.remove_weight_norm()
|
||||||
@ -844,7 +849,9 @@ class SynthesizerTrnMs256NSFsid_nono(nn.Module):
|
|||||||
inter_channels, hidden_channels, 5, 1, 3, gin_channels=gin_channels
|
inter_channels, hidden_channels, 5, 1, 3, gin_channels=gin_channels
|
||||||
)
|
)
|
||||||
self.emb_g = nn.Embedding(self.spk_embed_dim, gin_channels)
|
self.emb_g = nn.Embedding(self.spk_embed_dim, gin_channels)
|
||||||
logger.debug("gin_channels:", gin_channels, "self.spk_embed_dim:", self.spk_embed_dim)
|
logger.debug(
|
||||||
|
"gin_channels:", gin_channels, "self.spk_embed_dim:", self.spk_embed_dim
|
||||||
|
)
|
||||||
|
|
||||||
def remove_weight_norm(self):
|
def remove_weight_norm(self):
|
||||||
self.dec.remove_weight_norm()
|
self.dec.remove_weight_norm()
|
||||||
@ -950,7 +957,9 @@ class SynthesizerTrnMs768NSFsid_nono(nn.Module):
|
|||||||
inter_channels, hidden_channels, 5, 1, 3, gin_channels=gin_channels
|
inter_channels, hidden_channels, 5, 1, 3, gin_channels=gin_channels
|
||||||
)
|
)
|
||||||
self.emb_g = nn.Embedding(self.spk_embed_dim, gin_channels)
|
self.emb_g = nn.Embedding(self.spk_embed_dim, gin_channels)
|
||||||
logger.debug("gin_channels:", gin_channels, "self.spk_embed_dim:", self.spk_embed_dim)
|
logger.debug(
|
||||||
|
"gin_channels:", gin_channels, "self.spk_embed_dim:", self.spk_embed_dim
|
||||||
|
)
|
||||||
|
|
||||||
def remove_weight_norm(self):
|
def remove_weight_norm(self):
|
||||||
self.dec.remove_weight_norm()
|
self.dec.remove_weight_norm()
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import math
|
import math
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
@ -619,7 +620,9 @@ class SynthesizerTrnMsNSFsidM(nn.Module):
|
|||||||
)
|
)
|
||||||
self.emb_g = nn.Embedding(self.spk_embed_dim, gin_channels)
|
self.emb_g = nn.Embedding(self.spk_embed_dim, gin_channels)
|
||||||
self.speaker_map = None
|
self.speaker_map = None
|
||||||
logger.debug("gin_channels:", gin_channels, "self.spk_embed_dim:", self.spk_embed_dim)
|
logger.debug(
|
||||||
|
"gin_channels:", gin_channels, "self.spk_embed_dim:", self.spk_embed_dim
|
||||||
|
)
|
||||||
|
|
||||||
def remove_weight_norm(self):
|
def remove_weight_norm(self):
|
||||||
self.dec.remove_weight_norm()
|
self.dec.remove_weight_norm()
|
||||||
|
@ -4,6 +4,7 @@ import onnxruntime
|
|||||||
import soundfile
|
import soundfile
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import os
|
import os
|
||||||
import traceback
|
import traceback
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
@ -2,6 +2,7 @@ import torch
|
|||||||
import torch.utils.data
|
import torch.utils.data
|
||||||
from librosa.filters import mel as librosa_mel_fn
|
from librosa.filters import mel as librosa_mel_fn
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
MAX_WAV_VALUE = 32768.0
|
MAX_WAV_VALUE = 32768.0
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
now_dir = os.getcwd()
|
now_dir = os.getcwd()
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import os
|
import os
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
import librosa
|
import librosa
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import os
|
import os
|
||||||
import traceback
|
import traceback
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
import ffmpeg
|
import ffmpeg
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import os
|
import os
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
import librosa
|
import librosa
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import traceback
|
import traceback
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
@ -52,8 +53,16 @@ class VC:
|
|||||||
if not sid:
|
if not sid:
|
||||||
if self.hubert_model is not None: # 考虑到轮询, 需要加个判断看是否 sid 是由有模型切换到无模型的
|
if self.hubert_model is not None: # 考虑到轮询, 需要加个判断看是否 sid 是由有模型切换到无模型的
|
||||||
logger.info("Clean model cache")
|
logger.info("Clean model cache")
|
||||||
del self.net_g, self.n_spk, self.vc, self.hubert_model, self.tgt_sr # ,cpt
|
del (
|
||||||
self.hubert_model = self.net_g = self.n_spk = self.vc = self.hubert_model = self.tgt_sr = None
|
self.net_g,
|
||||||
|
self.n_spk,
|
||||||
|
self.vc,
|
||||||
|
self.hubert_model,
|
||||||
|
self.tgt_sr,
|
||||||
|
) # ,cpt
|
||||||
|
self.hubert_model = (
|
||||||
|
self.net_g
|
||||||
|
) = self.n_spk = self.vc = self.hubert_model = self.tgt_sr = None
|
||||||
if torch.cuda.is_available():
|
if torch.cuda.is_available():
|
||||||
torch.cuda.empty_cache()
|
torch.cuda.empty_cache()
|
||||||
###楼下不这么折腾清理不干净
|
###楼下不这么折腾清理不干净
|
||||||
|
@ -2,6 +2,7 @@ import os
|
|||||||
import sys
|
import sys
|
||||||
import traceback
|
import traceback
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
from functools import lru_cache
|
from functools import lru_cache
|
||||||
@ -267,9 +268,7 @@ class Pipeline(object):
|
|||||||
with torch.no_grad():
|
with torch.no_grad():
|
||||||
hasp = pitch is not None and pitchf is not None
|
hasp = pitch is not None and pitchf is not None
|
||||||
arg = (feats, p_len, pitch, pitchf, sid) if hasp else (feats, p_len, sid)
|
arg = (feats, p_len, pitch, pitchf, sid) if hasp else (feats, p_len, sid)
|
||||||
audio1 = (
|
audio1 = (net_g.infer(*arg)[0][0, 0]).data.cpu().float().numpy()
|
||||||
(net_g.infer(*arg)[0][0, 0]).data.cpu().float().numpy()
|
|
||||||
)
|
|
||||||
del hasp, arg
|
del hasp, arg
|
||||||
del feats, p_len, padding_mask
|
del feats, p_len, padding_mask
|
||||||
if torch.cuda.is_available():
|
if torch.cuda.is_available():
|
||||||
|
@ -2,6 +2,7 @@ import os
|
|||||||
|
|
||||||
from fairseq import checkpoint_utils
|
from fairseq import checkpoint_utils
|
||||||
|
|
||||||
|
|
||||||
def get_index_path_from_model(sid):
|
def get_index_path_from_model(sid):
|
||||||
return next(
|
return next(
|
||||||
(
|
(
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
# Fill in the path of the model to be queried and the root directory of the reference models, and this script will return the similarity between the model to be queried and all reference models.
|
# Fill in the path of the model to be queried and the root directory of the reference models, and this script will return the similarity between the model to be queried and all reference models.
|
||||||
import os
|
import os
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
import torch
|
import torch
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
"""
|
"""
|
||||||
import os
|
import os
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
import parselmouth
|
import parselmouth
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
import os
|
import os
|
||||||
import traceback
|
import traceback
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
from multiprocessing import cpu_count
|
from multiprocessing import cpu_count
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
"""
|
"""
|
||||||
import os
|
import os
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
import faiss
|
import faiss
|
||||||
|
@ -2,6 +2,7 @@ import os
|
|||||||
import sys
|
import sys
|
||||||
import traceback
|
import traceback
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
from time import time as ttime
|
from time import time as ttime
|
||||||
@ -341,5 +342,11 @@ class RVC:
|
|||||||
.float()
|
.float()
|
||||||
)
|
)
|
||||||
t5 = ttime()
|
t5 = ttime()
|
||||||
logger.info("Spent time: fea = %s, index = %s, f0 = %s, model = %s", t2 - t1, t3 - t2, t4 - t3, t5 - t4)
|
logger.info(
|
||||||
|
"Spent time: fea = %s, index = %s, f0 = %s, model = %s",
|
||||||
|
t2 - t1,
|
||||||
|
t3 - t2,
|
||||||
|
t4 - t3,
|
||||||
|
t5 - t4,
|
||||||
|
)
|
||||||
return infered_audio
|
return infered_audio
|
||||||
|
Loading…
Reference in New Issue
Block a user