mirror of
https://github.com/Mangio621/Mangio-RVC-Fork.git
synced 2026-02-24 03:49:51 +01:00
Resolved tons of conflicts with v2. Testing now
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
### 20230513更新
|
||||
功能更新:
|
||||
- 清除一键包内部老版本runtime内残留的infer_pack和uvr5_pack
|
||||
- 修复训练集预处理伪多进程的bug
|
||||
- 增加harvest识别音高可选通过中值滤波削弱哑音现象,可调整中值滤波半径
|
||||
@@ -7,13 +6,20 @@
|
||||
- 训练n_cpu进程数从"仅调整f0提取"改为"调整数据预处理和f0提取"
|
||||
- 自动检测logs文件夹下的index路径,提供下拉列表功能
|
||||
- tab页增加"常见问题解答"(也可参考github-rvc-wiki)
|
||||
- 相同路径的输入音频推理增加了音高缓存(用途:使用harvest音高提取,整个pipeline会经历漫长且重复的音高提取过程,如果不使用缓存,实验不同音色、索引、音高中值滤波半径参数的用户在第一次测试后的等待结果会非常痛苦)
|
||||
|
||||
### 20230514更新
|
||||
- 音量包络对齐输入混合(可以缓解“输入静音输出小幅度噪声”的问题。如果输入音频背景底噪大则不建议开启,默认不开启(值为1可视为不开启))
|
||||
- 支持按照指定频率保存提取的小模型(假如你想尝试不同epoch下的推理效果,但是不想保存所有大checkpoint并且每次都要ckpt手工处理提取小模型,这项功能会非常实用)
|
||||
- 通过设置环境变量解决服务端开了系统全局代理导致浏览器连接错误的问题
|
||||
- 支持v2预训练模型(目前只公开了40k版本进行测试,另外2个采样率还没有训练完全)
|
||||
- 推理前限制超过1的过大音量
|
||||
- 微调数据预处理参数
|
||||
|
||||
待完成:
|
||||
- 推理音量预处理归一化
|
||||
- 推理后处理音量包络融合输入音频的音量包络
|
||||
- 增加选项:每次epoch保存的小模型均进行提取
|
||||
- 增加crepe音高提取支持
|
||||
|
||||
RVC很快会陆续更新v2版的新底模(先发40k采样率的,32k和48k的仍在训练中)!大幅改善呼吸、清辅音(唇齿音)的电音和撕裂伪影,请期待!
|
||||
|
||||
### 20230409更新
|
||||
- 修正训练参数,提升显卡平均利用率,A100最高从25%提升至90%左右,V100:50%->90%左右,2060S:60%->85%左右,P40:25%->95%左右,训练速度显著提升
|
||||
|
||||
@@ -1,3 +1,29 @@
|
||||
### 2023-05-13
|
||||
- Clear the redundant codes in the old version of runtime in the one-click-package: infer_pack and uvr5_pack
|
||||
- Fix pseudo multiprocessing bug in training set preprocessing
|
||||
- Adding median filtering radius adjustment for harvest pitch recognize algorithm
|
||||
- Support post processing resampling for exporting audio
|
||||
- Multi processing "n_cpu" setting for training is changed from "f0 extraction" to "data preprocessing and f0 extraction"
|
||||
- Automatically detect the index paths under the logs folder and provide a drop-down list function
|
||||
- Add "Frequently Asked Questions and Answers" on the tab page (you can also refer to github RVC wiki)
|
||||
- When inference, harvest pitch is cached when using same input audio path (purpose: using harvest pitch extraction, the entire pipeline will go through a long and repetitive pitch extraction process. If caching is not used, users who experiment with different timbre, index, and pitch median filtering radius settings will experience a very painful waiting process after the first inference)
|
||||
|
||||
### 2023-05-14
|
||||
- Use volume envelope of input to mix or replace the volume envelope of output (can alleviate the problem of "input muting and output small amplitude noise". If the input audio background noise is high, it is not recommended to turn it on, and it is not turned on by default (1 can be considered as not turned on)
|
||||
- Support saving extracted small models at a specified frequency (if you want to see the performance under different epochs, but do not want to save all large checkpoints and manually extract small models by ckpt-processing every time, this feature will be very practical)
|
||||
- Resolve the issue of "connection errors" caused by the server's global proxy by setting environment variables
|
||||
- Supports pre-trained v2 models (currently only 40k versions are publicly available for testing, and the other two sampling rates have not been fully trained yet)
|
||||
- Limit excessive volume exceeding 1 before inference
|
||||
- Slightly adjusted the settings of training-set preprocessing
|
||||
|
||||
Todolist:
|
||||
- Support crepe pitch detect
|
||||
- Support users to manually select export format of output audios when batch voice conversion processing
|
||||
|
||||
#######################
|
||||
|
||||
History changelogs:
|
||||
|
||||
### 2023-04-09
|
||||
- Fixed training parameters to improve GPU utilization rate: A100 increased from 25% to around 90%, V100: 50% to around 90%, 2060S: 60% to around 85%, P40: 25% to around 95%; significantly improved training speed
|
||||
- Changed parameter: total batch_size is now per GPU batch_size
|
||||
|
||||
11
README.md
11
README.md
@@ -116,8 +116,15 @@ hubert_base.pt
|
||||
|
||||
./uvr5_weights
|
||||
|
||||
#If you are using Windows, you may also need this dictionary, skip if FFmpeg is installed
|
||||
ffmpeg.exe
|
||||
|
||||
If you want to test the v2 version model (the v2 version model changes the feature from the 256-dimensional input of 9-layer hubert+final_proj to the 768-dimensional input of 12-layer hubert, and adds 3 cycle discriminators), an additional download is required
|
||||
|
||||
./pretrained_v2
|
||||
|
||||
#If you are using Windows, you may need this file, skip if ffmpeg and ffprobe are installed; ubuntu/debian users can install these two libraries through apt install ffmpeg
|
||||
./ffmpeg
|
||||
|
||||
./ffprobe
|
||||
```
|
||||
# Running the Web GUI to Infer & Train 💪
|
||||
|
||||
|
||||
@@ -75,6 +75,10 @@ hubert_base.pt
|
||||
|
||||
./uvr5_weights
|
||||
|
||||
If you want to test the v2 version model (the v2 version model has changed the input from the 256 dimensional feature of 9-layer Hubert+final_proj to the 768 dimensional feature of 12-layer Hubert, and has added 3 period discriminators), you will need to download additional features
|
||||
|
||||
./pretrained_v2
|
||||
|
||||
#If you are using Windows, you may also need this dictionary, skip if FFmpeg is installed
|
||||
ffmpeg.exe
|
||||
```
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
import os, traceback, sys, parselmouth
|
||||
import librosa
|
||||
|
||||
now_dir = os.getcwd()
|
||||
sys.path.append(now_dir)
|
||||
from my_utils import load_audio
|
||||
import pyworld
|
||||
from scipy.io import wavfile
|
||||
import numpy as np, logging
|
||||
@@ -39,22 +42,17 @@ class FeatureInput(object):
|
||||
self.f0_mel_max = 1127 * np.log(1 + self.f0_max / 700)
|
||||
|
||||
def compute_f0(self, path, f0_method, crepe_hop_length):
|
||||
# default resample type of librosa.resample is "soxr_hq".
|
||||
# Quality: soxr_vhq > soxr_hq
|
||||
x, sr = librosa.load(path, self.fs) # , res_type='soxr_vhq'
|
||||
x = load_audio(path, self.fs)
|
||||
p_len = x.shape[0] // self.hop
|
||||
f0_min = 50
|
||||
f0_max = 1100
|
||||
assert sr == self.fs
|
||||
if f0_method == "pm":
|
||||
time_step = 160 / 16000 * 1000
|
||||
f0 = (
|
||||
parselmouth.Sound(x, sr)
|
||||
parselmouth.Sound(x, self.fs)
|
||||
.to_pitch_ac(
|
||||
time_step=time_step / 1000,
|
||||
voicing_threshold=0.6,
|
||||
pitch_floor=f0_min,
|
||||
pitch_ceiling=f0_max,
|
||||
pitch_floor=self.f0_min,
|
||||
pitch_ceiling=self.f0_max,
|
||||
)
|
||||
.selected_array["frequency"]
|
||||
)
|
||||
@@ -66,19 +64,19 @@ class FeatureInput(object):
|
||||
elif f0_method == "harvest":
|
||||
f0, t = pyworld.harvest(
|
||||
x.astype(np.double),
|
||||
fs=sr,
|
||||
fs=self.fs,
|
||||
f0_ceil=self.f0_max,
|
||||
f0_floor=self.f0_min,
|
||||
frame_period=1000 * self.hop / sr,
|
||||
frame_period=1000 * self.hop / self.fs,
|
||||
)
|
||||
f0 = pyworld.stonemask(x.astype(np.double), f0, t, self.fs)
|
||||
elif f0_method == "dio":
|
||||
f0, t = pyworld.dio(
|
||||
x.astype(np.double),
|
||||
fs=sr,
|
||||
fs=self.fs,
|
||||
f0_ceil=self.f0_max,
|
||||
f0_floor=self.f0_min,
|
||||
frame_period=1000 * self.hop / sr,
|
||||
frame_period=1000 * self.hop / self.fs,
|
||||
)
|
||||
f0 = pyworld.stonemask(x.astype(np.double), f0, t, self.fs)
|
||||
elif f0_method == "crepe": # Fork Feature: Added crepe f0 for f0 feature extraction
|
||||
@@ -106,10 +104,10 @@ class FeatureInput(object):
|
||||
# Pitch prediction for pitch extraction
|
||||
pitch: Tensor = torchcrepe.predict(
|
||||
audio,
|
||||
sr,
|
||||
self.fs,
|
||||
crepe_hop_length,
|
||||
f0_min,
|
||||
f0_max,
|
||||
self.f0_min,
|
||||
self.f0_max,
|
||||
"full",
|
||||
batch_size=crepe_hop_length * 2,
|
||||
device=torch_device,
|
||||
|
||||
@@ -9,7 +9,7 @@ else:
|
||||
i_gpu = sys.argv[4]
|
||||
exp_dir = sys.argv[5]
|
||||
os.environ["CUDA_VISIBLE_DEVICES"] = str(i_gpu)
|
||||
|
||||
version = sys.argv[6]
|
||||
import torch
|
||||
import torch.nn.functional as F
|
||||
import soundfile as sf
|
||||
@@ -39,7 +39,9 @@ model_path = "hubert_base.pt"
|
||||
|
||||
printt(exp_dir)
|
||||
wavPath = "%s/1_16k_wavs" % exp_dir
|
||||
outPath = "%s/3_feature256" % exp_dir
|
||||
outPath = (
|
||||
"%s/3_feature256" % exp_dir if version == "v1" else "%s/3_feature768" % exp_dir
|
||||
)
|
||||
os.makedirs(outPath, exist_ok=True)
|
||||
|
||||
|
||||
@@ -93,11 +95,13 @@ else:
|
||||
if device not in ["mps", "cpu"]
|
||||
else feats.to(device),
|
||||
"padding_mask": padding_mask.to(device),
|
||||
"output_layer": 9, # layer 9
|
||||
"output_layer": 9 if version == "v1" else 12, # layer 9
|
||||
}
|
||||
with torch.no_grad():
|
||||
logits = model.extract_features(**inputs)
|
||||
feats = model.final_proj(logits[0])
|
||||
feats = (
|
||||
model.final_proj(logits[0]) if version == "v1" else logits[0]
|
||||
)
|
||||
|
||||
feats = feats.squeeze(0).float().cpu().numpy()
|
||||
if np.isnan(feats).sum() == 0:
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
"本软件以MIT协议开源, 作者不对软件具备任何控制力, 使用软件者、传播软件导出的声音者自负全责. <br>如不认可该条款, 则不能使用或引用软件包内任何代码和文件. 详见根目录<b>使用需遵守的协议-LICENSE.txt</b>.": "This software is open source under the MIT license, the author does not have any control over the software, and those who use the software and spread the sounds exported by the software are solely responsible. <br>If you do not agree with this clause, you cannot use or quote any codes and files in the software package. See root directory <b>Agreement-LICENSE.txt</b> for details.",
|
||||
"模型推理": "Model inference",
|
||||
"推理音色": "Inferencing timbre",
|
||||
"刷新音色列表": "Refresh timbre list",
|
||||
"刷新音色列表和索引路径": "Refresh timbre list and index path",
|
||||
"卸载音色省显存": "Unload timbre to save GPU memory",
|
||||
"请选择说话人id": "Please select a speaker id",
|
||||
@@ -21,11 +20,13 @@
|
||||
"crepe_hop_length": "Crepe Hop Length (Only applies to crepe): Hop length refers to the time it takes for the speaker to jump to a dramatic pitch. Lower hop lengths take more time to infer but are more pitch accurate.",
|
||||
"特征检索库文件路径": "Feature search database file path",
|
||||
"特征文件路径": "Feature file path",
|
||||
">=3则使用对harvest音高识别的结果使用中值滤波,数值为滤波半径,使用可以削弱哑音": ">=3:using median filter for f0. The number is median filter radius.",
|
||||
"特征检索库文件路径,为空则使用下拉的选择结果": "Feature file path. If null, use dropdown result.",
|
||||
"自动检测index路径,下拉式选择(dropdown)": "Auto detect index path in logs directory. Dropdown.",
|
||||
"检索特征占比": "Search feature ratio",
|
||||
"后处理重采样至最终采样率,0为不进行重采样": "Post resample the audio to the final sample rate. Default: don't use post resample.",
|
||||
"输入源音量包络替换输出音量包络融合比例,越靠近1越使用输出包络": "Use volume envelope of input to mix or replace the volume envelope of output, the closer the rate is to 1, the more output envelope is used. Default 1 (don't mix input envelope)",
|
||||
"F0曲线文件, 可选, 一行一个音高, 代替默认F0及升降调": "F0 curve file, optional, one pitch per line, instead of the default F0 and ups and downs",
|
||||
">=3则使用对harvest音高识别的结果使用中值滤波,数值为滤波半径,使用可以削弱哑音": ">=3:using median filter for f0. The number is median filter radius.",
|
||||
"转换": "Convert",
|
||||
"输出信息": "Export message",
|
||||
"输出音频(右下角三个点,点了可以下载)": "Export audio (three dots in the lower right corner, click to download)",
|
||||
@@ -44,6 +45,8 @@
|
||||
"输入实验名": "Input experiment name",
|
||||
"目标采样率": "Target sample rate",
|
||||
"模型是否带音高指导(唱歌一定要, 语音可以不要)": "Does the model have pitch guidance (singing must, voice can not.)",
|
||||
"版本(目前仅40k支持了v2)": "model architecture version (Now v2 version only supports 40k sample rate for testing)",
|
||||
"提取音高和处理数据使用的CPU进程数": "Number of CPU threads to use for pitch extraction and dataset processing",
|
||||
"step2a: 自动遍历训练文件夹下所有可解码成音频的文件并进行切片归一化, 在实验目录下生成2个wav文件夹; 暂时只支持单人训练. ": "step2a: Automatically traverse all files that can be decoded into audio in the training folder and perform slice normalization, and generate 2 wav folders in the experiment directory; only single-person training is supported for the time being. ",
|
||||
"输入训练文件夹路径": "Input training folder path",
|
||||
"请指定说话人id": "Please specify speaker ID",
|
||||
@@ -51,8 +54,6 @@
|
||||
"step2b: 使用CPU提取音高(如果模型带音高), 使用GPU提取特征(选择卡号)": "step2b: Use CPU to extract pitch (if the model has pitch), use GPU to extract features (select card number)",
|
||||
"以-分隔输入使用的卡号, 例如 0-1-2 使用卡0和卡1和卡2": "Enter the card numbers used separated by -, for example 0-1-2 use card 0 and card 1 and card 2",
|
||||
"显卡信息": "GPU information",
|
||||
"提取音高使用的CPU进程数": "Number of CPU threads to use for pitch extraction",
|
||||
"提取音高和处理数据使用的CPU进程数": "Number of CPU threads to use for pitch extraction and dataset processing",
|
||||
"选择音高提取算法:输入歌声可用pm提速,高质量语音但CPU差可用dio提速,harvest质量更好但慢": "Select pitch extraction algorithm: Use 'pm' for faster processing of singing voice, 'dio' for high-quality speech but slower processing, and 'harvest' for the best quality but slowest processing.",
|
||||
"特征提取": "Feature extraction",
|
||||
"step3: 填写训练设置, 开始训练模型和索引": "step3: Fill in the training settings, start training the model and index",
|
||||
@@ -62,6 +63,7 @@
|
||||
"是否仅保存最新的ckpt文件以节省硬盘空间": "Whether to save only the latest ckpt file to save disk space",
|
||||
"否": "no",
|
||||
"是否缓存所有训练集至显存. 10min以下小数据可缓存以加速训练, 大数据缓存会炸显存也加不了多少速": "Whether to cache all training sets to video memory. Small data under 10 minutes can be cached to speed up training, and large data cache will blow up video memory and not increase the speed much",
|
||||
"是否在每次保存时间点将最终小模型保存至weights文件夹": "Save extracted small model to weights dir when every 'save frequency'",
|
||||
"加载预训练底模G路径": "Load pre-trained base model G path.",
|
||||
"加载预训练底模D路径": "Load pre-trained base model D path.",
|
||||
"训练模型": "Train model.",
|
||||
@@ -75,6 +77,7 @@
|
||||
"模型是否带音高指导": "Whether the model has pitch guidance.",
|
||||
"要置入的模型信息": "Model information to be placed.",
|
||||
"保存的模型名不带后缀": "Saved model name without extension.",
|
||||
"模型版本型号": "model architecture version",
|
||||
"融合": "Fusion.",
|
||||
"修改模型信息(仅支持weights文件夹下提取的小模型文件)": "Modify model information (only small model files extracted from the weights folder are supported)",
|
||||
"模型路径": "Model path",
|
||||
@@ -92,6 +95,7 @@
|
||||
"Onnx输出路径": "Onnx Export Path",
|
||||
"MoeVS模型": "MoeVS Model",
|
||||
"导出Onnx模型": "Export Onnx Model",
|
||||
"常见问题解答": "FAQ (Frequently Asked Questions)",
|
||||
"招募音高曲线前端编辑器": "Recruit front-end editors for pitch curves",
|
||||
"加开发群联系我xxxxx": "Add development group to contact me xxxxx",
|
||||
"点击查看交流、问题反馈群号": "Click to view the communication and problem feedback group number",
|
||||
@@ -116,7 +120,5 @@
|
||||
"性能设置": "performance settings",
|
||||
"开始音频转换": "start audio conversion",
|
||||
"停止音频转换": "stop audio conversion",
|
||||
"常见问题解答": "FAQ (Frequently Asked Questions)",
|
||||
"后处理重采样至最终采样率,0为不进行重采样": "Post resample the audio to the final sample rate. Default: don't use post resample.",
|
||||
"推理时间(ms):": "Infer Time(ms):"
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
"本软件以MIT协议开源, 作者不对软件具备任何控制力, 使用软件者、传播软件导出的声音者自负全责. <br>如不认可该条款, 则不能使用或引用软件包内任何代码和文件. 详见根目录<b>使用需遵守的协议-LICENSE.txt</b>.": "Este software es de código abierto bajo la licencia MIT, el autor no tiene ningún control sobre el software, y aquellos que usan el software y difunden los sonidos exportados por el software son los únicos responsables.<br>Si no está de acuerdo con esta cláusula , no puede utilizar ni citar ningún código ni archivo del paquete de software Consulte el directorio raíz <b>Agreement-LICENSE.txt</b> para obtener más información.",
|
||||
"模型推理": "inferencia del modelo",
|
||||
"推理音色": "inferencia de voz",
|
||||
"刷新音色列表": "Actualizar lista de voces",
|
||||
"刷新音色列表和索引路径": "刷新音色列表和索引路径",
|
||||
"卸载音色省显存": "Descargue la voz para ahorrar memoria GPU",
|
||||
"请选择说话人id": "seleccione una identificación de altavoz",
|
||||
"男转女推荐+12key, 女转男推荐-12key, 如果音域爆炸导致音色失真也可以自己调整到合适音域. ": "Tecla +12 recomendada para conversión de voz de hombre a mujer, tecla -12 para conversión de voz de mujer a hombre. Si el rango de tono es demasiado amplio y causa distorsión, ajústelo usted mismo a un rango adecuado.",
|
||||
@@ -19,8 +19,13 @@
|
||||
"选择音高提取算法,输入歌声可用pm提速,harvest低音好但巨慢无比": "Seleccione el algoritmo para la extracción de tono. Use 'pm' para acelerar las voces cantadas, o use 'harvest' para mejorar las voces bajas, pero es extremadamente lento.",
|
||||
"crepe_hop_length": "Crepe Hop Length (Only applies to crepe): Hop length refers to the time it takes for the speaker to jump to a dramatic pitch. Lower hop lengths take more time to infer but are more pitch accurate.",
|
||||
"特征检索库文件路径": "Ruta del archivo de la base de datos de búsqueda de características",
|
||||
">=3则使用对harvest音高识别的结果使用中值滤波,数值为滤波半径,使用可以削弱哑音": ">=3则使用对harvest音高识别的结果使用中值滤波,数值为滤波半径,使用可以削弱哑音",
|
||||
"特征检索库文件路径,为空则使用下拉的选择结果": "特征检索库文件路径,为空则使用下拉的选择结果",
|
||||
"自动检测index路径,下拉式选择(dropdown)": "自动检测index路径,下拉式选择(dropdown)",
|
||||
"特征文件路径": "Ruta del archivo de características",
|
||||
"检索特征占比": "Proporción de función de búsqueda",
|
||||
"后处理重采样至最终采样率,0为不进行重采样": "后处理重采样至最终采样率,0为不进行重采样",
|
||||
"输入源音量包络替换输出音量包络融合比例,越靠近1越使用输出包络": "输入源音量包络替换输出音量包络融合比例,越靠近1越使用输出包络",
|
||||
"F0曲线文件, 可选, 一行一个音高, 代替默认F0及升降调": "Archivo de curva F0, opcional, un tono por línea, en lugar de F0 predeterminado y cambio de tono",
|
||||
"转换": "Conversión",
|
||||
"输出信息": "Información de salida",
|
||||
@@ -40,6 +45,8 @@
|
||||
"输入实验名": "Ingrese el nombre del modelo",
|
||||
"目标采样率": "Tasa de muestreo objetivo",
|
||||
"模型是否带音高指导(唱歌一定要, 语音可以不要)": "Si el modelo tiene guía de tono (necesaria para cantar, pero no para hablar)",
|
||||
"版本(目前仅40k支持了v2)": "版本(目前仅40k支持了v2)",
|
||||
"提取音高和处理数据使用的CPU进程数": "提取音高和处理数据使用的CPU进程数",
|
||||
"step2a: 自动遍历训练文件夹下所有可解码成音频的文件并进行切片归一化, 在实验目录下生成2个wav文件夹; 暂时只支持单人训练. ": "paso 2a: recorra automáticamente la carpeta de capacitación y corte y normalice todos los archivos de audio que se pueden decodificar en audio. Se generarán dos carpetas 'wav' en el directorio del experimento. Actualmente, solo se admite la capacitación de una sola persona.",
|
||||
"输入训练文件夹路径": "Introduzca la ruta de la carpeta de entrenamiento",
|
||||
"请指定说话人id": "Especifique el ID del hablante",
|
||||
@@ -47,7 +54,6 @@
|
||||
"step2b: 使用CPU提取音高(如果模型带音高), 使用GPU提取特征(选择卡号)": "paso 2b: use la CPU para extraer el tono (si el modelo tiene guía de tono) y la GPU para extraer características (seleccione el número de tarjeta).",
|
||||
"以-分隔输入使用的卡号, 例如 0-1-2 使用卡0和卡1和卡2": "Separe los números de identificación de la GPU con '-' al ingresarlos. Por ejemplo, '0-1-2' significa usar GPU 0, GPU 1 y GPU 2.",
|
||||
"显卡信息": "información de la GPU",
|
||||
"提取音高使用的CPU进程数": "Número de subprocesos de CPU que se utilizarán para la extracción de tono",
|
||||
"选择音高提取算法:输入歌声可用pm提速,高质量语音但CPU差可用dio提速,harvest质量更好但慢": "Seleccione el algoritmo de extracción de tono: utilice 'pm' para un procesamiento más rápido de la voz cantada, 'dio' para un discurso de alta calidad pero un procesamiento más lento y 'cosecha' para obtener la mejor calidad pero un procesamiento más lento.",
|
||||
"特征提取": "Extracción de características",
|
||||
"step3: 填写训练设置, 开始训练模型和索引": "Paso 3: complete la configuración de entrenamiento y comience a entrenar el modelo y el índice.",
|
||||
@@ -57,6 +63,7 @@
|
||||
"是否仅保存最新的ckpt文件以节省硬盘空间": "Si guardar solo el archivo ckpt más reciente para ahorrar espacio en disco",
|
||||
"否": "否",
|
||||
"是否缓存所有训练集至显存. 10min以下小数据可缓存以加速训练, 大数据缓存会炸显存也加不了多少速": "Si almacenar en caché todos los conjuntos de entrenamiento en la memoria de la GPU. Los conjuntos de datos pequeños (menos de 10 minutos) se pueden almacenar en caché para acelerar el entrenamiento, pero el almacenamiento en caché de conjuntos de datos grandes puede causar errores de memoria en la GPU y no aumenta la velocidad de manera significativa.",
|
||||
"是否在每次保存时间点将最终小模型保存至weights文件夹": "是否在每次保存时间点将最终小模型保存至weights文件夹",
|
||||
"加载预训练底模G路径": "Cargue la ruta G del modelo base preentrenada.",
|
||||
"加载预训练底模D路径": "Cargue la ruta del modelo D base preentrenada.",
|
||||
"训练模型": "Entrenar Modelo",
|
||||
@@ -70,6 +77,7 @@
|
||||
"模型是否带音高指导": "Si el modelo tiene guía de tono.",
|
||||
"要置入的模型信息": "Información del modelo a colocar.",
|
||||
"保存的模型名不带后缀": "Nombre del modelo guardado sin extensión.",
|
||||
"模型版本型号": "模型版本型号",
|
||||
"融合": "Fusión.",
|
||||
"修改模型信息(仅支持weights文件夹下提取的小模型文件)": "Modificar la información del modelo (solo admite archivos de modelos pequeños extraídos en la carpeta de pesos).",
|
||||
"模型路径": "Ruta del modelo",
|
||||
@@ -87,6 +95,7 @@
|
||||
"Onnx输出路径": "Onnx输出路径",
|
||||
"MoeVS模型": "MoeVS模型",
|
||||
"导出Onnx模型": "导出Onnx模型",
|
||||
"常见问题解答": "常见问题解答",
|
||||
"招募音高曲线前端编辑器": "Reclutar editores front-end para curvas de tono",
|
||||
"加开发群联系我xxxxx": "Únase al grupo de desarrollo para contactarme en xxxxx",
|
||||
"点击查看交流、问题反馈群号": "Haga clic para ver el número de grupo de comunicación y comentarios sobre problemas",
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
"本软件以MIT协议开源, 作者不对软件具备任何控制力, 使用软件者、传播软件导出的声音者自负全责. <br>如不认可该条款, 则不能使用或引用软件包内任何代码和文件. 详见根目录<b>使用需遵守的协议-LICENSE.txt</b>.": "本软件以MIT协议开源, 作者不对软件具备任何控制力, 使用软件者、传播软件导出的声音者自负全责. <br>如不认可该条款, 则不能使用或引用软件包内任何代码和文件. 详见根目录<b>使用需遵守的协议-LICENSE.txt</b>.",
|
||||
"模型推理": "モデル推論",
|
||||
"推理音色": "音源推論",
|
||||
"刷新音色列表": "音源リストを更新",
|
||||
"刷新音色列表和索引路径": "刷新音色列表和索引路径",
|
||||
"卸载音色省显存": "音源を削除してメモリを節約",
|
||||
"请选择说话人id": "話者IDを選択してください",
|
||||
"男转女推荐+12key, 女转男推荐-12key, 如果音域爆炸导致音色失真也可以自己调整到合适音域. ": "男性から女性へは+12キーをお勧めします。女性から男性へは-12キーをお勧めします。音域が広すぎて音質が劣化した場合は、適切な音域に自分で調整することもできます。",
|
||||
@@ -19,8 +19,13 @@
|
||||
"选择音高提取算法,输入歌声可用pm提速,harvest低音好但巨慢无比": "ピッチ抽出アルゴリズムを選択してください。歌声の場合は、pmを使用して速度を上げることができます。低音が重要な場合は、harvestを使用できますが、非常に遅くなります。",
|
||||
"crepe_hop_length": "Crepe Hop Length (Only applies to crepe): Hop length refers to the time it takes for the speaker to jump to a dramatic pitch. Lower hop lengths take more time to infer but are more pitch accurate.",
|
||||
"特征检索库文件路径": "特徴量検索データベースのファイルパス",
|
||||
">=3则使用对harvest音高识别的结果使用中值滤波,数值为滤波半径,使用可以削弱哑音": ">=3则使用对harvest音高识别的结果使用中值滤波,数值为滤波半径,使用可以削弱哑音",
|
||||
"特征检索库文件路径,为空则使用下拉的选择结果": "特征检索库文件路径,为空则使用下拉的选择结果",
|
||||
"自动检测index路径,下拉式选择(dropdown)": "自动检测index路径,下拉式选择(dropdown)",
|
||||
"特征文件路径": "特徴量ファイルのパス",
|
||||
"检索特征占比": "検索特徴率",
|
||||
"后处理重采样至最终采样率,0为不进行重采样": "后处理重采样至最终采样率,0为不进行重采样",
|
||||
"输入源音量包络替换输出音量包络融合比例,越靠近1越使用输出包络": "输入源音量包络替换输出音量包络融合比例,越靠近1越使用输出包络",
|
||||
"F0曲线文件, 可选, 一行一个音高, 代替默认F0及升降调": "F0(最低共振周波数)カーブファイル(オプション、1行に1ピッチ、デフォルトのF0(最低共振周波数)とエレベーションを置き換えます。)",
|
||||
"转换": "変換",
|
||||
"输出信息": "出力情報",
|
||||
@@ -40,6 +45,8 @@
|
||||
"输入实验名": "実験名を入力してください",
|
||||
"目标采样率": "目標サンプリングレート",
|
||||
"模型是否带音高指导(唱歌一定要, 语音可以不要)": "モデルに音高ガイドがあるかどうか(歌唱には必要ですが、音声には必要ありません)",
|
||||
"版本(目前仅40k支持了v2)": "版本(目前仅40k支持了v2)",
|
||||
"提取音高和处理数据使用的CPU进程数": "提取音高和处理数据使用的CPU进程数",
|
||||
"step2a: 自动遍历训练文件夹下所有可解码成音频的文件并进行切片归一化, 在实验目录下生成2个wav文件夹; 暂时只支持单人训练. ": "ステップ2a: 訓練フォルダー内のすべての音声ファイルを自動的に探索し、スライスと正規化を行い、2つのwavフォルダーを実験ディレクトリに生成します。現在は一人でのトレーニングのみをサポートしています。",
|
||||
"输入训练文件夹路径": "トレーニング用フォルダのパスを入力してください",
|
||||
"请指定说话人id": "話者IDを指定してください",
|
||||
@@ -47,7 +54,6 @@
|
||||
"step2b: 使用CPU提取音高(如果模型带音高), 使用GPU提取特征(选择卡号)": "ステップ2b: CPUを使用して音高を抽出する(モデルに音高がある場合)、GPUを使用して特徴を抽出する(カード番号を選択する)",
|
||||
"以-分隔输入使用的卡号, 例如 0-1-2 使用卡0和卡1和卡2": "ハイフンで区切って使用するカード番号を入力します。例えば0-1-2はカード0、カード1、カード2を使用します",
|
||||
"显卡信息": "カード情報",
|
||||
"提取音高使用的CPU进程数": "抽出に使用するCPUプロセス数",
|
||||
"选择音高提取算法:输入歌声可用pm提速,高质量语音但CPU差可用dio提速,harvest质量更好但慢": "音高抽出アルゴリズムの選択:歌声を入力する場合は、pmを使用して速度を上げることができます。CPUが低い場合はdioを使用して速度を上げることができます。harvestは品質が高く、精度が高いですが、遅いです。",
|
||||
"特征提取": "特徴抽出",
|
||||
"step3: 填写训练设置, 开始训练模型和索引": "ステップ3: トレーニング設定を入力して、モデルとインデックスのトレーニングを開始します",
|
||||
@@ -57,6 +63,7 @@
|
||||
"是否仅保存最新的ckpt文件以节省硬盘空间": "ハードディスク容量を節約するため、最新のckptファイルのみを保存するかどうか",
|
||||
"否": "否",
|
||||
"是否缓存所有训练集至显存. 10min以下小数据可缓存以加速训练, 大数据缓存会炸显存也加不了多少速": "すべてのトレーニングデータをメモリにキャッシュするかどうか。10分以下の小さなデータはキャッシュしてトレーニングを高速化できますが、大きなデータをキャッシュするとメモリが破裂し、あまり速度が上がりません。",
|
||||
"是否在每次保存时间点将最终小模型保存至weights文件夹": "是否在每次保存时间点将最终小模型保存至weights文件夹",
|
||||
"加载预训练底模G路径": "事前学習済みのGモデルのパスをロードしてください",
|
||||
"加载预训练底模D路径": "事前学習済みのDモデルのパスをロードしてください",
|
||||
"训练模型": "モデルのトレーニング",
|
||||
@@ -70,6 +77,7 @@
|
||||
"模型是否带音高指导": "モデルに音高ガイドを付けるかどうか",
|
||||
"要置入的模型信息": "挿入するモデル情報",
|
||||
"保存的模型名不带后缀": "拡張子のない保存するモデル名",
|
||||
"模型版本型号": "模型版本型号",
|
||||
"融合": "フュージョン",
|
||||
"修改模型信息(仅支持weights文件夹下提取的小模型文件)": "モデル情報の修正(weightsフォルダから抽出された小さなモデルファイルのみ対応)",
|
||||
"模型路径": "モデルパス",
|
||||
@@ -87,6 +95,7 @@
|
||||
"Onnx输出路径": "Onnx出力パス",
|
||||
"MoeVS模型": "MoeSS?",
|
||||
"导出Onnx模型": "Onnxに変換",
|
||||
"常见问题解答": "常见问题解答",
|
||||
"招募音高曲线前端编辑器": "音高曲線フロントエンドエディターを募集",
|
||||
"加开发群联系我xxxxx": "開発グループに参加して私に連絡してくださいxxxxx",
|
||||
"点击查看交流、问题反馈群号": "クリックして交流、問題フィードバックグループ番号を表示",
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
"本软件以MIT协议开源, 作者不对软件具备任何控制力, 使用软件者、传播软件导出的声音者自负全责. <br>如不认可该条款, 则不能使用或引用软件包内任何代码和文件. 详见根目录<b>使用需遵守的协议-LICENSE.txt</b>.": "本软件以MIT协议开源, 作者不对软件具备任何控制力, 使用软件者、传播软件导出的声音者自负全责. <br>如不认可该条款, 则不能使用或引用软件包内任何代码和文件. 详见根目录<b>使用需遵守的协议-LICENSE.txt</b>.",
|
||||
"模型推理": "模型推理",
|
||||
"推理音色": "推理音色",
|
||||
"刷新音色列表": "刷新音色列表",
|
||||
"刷新音色列表和索引路径": "刷新音色列表和索引路径",
|
||||
"卸载音色省显存": "卸载音色省显存",
|
||||
"请选择说话人id": "请选择说话人id",
|
||||
"男转女推荐+12key, 女转男推荐-12key, 如果音域爆炸导致音色失真也可以自己调整到合适音域. ": "男转女推荐+12key, 女转男推荐-12key, 如果音域爆炸导致音色失真也可以自己调整到合适音域. ",
|
||||
@@ -21,8 +21,11 @@
|
||||
"特征检索库文件路径": "特征检索库文件路径",
|
||||
"特征检索库文件路径,为空则使用下拉的选择结果": "特征检索库文件路径,为空则使用下拉的选择结果",
|
||||
">=3则使用对harvest音高识别的结果使用中值滤波,数值为滤波半径,使用可以削弱哑音": ">=3则使用对harvest音高识别的结果使用中值滤波,数值为滤波半径,使用可以削弱哑音",
|
||||
"自动检测index路径,下拉式选择(dropdown)": "自动检测index路径,下拉式选择(dropdown)",
|
||||
"特征文件路径": "特征文件路径",
|
||||
"检索特征占比": "检索特征占比",
|
||||
"后处理重采样至最终采样率,0为不进行重采样": "后处理重采样至最终采样率,0为不进行重采样",
|
||||
"输入源音量包络替换输出音量包络融合比例,越靠近1越使用输出包络": "输入源音量包络替换输出音量包络融合比例,越靠近1越使用输出包络",
|
||||
"F0曲线文件, 可选, 一行一个音高, 代替默认F0及升降调": "F0曲线文件, 可选, 一行一个音高, 代替默认F0及升降调",
|
||||
"转换": "转换",
|
||||
"输出信息": "输出信息",
|
||||
@@ -42,6 +45,8 @@
|
||||
"输入实验名": "输入实验名",
|
||||
"目标采样率": "目标采样率",
|
||||
"模型是否带音高指导(唱歌一定要, 语音可以不要)": "模型是否带音高指导(唱歌一定要, 语音可以不要)",
|
||||
"版本(目前仅40k支持了v2)": "版本(目前仅40k支持了v2)",
|
||||
"提取音高和处理数据使用的CPU进程数": "提取音高和处理数据使用的CPU进程数",
|
||||
"step2a: 自动遍历训练文件夹下所有可解码成音频的文件并进行切片归一化, 在实验目录下生成2个wav文件夹; 暂时只支持单人训练. ": "step2a: 自动遍历训练文件夹下所有可解码成音频的文件并进行切片归一化, 在实验目录下生成2个wav文件夹; 暂时只支持单人训练. ",
|
||||
"输入训练文件夹路径": "输入训练文件夹路径",
|
||||
"请指定说话人id": "请指定说话人id",
|
||||
@@ -49,10 +54,6 @@
|
||||
"step2b: 使用CPU提取音高(如果模型带音高), 使用GPU提取特征(选择卡号)": "step2b: 使用CPU提取音高(如果模型带音高), 使用GPU提取特征(选择卡号)",
|
||||
"以-分隔输入使用的卡号, 例如 0-1-2 使用卡0和卡1和卡2": "以-分隔输入使用的卡号, 例如 0-1-2 使用卡0和卡1和卡2",
|
||||
"显卡信息": "显卡信息",
|
||||
"提取音高使用的CPU进程数": "提取音高使用的CPU进程数",
|
||||
"提取音高和处理数据使用的CPU进程数": "提取音高和处理数据使用的CPU进程数",
|
||||
"刷新音色列表和索引路径": "刷新音色列表和索引路径",
|
||||
"常见问题解答": "常见问题解答",
|
||||
"选择音高提取算法:输入歌声可用pm提速,高质量语音但CPU差可用dio提速,harvest质量更好但慢": "选择音高提取算法:输入歌声可用pm提速,高质量语音但CPU差可用dio提速,harvest质量更好但慢",
|
||||
"特征提取": "特征提取",
|
||||
"step3: 填写训练设置, 开始训练模型和索引": "step3: 填写训练设置, 开始训练模型和索引",
|
||||
@@ -62,6 +63,7 @@
|
||||
"是否仅保存最新的ckpt文件以节省硬盘空间": "是否仅保存最新的ckpt文件以节省硬盘空间",
|
||||
"否": "否",
|
||||
"是否缓存所有训练集至显存. 10min以下小数据可缓存以加速训练, 大数据缓存会炸显存也加不了多少速": "是否缓存所有训练集至显存. 10min以下小数据可缓存以加速训练, 大数据缓存会炸显存也加不了多少速",
|
||||
"是否在每次保存时间点将最终小模型保存至weights文件夹": "是否在每次保存时间点将最终小模型保存至weights文件夹",
|
||||
"加载预训练底模G路径": "加载预训练底模G路径",
|
||||
"加载预训练底模D路径": "加载预训练底模D路径",
|
||||
"训练模型": "训练模型",
|
||||
@@ -75,6 +77,7 @@
|
||||
"模型是否带音高指导": "模型是否带音高指导",
|
||||
"要置入的模型信息": "要置入的模型信息",
|
||||
"保存的模型名不带后缀": "保存的模型名不带后缀",
|
||||
"模型版本型号": "模型版本型号",
|
||||
"融合": "融合",
|
||||
"修改模型信息(仅支持weights文件夹下提取的小模型文件)": "修改模型信息(仅支持weights文件夹下提取的小模型文件)",
|
||||
"模型路径": "模型路径",
|
||||
@@ -92,6 +95,7 @@
|
||||
"Onnx输出路径": "Onnx输出路径",
|
||||
"MoeVS模型": "MoeVS模型",
|
||||
"导出Onnx模型": "导出Onnx模型",
|
||||
"常见问题解答": "常见问题解答",
|
||||
"招募音高曲线前端编辑器": "招募音高曲线前端编辑器",
|
||||
"加开发群联系我xxxxx": "加开发群联系我xxxxx",
|
||||
"点击查看交流、问题反馈群号": "点击查看交流、问题反馈群号",
|
||||
@@ -116,6 +120,5 @@
|
||||
"性能设置": "性能设置",
|
||||
"开始音频转换": "开始音频转换",
|
||||
"停止音频转换": "停止音频转换",
|
||||
"后处理重采样至最终采样率,0为不进行重采样": "后处理重采样至最终采样率,0为不进行重采样",
|
||||
"推理时间(ms):": "推理时间(ms):"
|
||||
}
|
||||
|
||||
@@ -10,8 +10,7 @@
|
||||
"本软件以MIT协议开源, 作者不对软件具备任何控制力, 使用软件者、传播软件导出的声音者自负全责. <br>如不认可该条款, 则不能使用或引用软件包内任何代码和文件. 详见根目录<b>使用需遵守的协议-LICENSE.txt</b>.": "本軟體以MIT協議開源,作者不對軟體具備任何控制力,使用軟體者、傳播軟體導出的聲音者自負全責。<br>如不認可該條款,則不能使用或引用軟體包內任何程式碼和檔案。詳見根目錄<b>使用需遵守的協議-LICENSE.txt</b>。",
|
||||
"模型推理": "模型推理",
|
||||
"推理音色": "推理音色",
|
||||
"刷新音色列表": "重新整理音色列表",
|
||||
"刷新音色列表和索引路径":"刷新音色列表和索引路徑",
|
||||
"刷新音色列表和索引路径": "刷新音色列表和索引路徑",
|
||||
"卸载音色省显存": "卸載音色節省 VRAM",
|
||||
"请选择说话人id": "請選擇說話人ID",
|
||||
"男转女推荐+12key, 女转男推荐-12key, 如果音域爆炸导致音色失真也可以自己调整到合适音域. ": "男性轉女性推薦+12key,女性轉男性推薦-12key,如果音域爆炸導致音色失真也可以自己調整到合適音域。",
|
||||
@@ -21,11 +20,13 @@
|
||||
"crepe_hop_length": "Crepe Hop Length (Only applies to crepe): Hop length refers to the time it takes for the speaker to jump to a dramatic pitch. Lower hop lengths take more time to infer but are more pitch accurate.",
|
||||
"特征检索库文件路径": "特徵檢索庫檔案路徑",
|
||||
"自动检测index路径,下拉式选择(dropdown)": "自動檢測index路徑,下拉式選擇(dropdown)",
|
||||
">=3则使用对harvest音高识别的结果使用中值滤波,数值为滤波半径,使用可以削弱哑音": ">=3則使用對harvest音高識別的結果使用中值濾波,數值為濾波半徑,使用可以削弱啞音",
|
||||
"特征检索库文件路径,为空则使用下拉的选择结果": "特徵檢索庫檔路徑,為空則使用下拉的選擇結果",
|
||||
"特征文件路径": "特徵檔案路徑",
|
||||
"检索特征占比": "檢索特徵佔比",
|
||||
"后处理重采样至最终采样率,0为不进行重采样": "後處理重採樣至最終採樣率,0為不進行重採樣",
|
||||
"输入源音量包络替换输出音量包络融合比例,越靠近1越使用输出包络": "輸入源音量包絡替換輸出音量包絡融合比例,越靠近1越使用輸出包絡",
|
||||
"F0曲线文件, 可选, 一行一个音高, 代替默认F0及升降调": "F0曲線檔案,可選,一行一個音高,代替預設的F0及升降調",
|
||||
">=3则使用对harvest音高识别的结果使用中值滤波,数值为滤波半径,使用可以削弱哑音":">=3則使用對harvest音高識別的結果使用中值濾波,數值為濾波半徑,使用可以削弱啞音",
|
||||
"转换": "轉換",
|
||||
"输出信息": "輸出訊息",
|
||||
"输出音频(右下角三个点,点了可以下载)": "輸出音頻(右下角三個點,點了可以下載)",
|
||||
@@ -44,6 +45,8 @@
|
||||
"输入实验名": "輸入實驗名稱",
|
||||
"目标采样率": "目標取樣率",
|
||||
"模型是否带音高指导(唱歌一定要, 语音可以不要)": "模型是否帶音高指導(唱歌一定要,語音可以不要)",
|
||||
"版本(目前仅40k支持了v2)": "版本(目前僅40k支持了v2)",
|
||||
"提取音高和处理数据使用的CPU进程数": "提取音高和處理數據使用的CPU進程數",
|
||||
"step2a: 自动遍历训练文件夹下所有可解码成音频的文件并进行切片归一化, 在实验目录下生成2个wav文件夹; 暂时只支持单人训练. ": "step2a:自動遍歷訓練資料夾下所有可解碼成音頻的檔案並進行切片歸一化,在實驗目錄下生成2個wav資料夾;暫時只支援單人訓練。",
|
||||
"输入训练文件夹路径": "輸入訓練檔案夾路徑",
|
||||
"请指定说话人id": "請指定說話人id",
|
||||
@@ -51,8 +54,6 @@
|
||||
"step2b: 使用CPU提取音高(如果模型带音高), 使用GPU提取特征(选择卡号)": "步驟2b: 使用CPU提取音高(如果模型帶音高), 使用GPU提取特徵(選擇卡號)",
|
||||
"以-分隔输入使用的卡号, 例如 0-1-2 使用卡0和卡1和卡2": "以-分隔輸入使用的卡號, 例如 0-1-2 使用卡0和卡1和卡2",
|
||||
"显卡信息": "顯示卡資訊",
|
||||
"提取音高使用的CPU进程数": "提取音高使用的CPU進程數",
|
||||
"提取音高和处理数据使用的CPU进程数": "提取音高和處理數據使用的CPU進程數",
|
||||
"选择音高提取算法:输入歌声可用pm提速,高质量语音但CPU差可用dio提速,harvest质量更好但慢": "選擇音高提取算法:輸入歌聲可用pm提速,高品質語音但CPU差可用dio提速,harvest品質更好但較慢",
|
||||
"特征提取": "特徵提取",
|
||||
"step3: 填写训练设置, 开始训练模型和索引": "步驟3: 填寫訓練設定, 開始訓練模型和索引",
|
||||
@@ -62,6 +63,7 @@
|
||||
"是否仅保存最新的ckpt文件以节省硬盘空间": "是否僅保存最新的ckpt檔案以節省硬碟空間",
|
||||
"否": "否",
|
||||
"是否缓存所有训练集至显存. 10min以下小数据可缓存以加速训练, 大数据缓存会炸显存也加不了多少速": "是否緩存所有訓練集至 VRAM。小於10分鐘的小數據可緩存以加速訓練,大數據緩存會爆 VRAM 也加不了多少速度",
|
||||
"是否在每次保存时间点将最终小模型保存至weights文件夹": "是否在每次保存時間點將最終小模型保存至weights檔夾",
|
||||
"加载预训练底模G路径": "加載預訓練底模G路徑",
|
||||
"加载预训练底模D路径": "加載預訓練底模D路徑",
|
||||
"训练模型": "訓練模型",
|
||||
@@ -75,6 +77,7 @@
|
||||
"模型是否带音高指导": "模型是否帶音高指導",
|
||||
"要置入的模型信息": "要置入的模型資訊",
|
||||
"保存的模型名不带后缀": "儲存的模型名不帶副檔名",
|
||||
"模型版本型号": "模型版本型號",
|
||||
"融合": "融合",
|
||||
"修改模型信息(仅支持weights文件夹下提取的小模型文件)": "修改模型資訊(僅支援weights資料夾下提取的小模型檔案)",
|
||||
"模型路径": "模型路徑",
|
||||
@@ -92,6 +95,7 @@
|
||||
"Onnx输出路径": "Onnx输出路径",
|
||||
"MoeVS模型": "MoeSS模型",
|
||||
"导出Onnx模型": "导出Onnx模型",
|
||||
"常见问题解答": "常見問題解答",
|
||||
"招募音高曲线前端编辑器": "招募音高曲線前端編輯器",
|
||||
"加开发群联系我xxxxx": "加開發群聯繫我xxxxx",
|
||||
"点击查看交流、问题反馈群号": "點擊查看交流、問題反饋群號",
|
||||
@@ -116,7 +120,5 @@
|
||||
"性能设置": "效能設定",
|
||||
"开始音频转换": "開始音訊轉換",
|
||||
"停止音频转换": "停止音訊轉換",
|
||||
"常见问题解答": "常見問題解答",
|
||||
"后处理重采样至最终采样率,0为不进行重采样": "後處理重採樣至最終採樣率,0為不進行重採樣",
|
||||
"推理时间(ms):": "推理時間(ms):"
|
||||
}
|
||||
|
||||
@@ -10,8 +10,7 @@
|
||||
"本软件以MIT协议开源, 作者不对软件具备任何控制力, 使用软件者、传播软件导出的声音者自负全责. <br>如不认可该条款, 则不能使用或引用软件包内任何代码和文件. 详见根目录<b>使用需遵守的协议-LICENSE.txt</b>.": "本軟體以MIT協議開源,作者不對軟體具備任何控制力,使用軟體者、傳播軟體導出的聲音者自負全責。<br>如不認可該條款,則不能使用或引用軟體包內任何程式碼和檔案。詳見根目錄<b>使用需遵守的協議-LICENSE.txt</b>。",
|
||||
"模型推理": "模型推理",
|
||||
"推理音色": "推理音色",
|
||||
"刷新音色列表": "重新整理音色列表",
|
||||
"刷新音色列表和索引路径":"刷新音色列表和索引路徑",
|
||||
"刷新音色列表和索引路径": "刷新音色列表和索引路徑",
|
||||
"卸载音色省显存": "卸載音色節省 VRAM",
|
||||
"请选择说话人id": "請選擇說話人ID",
|
||||
"男转女推荐+12key, 女转男推荐-12key, 如果音域爆炸导致音色失真也可以自己调整到合适音域. ": "男性轉女性推薦+12key,女性轉男性推薦-12key,如果音域爆炸導致音色失真也可以自己調整到合適音域。",
|
||||
@@ -21,11 +20,13 @@
|
||||
"crepe_hop_length": "Crepe Hop Length (Only applies to crepe): Hop length refers to the time it takes for the speaker to jump to a dramatic pitch. Lower hop lengths take more time to infer but are more pitch accurate.",
|
||||
"特征检索库文件路径": "特徵檢索庫檔案路徑",
|
||||
"特征文件路径": "特徵檔案路徑",
|
||||
"自动检测index路径,下拉式选择(dropdown)": "自動檢測index路徑,下拉式選擇(dropdown)",
|
||||
">=3则使用对harvest音高识别的结果使用中值滤波,数值为滤波半径,使用可以削弱哑音": ">=3則使用對harvest音高識別的結果使用中值濾波,數值為濾波半徑,使用可以削弱啞音",
|
||||
"特征检索库文件路径,为空则使用下拉的选择结果": "特徵檢索庫檔路徑,為空則使用下拉的選擇結果",
|
||||
"自动检测index路径,下拉式选择(dropdown)": "自動檢測index路徑,下拉式選擇(dropdown)",
|
||||
"检索特征占比": "檢索特徵佔比",
|
||||
"后处理重采样至最终采样率,0为不进行重采样": "後處理重採樣至最終採樣率,0為不進行重採樣",
|
||||
"输入源音量包络替换输出音量包络融合比例,越靠近1越使用输出包络": "輸入源音量包絡替換輸出音量包絡融合比例,越靠近1越使用輸出包絡",
|
||||
"F0曲线文件, 可选, 一行一个音高, 代替默认F0及升降调": "F0曲線檔案,可選,一行一個音高,代替預設的F0及升降調",
|
||||
">=3则使用对harvest音高识别的结果使用中值滤波,数值为滤波半径,使用可以削弱哑音":">=3則使用對harvest音高識別的結果使用中值濾波,數值為濾波半徑,使用可以削弱啞音",
|
||||
"转换": "轉換",
|
||||
"输出信息": "輸出訊息",
|
||||
"输出音频(右下角三个点,点了可以下载)": "輸出音頻(右下角三個點,點了可以下載)",
|
||||
@@ -44,6 +45,8 @@
|
||||
"输入实验名": "輸入實驗名稱",
|
||||
"目标采样率": "目標取樣率",
|
||||
"模型是否带音高指导(唱歌一定要, 语音可以不要)": "模型是否帶音高指導(唱歌一定要,語音可以不要)",
|
||||
"版本(目前仅40k支持了v2)": "版本(目前僅40k支持了v2)",
|
||||
"提取音高和处理数据使用的CPU进程数": "提取音高和處理數據使用的CPU進程數",
|
||||
"step2a: 自动遍历训练文件夹下所有可解码成音频的文件并进行切片归一化, 在实验目录下生成2个wav文件夹; 暂时只支持单人训练. ": "step2a:自動遍歷訓練資料夾下所有可解碼成音頻的檔案並進行切片歸一化,在實驗目錄下生成2個wav資料夾;暫時只支援單人訓練。",
|
||||
"输入训练文件夹路径": "輸入訓練檔案夾路徑",
|
||||
"请指定说话人id": "請指定說話人id",
|
||||
@@ -51,8 +54,6 @@
|
||||
"step2b: 使用CPU提取音高(如果模型带音高), 使用GPU提取特征(选择卡号)": "步驟2b: 使用CPU提取音高(如果模型帶音高), 使用GPU提取特徵(選擇卡號)",
|
||||
"以-分隔输入使用的卡号, 例如 0-1-2 使用卡0和卡1和卡2": "以-分隔輸入使用的卡號, 例如 0-1-2 使用卡0和卡1和卡2",
|
||||
"显卡信息": "顯示卡資訊",
|
||||
"提取音高使用的CPU进程数": "提取音高使用的CPU進程數",
|
||||
"提取音高和处理数据使用的CPU进程数": "提取音高和處理數據使用的CPU進程數",
|
||||
"选择音高提取算法:输入歌声可用pm提速,高质量语音但CPU差可用dio提速,harvest质量更好但慢": "選擇音高提取算法:輸入歌聲可用pm提速,高品質語音但CPU差可用dio提速,harvest品質更好但較慢",
|
||||
"特征提取": "特徵提取",
|
||||
"step3: 填写训练设置, 开始训练模型和索引": "步驟3: 填寫訓練設定, 開始訓練模型和索引",
|
||||
@@ -62,6 +63,7 @@
|
||||
"是否仅保存最新的ckpt文件以节省硬盘空间": "是否僅保存最新的ckpt檔案以節省硬碟空間",
|
||||
"否": "否",
|
||||
"是否缓存所有训练集至显存. 10min以下小数据可缓存以加速训练, 大数据缓存会炸显存也加不了多少速": "是否緩存所有訓練集至 VRAM。小於10分鐘的小數據可緩存以加速訓練,大數據緩存會爆 VRAM 也加不了多少速度",
|
||||
"是否在每次保存时间点将最终小模型保存至weights文件夹": "是否在每次保存時間點將最終小模型保存至weights檔夾",
|
||||
"加载预训练底模G路径": "加載預訓練底模G路徑",
|
||||
"加载预训练底模D路径": "加載預訓練底模D路徑",
|
||||
"训练模型": "訓練模型",
|
||||
@@ -75,6 +77,7 @@
|
||||
"模型是否带音高指导": "模型是否帶音高指導",
|
||||
"要置入的模型信息": "要置入的模型資訊",
|
||||
"保存的模型名不带后缀": "儲存的模型名不帶副檔名",
|
||||
"模型版本型号": "模型版本型號",
|
||||
"融合": "融合",
|
||||
"修改模型信息(仅支持weights文件夹下提取的小模型文件)": "修改模型資訊(僅支援weights資料夾下提取的小模型檔案)",
|
||||
"模型路径": "模型路徑",
|
||||
@@ -92,6 +95,7 @@
|
||||
"Onnx输出路径": "Onnx输出路径",
|
||||
"MoeVS模型": "MoeSS模型",
|
||||
"导出Onnx模型": "导出Onnx模型",
|
||||
"常见问题解答": "常見問題解答",
|
||||
"招募音高曲线前端编辑器": "招募音高曲線前端編輯器",
|
||||
"加开发群联系我xxxxx": "加開發群聯繫我xxxxx",
|
||||
"点击查看交流、问题反馈群号": "點擊查看交流、問題反饋群號",
|
||||
@@ -116,7 +120,5 @@
|
||||
"性能设置": "效能設定",
|
||||
"开始音频转换": "開始音訊轉換",
|
||||
"停止音频转换": "停止音訊轉換",
|
||||
"常见问题解答": "常見問題解答",
|
||||
"后处理重采样至最终采样率,0为不进行重采样": "後處理重採樣至最終採樣率,0為不進行重採樣",
|
||||
"推理时间(ms):": "推理時間(ms):"
|
||||
}
|
||||
|
||||
@@ -10,8 +10,7 @@
|
||||
"本软件以MIT协议开源, 作者不对软件具备任何控制力, 使用软件者、传播软件导出的声音者自负全责. <br>如不认可该条款, 则不能使用或引用软件包内任何代码和文件. 详见根目录<b>使用需遵守的协议-LICENSE.txt</b>.": "本軟體以MIT協議開源,作者不對軟體具備任何控制力,使用軟體者、傳播軟體導出的聲音者自負全責。<br>如不認可該條款,則不能使用或引用軟體包內任何程式碼和檔案。詳見根目錄<b>使用需遵守的協議-LICENSE.txt</b>。",
|
||||
"模型推理": "模型推理",
|
||||
"推理音色": "推理音色",
|
||||
"刷新音色列表": "重新整理音色列表",
|
||||
"刷新音色列表和索引路径":"刷新音色列表和索引路徑",
|
||||
"刷新音色列表和索引路径": "刷新音色列表和索引路徑",
|
||||
"卸载音色省显存": "卸載音色節省 VRAM",
|
||||
"请选择说话人id": "請選擇說話人ID",
|
||||
"男转女推荐+12key, 女转男推荐-12key, 如果音域爆炸导致音色失真也可以自己调整到合适音域. ": "男性轉女性推薦+12key,女性轉男性推薦-12key,如果音域爆炸導致音色失真也可以自己調整到合適音域。",
|
||||
@@ -22,10 +21,12 @@
|
||||
"特征检索库文件路径": "特徵檢索庫檔案路徑",
|
||||
"特征文件路径": "特徵檔案路徑",
|
||||
"自动检测index路径,下拉式选择(dropdown)": "自動檢測index路徑,下拉式選擇(dropdown)",
|
||||
">=3则使用对harvest音高识别的结果使用中值滤波,数值为滤波半径,使用可以削弱哑音": ">=3則使用對harvest音高識別的結果使用中值濾波,數值為濾波半徑,使用可以削弱啞音",
|
||||
"特征检索库文件路径,为空则使用下拉的选择结果": "特徵檢索庫檔路徑,為空則使用下拉的選擇結果",
|
||||
"检索特征占比": "檢索特徵佔比",
|
||||
"后处理重采样至最终采样率,0为不进行重采样": "後處理重採樣至最終採樣率,0為不進行重採樣",
|
||||
"输入源音量包络替换输出音量包络融合比例,越靠近1越使用输出包络": "輸入源音量包絡替換輸出音量包絡融合比例,越靠近1越使用輸出包絡",
|
||||
"F0曲线文件, 可选, 一行一个音高, 代替默认F0及升降调": "F0曲線檔案,可選,一行一個音高,代替預設的F0及升降調",
|
||||
">=3则使用对harvest音高识别的结果使用中值滤波,数值为滤波半径,使用可以削弱哑音":">=3則使用對harvest音高識別的結果使用中值濾波,數值為濾波半徑,使用可以削弱啞音",
|
||||
"转换": "轉換",
|
||||
"输出信息": "輸出訊息",
|
||||
"输出音频(右下角三个点,点了可以下载)": "輸出音頻(右下角三個點,點了可以下載)",
|
||||
@@ -44,6 +45,8 @@
|
||||
"输入实验名": "輸入實驗名稱",
|
||||
"目标采样率": "目標取樣率",
|
||||
"模型是否带音高指导(唱歌一定要, 语音可以不要)": "模型是否帶音高指導(唱歌一定要,語音可以不要)",
|
||||
"版本(目前仅40k支持了v2)": "版本(目前僅40k支持了v2)",
|
||||
"提取音高和处理数据使用的CPU进程数": "提取音高和處理數據使用的CPU進程數",
|
||||
"step2a: 自动遍历训练文件夹下所有可解码成音频的文件并进行切片归一化, 在实验目录下生成2个wav文件夹; 暂时只支持单人训练. ": "step2a:自動遍歷訓練資料夾下所有可解碼成音頻的檔案並進行切片歸一化,在實驗目錄下生成2個wav資料夾;暫時只支援單人訓練。",
|
||||
"输入训练文件夹路径": "輸入訓練檔案夾路徑",
|
||||
"请指定说话人id": "請指定說話人id",
|
||||
@@ -51,8 +54,6 @@
|
||||
"step2b: 使用CPU提取音高(如果模型带音高), 使用GPU提取特征(选择卡号)": "步驟2b: 使用CPU提取音高(如果模型帶音高), 使用GPU提取特徵(選擇卡號)",
|
||||
"以-分隔输入使用的卡号, 例如 0-1-2 使用卡0和卡1和卡2": "以-分隔輸入使用的卡號, 例如 0-1-2 使用卡0和卡1和卡2",
|
||||
"显卡信息": "顯示卡資訊",
|
||||
"提取音高使用的CPU进程数": "提取音高使用的CPU進程數",
|
||||
"提取音高和处理数据使用的CPU进程数": "提取音高和處理數據使用的CPU進程數",
|
||||
"选择音高提取算法:输入歌声可用pm提速,高质量语音但CPU差可用dio提速,harvest质量更好但慢": "選擇音高提取算法:輸入歌聲可用pm提速,高品質語音但CPU差可用dio提速,harvest品質更好但較慢",
|
||||
"特征提取": "特徵提取",
|
||||
"step3: 填写训练设置, 开始训练模型和索引": "步驟3: 填寫訓練設定, 開始訓練模型和索引",
|
||||
@@ -62,6 +63,7 @@
|
||||
"是否仅保存最新的ckpt文件以节省硬盘空间": "是否僅保存最新的ckpt檔案以節省硬碟空間",
|
||||
"否": "否",
|
||||
"是否缓存所有训练集至显存. 10min以下小数据可缓存以加速训练, 大数据缓存会炸显存也加不了多少速": "是否緩存所有訓練集至 VRAM。小於10分鐘的小數據可緩存以加速訓練,大數據緩存會爆 VRAM 也加不了多少速度",
|
||||
"是否在每次保存时间点将最终小模型保存至weights文件夹": "是否在每次保存時間點將最終小模型保存至weights檔夾",
|
||||
"加载预训练底模G路径": "加載預訓練底模G路徑",
|
||||
"加载预训练底模D路径": "加載預訓練底模D路徑",
|
||||
"训练模型": "訓練模型",
|
||||
@@ -75,6 +77,7 @@
|
||||
"模型是否带音高指导": "模型是否帶音高指導",
|
||||
"要置入的模型信息": "要置入的模型資訊",
|
||||
"保存的模型名不带后缀": "儲存的模型名不帶副檔名",
|
||||
"模型版本型号": "模型版本型號",
|
||||
"融合": "融合",
|
||||
"修改模型信息(仅支持weights文件夹下提取的小模型文件)": "修改模型資訊(僅支援weights資料夾下提取的小模型檔案)",
|
||||
"模型路径": "模型路徑",
|
||||
@@ -92,6 +95,7 @@
|
||||
"Onnx输出路径": "Onnx输出路径",
|
||||
"MoeVS模型": "MoeSS模型",
|
||||
"导出Onnx模型": "导出Onnx模型",
|
||||
"常见问题解答": "常見問題解答",
|
||||
"招募音高曲线前端编辑器": "招募音高曲線前端編輯器",
|
||||
"加开发群联系我xxxxx": "加開發群聯繫我xxxxx",
|
||||
"点击查看交流、问题反馈群号": "點擊查看交流、問題反饋群號",
|
||||
@@ -116,7 +120,5 @@
|
||||
"性能设置": "效能設定",
|
||||
"开始音频转换": "開始音訊轉換",
|
||||
"停止音频转换": "停止音訊轉換",
|
||||
"常见问题解答": "常見問題解答",
|
||||
"后处理重采样至最终采样率,0为不进行重采样": "後處理重採樣至最終採樣率,0為不進行重採樣",
|
||||
"推理时间(ms):": "推理時間(ms):"
|
||||
}
|
||||
|
||||
341
infer-web.py
341
infer-web.py
@@ -1,9 +1,10 @@
|
||||
import torch, os, traceback, sys, warnings, shutil, numpy as np
|
||||
os.environ["no_proxy"] = "localhost, 127.0.0.1, ::1"
|
||||
|
||||
from multiprocessing import cpu_count
|
||||
import threading
|
||||
from time import sleep
|
||||
from subprocess import Popen
|
||||
from time import sleep
|
||||
import torch, os, traceback, sys, warnings, shutil, numpy as np
|
||||
import faiss
|
||||
from random import shuffle
|
||||
|
||||
@@ -70,7 +71,12 @@ else:
|
||||
gpu_info = i18n("很遗憾您这没有能用的显卡来支持您训练")
|
||||
default_batch_size = 1
|
||||
gpus = "-".join([i[0] for i in gpu_infos])
|
||||
from infer_pack.models import SynthesizerTrnMs256NSFsid, SynthesizerTrnMs256NSFsid_nono
|
||||
from infer_pack.models import (
|
||||
SynthesizerTrnMs256NSFsid,
|
||||
SynthesizerTrnMs256NSFsid_nono,
|
||||
SynthesizerTrnMs768NSFsid,
|
||||
SynthesizerTrnMs768NSFsid_nono,
|
||||
)
|
||||
from scipy.io import wavfile
|
||||
from fairseq import checkpoint_utils
|
||||
import gradio as gr
|
||||
@@ -144,14 +150,18 @@ def vc_single(
|
||||
index_rate,
|
||||
filter_radius,
|
||||
resample_sr,
|
||||
rms_mix_rate,
|
||||
crepe_hop_length,
|
||||
): # spk_item, input_audio0, vc_transform0,f0_file,f0method0
|
||||
global tgt_sr, net_g, vc, hubert_model
|
||||
global tgt_sr, net_g, vc, hubert_model, version
|
||||
if input_audio_path is None:
|
||||
return "You need to upload an audio", None
|
||||
f0_up_key = int(f0_up_key)
|
||||
try:
|
||||
audio = load_audio(input_audio_path, 16000)
|
||||
audio_max = np.abs(audio).max() / 0.95
|
||||
if audio_max > 1:
|
||||
audio /= audio_max
|
||||
times = [0, 0, 0]
|
||||
if hubert_model == None:
|
||||
load_hubert()
|
||||
@@ -187,6 +197,8 @@ def vc_single(
|
||||
filter_radius,
|
||||
tgt_sr,
|
||||
resample_sr,
|
||||
rms_mix_rate,
|
||||
version,
|
||||
crepe_hop_length,
|
||||
f0_file=f0_file,
|
||||
)
|
||||
@@ -222,6 +234,7 @@ def vc_multi(
|
||||
index_rate,
|
||||
filter_radius,
|
||||
resample_sr,
|
||||
rms_mix_rate,
|
||||
):
|
||||
try:
|
||||
dir_path = (
|
||||
@@ -251,6 +264,7 @@ def vc_multi(
|
||||
index_rate,
|
||||
filter_radius,
|
||||
resample_sr,
|
||||
rms_mix_rate,
|
||||
)
|
||||
if "Success" in info:
|
||||
try:
|
||||
@@ -337,7 +351,7 @@ def uvr(model_name, inp_root, save_root_vocal, paths, save_root_ins, agg):
|
||||
|
||||
# 一个选项卡全局只能有一个音色
|
||||
def get_vc(sid):
|
||||
global n_spk, tgt_sr, net_g, vc, cpt
|
||||
global n_spk, tgt_sr, net_g, vc, cpt, version
|
||||
if sid == "" or sid == []:
|
||||
global hubert_model
|
||||
if hubert_model != None: # 考虑到轮询, 需要加个判断看是否 sid 是由有模型切换到无模型的
|
||||
@@ -348,12 +362,21 @@ def get_vc(sid):
|
||||
torch.cuda.empty_cache()
|
||||
###楼下不这么折腾清理不干净
|
||||
if_f0 = cpt.get("f0", 1)
|
||||
if if_f0 == 1:
|
||||
net_g = SynthesizerTrnMs256NSFsid(
|
||||
*cpt["config"], is_half=config.is_half
|
||||
)
|
||||
else:
|
||||
net_g = SynthesizerTrnMs256NSFsid_nono(*cpt["config"])
|
||||
version = cpt.get("version", "v1")
|
||||
if version == "v1":
|
||||
if if_f0 == 1:
|
||||
net_g = SynthesizerTrnMs256NSFsid(
|
||||
*cpt["config"], is_half=config.is_half
|
||||
)
|
||||
else:
|
||||
net_g = SynthesizerTrnMs256NSFsid_nono(*cpt["config"])
|
||||
elif version == "v2":
|
||||
if if_f0 == 1:
|
||||
net_g = SynthesizerTrnMs768NSFsid(
|
||||
*cpt["config"], is_half=config.is_half
|
||||
)
|
||||
else:
|
||||
net_g = SynthesizerTrnMs768NSFsid_nono(*cpt["config"])
|
||||
del net_g, cpt
|
||||
if torch.cuda.is_available():
|
||||
torch.cuda.empty_cache()
|
||||
@@ -365,12 +388,19 @@ def get_vc(sid):
|
||||
tgt_sr = cpt["config"][-1]
|
||||
cpt["config"][-3] = cpt["weight"]["emb_g.weight"].shape[0] # n_spk
|
||||
if_f0 = cpt.get("f0", 1)
|
||||
if if_f0 == 1:
|
||||
net_g = SynthesizerTrnMs256NSFsid(*cpt["config"], is_half=config.is_half)
|
||||
else:
|
||||
net_g = SynthesizerTrnMs256NSFsid_nono(*cpt["config"])
|
||||
version = cpt.get("version", "v1")
|
||||
if version == "v1":
|
||||
if if_f0 == 1:
|
||||
net_g = SynthesizerTrnMs256NSFsid(*cpt["config"], is_half=config.is_half)
|
||||
else:
|
||||
net_g = SynthesizerTrnMs256NSFsid_nono(*cpt["config"])
|
||||
elif version == "v2":
|
||||
if if_f0 == 1:
|
||||
net_g = SynthesizerTrnMs768NSFsid(*cpt["config"], is_half=config.is_half)
|
||||
else:
|
||||
net_g = SynthesizerTrnMs768NSFsid_nono(*cpt["config"])
|
||||
del net_g.enc_q
|
||||
print(net_g.load_state_dict(cpt["weight"], strict=False)) # 不加这一行清不干净, 真奇葩
|
||||
print(net_g.load_state_dict(cpt["weight"], strict=False))
|
||||
net_g.eval().to(config.device)
|
||||
if config.is_half:
|
||||
net_g = net_g.half()
|
||||
@@ -400,23 +430,6 @@ def change_choices():
|
||||
def clean():
|
||||
return {"value": "", "__type__": "update"}
|
||||
|
||||
|
||||
def change_f0(if_f0_3, sr2): # np7, f0method8,pretrained_G14,pretrained_D15
|
||||
if if_f0_3:
|
||||
return (
|
||||
{"visible": True, "__type__": "update"},
|
||||
{"visible": True, "__type__": "update"},
|
||||
"pretrained/f0G%s.pth" % sr2,
|
||||
"pretrained/f0D%s.pth" % sr2,
|
||||
)
|
||||
return (
|
||||
{"visible": False, "__type__": "update"},
|
||||
{"visible": False, "__type__": "update"},
|
||||
"pretrained/G%s.pth" % sr2,
|
||||
"pretrained/D%s.pth" % sr2,
|
||||
)
|
||||
|
||||
|
||||
sr_dict = {
|
||||
"32k": 32000,
|
||||
"40k": 40000,
|
||||
@@ -483,8 +496,7 @@ def preprocess_dataset(trainset_dir, exp_dir, sr, n_p):
|
||||
|
||||
|
||||
# but2.click(extract_f0,[gpus6,np7,f0method8,if_f0_3,trainset_dir4],[info2])
|
||||
def extract_f0_feature(gpus, n_p, f0method, if_f0, exp_dir, echl):
|
||||
|
||||
def extract_f0_feature(gpus, n_p, f0method, if_f0, exp_dir, version19, echl):
|
||||
gpus = gpus.split("-")
|
||||
os.makedirs("%s/logs/%s" % (now_dir, exp_dir), exist_ok=True)
|
||||
f = open("%s/logs/%s/extract_f0_feature.log" % (now_dir, exp_dir), "w")
|
||||
@@ -531,13 +543,18 @@ def extract_f0_feature(gpus, n_p, f0method, if_f0, exp_dir, echl):
|
||||
leng = len(gpus)
|
||||
ps = []
|
||||
for idx, n_g in enumerate(gpus):
|
||||
cmd = config.python_cmd + " extract_feature_print.py %s %s %s %s %s/logs/%s" % (
|
||||
config.device,
|
||||
leng,
|
||||
idx,
|
||||
n_g,
|
||||
now_dir,
|
||||
exp_dir,
|
||||
cmd = (
|
||||
config.python_cmd
|
||||
+ " extract_feature_print.py %s %s %s %s %s/logs/%s %s"
|
||||
% (
|
||||
config.device,
|
||||
leng,
|
||||
idx,
|
||||
n_g,
|
||||
now_dir,
|
||||
exp_dir,
|
||||
version19,
|
||||
)
|
||||
)
|
||||
print(cmd)
|
||||
p = Popen(
|
||||
@@ -565,11 +582,45 @@ def extract_f0_feature(gpus, n_p, f0method, if_f0, exp_dir, echl):
|
||||
yield log
|
||||
|
||||
|
||||
def change_sr2(sr2, if_f0_3):
|
||||
def change_sr2(sr2, if_f0_3, version19):
|
||||
vis_v = True if sr2 == "40k" else False
|
||||
if sr2 != "40k":
|
||||
version19 = "v1"
|
||||
path_str = "" if version19 == "v1" else "_v2"
|
||||
version_state = {"visible": vis_v, "__type__": "update"}
|
||||
if vis_v == False:
|
||||
version_state["value"] = "v1"
|
||||
f0_str = "f0" if if_f0_3 else ""
|
||||
return (
|
||||
"pretrained%s/%sG%s.pth" % (path_str, f0_str, sr2),
|
||||
"pretrained%s/%sD%s.pth" % (path_str, f0_str, sr2),
|
||||
version_state,
|
||||
)
|
||||
|
||||
|
||||
def change_version19(sr2, if_f0_3, version19):
|
||||
path_str = "" if version19 == "v1" else "_v2"
|
||||
f0_str = "f0" if if_f0_3 else ""
|
||||
return "pretrained%s/%sG%s.pth" % (
|
||||
path_str,
|
||||
f0_str,
|
||||
sr2,
|
||||
), "pretrained%s/%sD%s.pth" % (path_str, f0_str, sr2)
|
||||
|
||||
|
||||
def change_f0(if_f0_3, sr2, version19): # f0method8,pretrained_G14,pretrained_D15
|
||||
path_str = "" if version19 == "v1" else "_v2"
|
||||
if if_f0_3:
|
||||
return "pretrained/f0G%s.pth" % sr2, "pretrained/f0D%s.pth" % sr2
|
||||
else:
|
||||
return "pretrained/G%s.pth" % sr2, "pretrained/D%s.pth" % sr2
|
||||
return (
|
||||
{"visible": True, "__type__": "update"},
|
||||
"pretrained%s/f0G%s.pth" % (path_str, sr2),
|
||||
"pretrained%s/f0D%s.pth" % (path_str, sr2),
|
||||
)
|
||||
return (
|
||||
{"visible": False, "__type__": "update"},
|
||||
"pretrained%s/G%s.pth" % (path_str, sr2),
|
||||
"pretrained%s/D%s.pth" % (path_str, sr2),
|
||||
)
|
||||
|
||||
|
||||
# but3.click(click_train,[exp_dir1,sr2,if_f0_3,save_epoch10,total_epoch11,batch_size12,if_save_latest13,pretrained_G14,pretrained_D15,gpus16])
|
||||
@@ -586,24 +637,30 @@ def click_train(
|
||||
pretrained_D15,
|
||||
gpus16,
|
||||
if_cache_gpu17,
|
||||
if_save_every_weights18,
|
||||
version19,
|
||||
):
|
||||
# 生成filelist
|
||||
exp_dir = "%s/logs/%s" % (now_dir, exp_dir1)
|
||||
os.makedirs(exp_dir, exist_ok=True)
|
||||
gt_wavs_dir = "%s/0_gt_wavs" % (exp_dir)
|
||||
co256_dir = "%s/3_feature256" % (exp_dir)
|
||||
feature_dir = (
|
||||
"%s/3_feature256" % (exp_dir)
|
||||
if version19 == "v1"
|
||||
else "%s/3_feature768" % (exp_dir)
|
||||
)
|
||||
if if_f0_3:
|
||||
f0_dir = "%s/2a_f0" % (exp_dir)
|
||||
f0nsf_dir = "%s/2b-f0nsf" % (exp_dir)
|
||||
names = (
|
||||
set([name.split(".")[0] for name in os.listdir(gt_wavs_dir)])
|
||||
& set([name.split(".")[0] for name in os.listdir(co256_dir)])
|
||||
& set([name.split(".")[0] for name in os.listdir(feature_dir)])
|
||||
& set([name.split(".")[0] for name in os.listdir(f0_dir)])
|
||||
& set([name.split(".")[0] for name in os.listdir(f0nsf_dir)])
|
||||
)
|
||||
else:
|
||||
names = set([name.split(".")[0] for name in os.listdir(gt_wavs_dir)]) & set(
|
||||
[name.split(".")[0] for name in os.listdir(co256_dir)]
|
||||
[name.split(".")[0] for name in os.listdir(feature_dir)]
|
||||
)
|
||||
opt = []
|
||||
for name in names:
|
||||
@@ -613,7 +670,7 @@ def click_train(
|
||||
% (
|
||||
gt_wavs_dir.replace("\\", "\\\\"),
|
||||
name,
|
||||
co256_dir.replace("\\", "\\\\"),
|
||||
feature_dir.replace("\\", "\\\\"),
|
||||
name,
|
||||
f0_dir.replace("\\", "\\\\"),
|
||||
name,
|
||||
@@ -628,22 +685,23 @@ def click_train(
|
||||
% (
|
||||
gt_wavs_dir.replace("\\", "\\\\"),
|
||||
name,
|
||||
co256_dir.replace("\\", "\\\\"),
|
||||
feature_dir.replace("\\", "\\\\"),
|
||||
name,
|
||||
spk_id5,
|
||||
)
|
||||
)
|
||||
fea_dim = 256 if version19 == "v1" else 768
|
||||
if if_f0_3:
|
||||
for _ in range(2):
|
||||
opt.append(
|
||||
"%s/logs/mute/0_gt_wavs/mute%s.wav|%s/logs/mute/3_feature256/mute.npy|%s/logs/mute/2a_f0/mute.wav.npy|%s/logs/mute/2b-f0nsf/mute.wav.npy|%s"
|
||||
% (now_dir, sr2, now_dir, now_dir, now_dir, spk_id5)
|
||||
"%s/logs/mute/0_gt_wavs/mute%s.wav|%s/logs/mute/3_feature%s/mute.npy|%s/logs/mute/2a_f0/mute.wav.npy|%s/logs/mute/2b-f0nsf/mute.wav.npy|%s"
|
||||
% (now_dir, sr2, now_dir, fea_dim, now_dir, now_dir, spk_id5)
|
||||
)
|
||||
else:
|
||||
for _ in range(2):
|
||||
opt.append(
|
||||
"%s/logs/mute/0_gt_wavs/mute%s.wav|%s/logs/mute/3_feature256/mute.npy|%s"
|
||||
% (now_dir, sr2, now_dir, spk_id5)
|
||||
"%s/logs/mute/0_gt_wavs/mute%s.wav|%s/logs/mute/3_feature%s/mute.npy|%s"
|
||||
% (now_dir, sr2, now_dir, fea_dim, spk_id5)
|
||||
)
|
||||
shuffle(opt)
|
||||
with open("%s/filelist.txt" % exp_dir, "w") as f:
|
||||
@@ -655,7 +713,7 @@ def click_train(
|
||||
if gpus16:
|
||||
cmd = (
|
||||
config.python_cmd
|
||||
+ " train_nsf_sim_cache_sid_load_pretrain.py -e %s -sr %s -f0 %s -bs %s -g %s -te %s -se %s -pg %s -pd %s -l %s -c %s"
|
||||
+ " train_nsf_sim_cache_sid_load_pretrain.py -e %s -sr %s -f0 %s -bs %s -g %s -te %s -se %s -pg %s -pd %s -l %s -c %s -sw %s -v %s"
|
||||
% (
|
||||
exp_dir1,
|
||||
sr2,
|
||||
@@ -668,12 +726,14 @@ def click_train(
|
||||
pretrained_D15,
|
||||
1 if if_save_latest13 == i18n("是") else 0,
|
||||
1 if if_cache_gpu17 == i18n("是") else 0,
|
||||
1 if if_save_every_weights18 == i18n("是") else 0,
|
||||
version19,
|
||||
)
|
||||
)
|
||||
else:
|
||||
cmd = (
|
||||
config.python_cmd
|
||||
+ " train_nsf_sim_cache_sid_load_pretrain.py -e %s -sr %s -f0 %s -bs %s -te %s -se %s -pg %s -pd %s -l %s -c %s"
|
||||
+ " train_nsf_sim_cache_sid_load_pretrain.py -e %s -sr %s -f0 %s -bs %s -te %s -se %s -pg %s -pd %s -l %s -c %s -sw %s -v %s"
|
||||
% (
|
||||
exp_dir1,
|
||||
sr2,
|
||||
@@ -685,6 +745,8 @@ def click_train(
|
||||
pretrained_D15,
|
||||
1 if if_save_latest13 == i18n("是") else 0,
|
||||
1 if if_cache_gpu17 == i18n("是") else 0,
|
||||
1 if if_save_every_weights18 == i18n("是") else 0,
|
||||
version19,
|
||||
)
|
||||
)
|
||||
print(cmd)
|
||||
@@ -694,10 +756,14 @@ def click_train(
|
||||
|
||||
|
||||
# but4.click(train_index, [exp_dir1], info3)
|
||||
def train_index(exp_dir1):
|
||||
def train_index(exp_dir1, version19):
|
||||
exp_dir = "%s/logs/%s" % (now_dir, exp_dir1)
|
||||
os.makedirs(exp_dir, exist_ok=True)
|
||||
feature_dir = "%s/3_feature256" % (exp_dir)
|
||||
feature_dir = (
|
||||
"%s/3_feature256" % (exp_dir)
|
||||
if version19 == "v1"
|
||||
else "%s/3_feature768" % (exp_dir)
|
||||
)
|
||||
if os.path.exists(feature_dir) == False:
|
||||
return "请先进行特征提取!"
|
||||
listdir_res = list(os.listdir(feature_dir))
|
||||
@@ -717,8 +783,8 @@ def train_index(exp_dir1):
|
||||
infos = []
|
||||
infos.append("%s,%s" % (big_npy.shape, n_ivf))
|
||||
yield "\n".join(infos)
|
||||
index = faiss.index_factory(256, "IVF%s,Flat" % n_ivf)
|
||||
# index = faiss.index_factory(256, "IVF%s,PQ128x4fs,RFlat"%n_ivf)
|
||||
index = faiss.index_factory(256 if version19 == "v1" else 768, "IVF%s,Flat" % n_ivf)
|
||||
# index = faiss.index_factory(256if version19=="v1"else 768, "IVF%s,PQ128x4fs,RFlat"%n_ivf)
|
||||
infos.append("training")
|
||||
yield "\n".join(infos)
|
||||
index_ivf = faiss.extract_index_ivf(index) #
|
||||
@@ -726,9 +792,10 @@ def train_index(exp_dir1):
|
||||
index.train(big_npy)
|
||||
faiss.write_index(
|
||||
index,
|
||||
"%s/trained_IVF%s_Flat_nprobe_%s.index" % (exp_dir, n_ivf, index_ivf.nprobe),
|
||||
"%s/trained_IVF%s_Flat_nprobe_%s_%s.index"
|
||||
% (exp_dir, n_ivf, index_ivf.nprobe, version19),
|
||||
)
|
||||
# faiss.write_index(index, '%s/trained_IVF%s_Flat_FastScan.index'%(exp_dir,n_ivf))
|
||||
# faiss.write_index(index, '%s/trained_IVF%s_Flat_FastScan_%s.index'%(exp_dir,n_ivf,version19))
|
||||
infos.append("adding")
|
||||
yield "\n".join(infos)
|
||||
batch_size_add = 8192
|
||||
@@ -738,9 +805,12 @@ def train_index(exp_dir1):
|
||||
index,
|
||||
"%s/added_IVF%s_Flat_nprobe_%s.index" % (exp_dir, n_ivf, index_ivf.nprobe),
|
||||
)
|
||||
infos.append("成功构建索引,added_IVF%s_Flat_nprobe_%s.index" % (n_ivf, index_ivf.nprobe))
|
||||
# faiss.write_index(index, '%s/added_IVF%s_Flat_FastScan.index'%(exp_dir,n_ivf))
|
||||
# infos.append("成功构建索引,added_IVF%s_Flat_FastScan.index"%(n_ivf))
|
||||
infos.append(
|
||||
"成功构建索引,added_IVF%s_Flat_nprobe_%s_%s.index"
|
||||
% (n_ivf, index_ivf.nprobe, version19)
|
||||
)
|
||||
# faiss.write_index(index, '%s/added_IVF%s_Flat_FastScan_%s.index'%(exp_dir,n_ivf,version19))
|
||||
# infos.append("成功构建索引,added_IVF%s_Flat_FastScan_%s.index"%(n_ivf,version19))
|
||||
yield "\n".join(infos)
|
||||
|
||||
|
||||
@@ -761,6 +831,8 @@ def train1key(
|
||||
pretrained_D15,
|
||||
gpus16,
|
||||
if_cache_gpu17,
|
||||
if_save_every_weights18,
|
||||
version19,
|
||||
):
|
||||
infos = []
|
||||
|
||||
@@ -772,7 +844,11 @@ def train1key(
|
||||
preprocess_log_path = "%s/preprocess.log" % model_log_dir
|
||||
extract_f0_feature_log_path = "%s/extract_f0_feature.log" % model_log_dir
|
||||
gt_wavs_dir = "%s/0_gt_wavs" % model_log_dir
|
||||
feature256_dir = "%s/3_feature256" % model_log_dir
|
||||
feature_dir = (
|
||||
"%s/3_feature256" % model_log_dir
|
||||
if version19 == "v1"
|
||||
else "%s/3_feature768" % model_log_dir
|
||||
)
|
||||
|
||||
os.makedirs(model_log_dir, exist_ok=True)
|
||||
#########step1:处理数据
|
||||
@@ -811,12 +887,13 @@ def train1key(
|
||||
leng = len(gpus)
|
||||
ps = []
|
||||
for idx, n_g in enumerate(gpus):
|
||||
cmd = config.python_cmd + " extract_feature_print.py %s %s %s %s %s" % (
|
||||
cmd = config.python_cmd + " extract_feature_print.py %s %s %s %s %s %s" % (
|
||||
config.device,
|
||||
leng,
|
||||
idx,
|
||||
n_g,
|
||||
model_log_dir,
|
||||
version19,
|
||||
)
|
||||
yield get_info_str(cmd)
|
||||
p = Popen(
|
||||
@@ -835,13 +912,13 @@ def train1key(
|
||||
f0nsf_dir = "%s/2b-f0nsf" % model_log_dir
|
||||
names = (
|
||||
set([name.split(".")[0] for name in os.listdir(gt_wavs_dir)])
|
||||
& set([name.split(".")[0] for name in os.listdir(feature256_dir)])
|
||||
& set([name.split(".")[0] for name in os.listdir(feature_dir)])
|
||||
& set([name.split(".")[0] for name in os.listdir(f0_dir)])
|
||||
& set([name.split(".")[0] for name in os.listdir(f0nsf_dir)])
|
||||
)
|
||||
else:
|
||||
names = set([name.split(".")[0] for name in os.listdir(gt_wavs_dir)]) & set(
|
||||
[name.split(".")[0] for name in os.listdir(feature256_dir)]
|
||||
[name.split(".")[0] for name in os.listdir(feature_dir)]
|
||||
)
|
||||
opt = []
|
||||
for name in names:
|
||||
@@ -851,7 +928,7 @@ def train1key(
|
||||
% (
|
||||
gt_wavs_dir.replace("\\", "\\\\"),
|
||||
name,
|
||||
feature256_dir.replace("\\", "\\\\"),
|
||||
feature_dir.replace("\\", "\\\\"),
|
||||
name,
|
||||
f0_dir.replace("\\", "\\\\"),
|
||||
name,
|
||||
@@ -866,22 +943,23 @@ def train1key(
|
||||
% (
|
||||
gt_wavs_dir.replace("\\", "\\\\"),
|
||||
name,
|
||||
feature256_dir.replace("\\", "\\\\"),
|
||||
feature_dir.replace("\\", "\\\\"),
|
||||
name,
|
||||
spk_id5,
|
||||
)
|
||||
)
|
||||
fea_dim = 256 if version19 == "v1" else 768
|
||||
if if_f0_3:
|
||||
for _ in range(2):
|
||||
opt.append(
|
||||
"%s/logs/mute/0_gt_wavs/mute%s.wav|%s/logs/mute/3_feature256/mute.npy|%s/logs/mute/2a_f0/mute.wav.npy|%s/logs/mute/2b-f0nsf/mute.wav.npy|%s"
|
||||
% (now_dir, sr2, now_dir, now_dir, now_dir, spk_id5)
|
||||
"%s/logs/mute/0_gt_wavs/mute%s.wav|%s/logs/mute/3_feature%s/mute.npy|%s/logs/mute/2a_f0/mute.wav.npy|%s/logs/mute/2b-f0nsf/mute.wav.npy|%s"
|
||||
% (now_dir, sr2, now_dir, fea_dim, now_dir, now_dir, spk_id5)
|
||||
)
|
||||
else:
|
||||
for _ in range(2):
|
||||
opt.append(
|
||||
"%s/logs/mute/0_gt_wavs/mute%s.wav|%s/logs/mute/3_feature256/mute.npy|%s"
|
||||
% (now_dir, sr2, now_dir, spk_id5)
|
||||
"%s/logs/mute/0_gt_wavs/mute%s.wav|%s/logs/mute/3_feature%s/mute.npy|%s"
|
||||
% (now_dir, sr2, now_dir, fea_dim, spk_id5)
|
||||
)
|
||||
shuffle(opt)
|
||||
with open("%s/filelist.txt" % model_log_dir, "w") as f:
|
||||
@@ -890,7 +968,7 @@ def train1key(
|
||||
if gpus16:
|
||||
cmd = (
|
||||
config.python_cmd
|
||||
+ " train_nsf_sim_cache_sid_load_pretrain.py -e %s -sr %s -f0 %s -bs %s -g %s -te %s -se %s -pg %s -pd %s -l %s -c %s"
|
||||
+ " train_nsf_sim_cache_sid_load_pretrain.py -e %s -sr %s -f0 %s -bs %s -g %s -te %s -se %s -pg %s -pd %s -l %s -c %s -sw %s -v %s"
|
||||
% (
|
||||
exp_dir1,
|
||||
sr2,
|
||||
@@ -903,12 +981,14 @@ def train1key(
|
||||
pretrained_D15,
|
||||
1 if if_save_latest13 == i18n("是") else 0,
|
||||
1 if if_cache_gpu17 == i18n("是") else 0,
|
||||
1 if if_save_every_weights18 == i18n("是") else 0,
|
||||
version19,
|
||||
)
|
||||
)
|
||||
else:
|
||||
cmd = (
|
||||
config.python_cmd
|
||||
+ " train_nsf_sim_cache_sid_load_pretrain.py -e %s -sr %s -f0 %s -bs %s -te %s -se %s -pg %s -pd %s -l %s -c %s"
|
||||
+ " train_nsf_sim_cache_sid_load_pretrain.py -e %s -sr %s -f0 %s -bs %s -te %s -se %s -pg %s -pd %s -l %s -c %s -sw %s -v %s"
|
||||
% (
|
||||
exp_dir1,
|
||||
sr2,
|
||||
@@ -920,6 +1000,8 @@ def train1key(
|
||||
pretrained_D15,
|
||||
1 if if_save_latest13 == i18n("是") else 0,
|
||||
1 if if_cache_gpu17 == i18n("是") else 0,
|
||||
1 if if_save_every_weights18 == i18n("是") else 0,
|
||||
version19,
|
||||
)
|
||||
)
|
||||
yield get_info_str(cmd)
|
||||
@@ -928,9 +1010,9 @@ def train1key(
|
||||
yield get_info_str(i18n("训练结束, 您可查看控制台训练日志或实验文件夹下的train.log"))
|
||||
#######step3b:训练索引
|
||||
npys = []
|
||||
listdir_res = list(os.listdir(feature256_dir))
|
||||
listdir_res = list(os.listdir(feature_dir))
|
||||
for name in sorted(listdir_res):
|
||||
phone = np.load("%s/%s" % (feature256_dir, name))
|
||||
phone = np.load("%s/%s" % (feature_dir, name))
|
||||
npys.append(phone)
|
||||
big_npy = np.concatenate(npys, 0)
|
||||
|
||||
@@ -942,15 +1024,15 @@ def train1key(
|
||||
# n_ivf = big_npy.shape[0] // 39
|
||||
n_ivf = min(int(16 * np.sqrt(big_npy.shape[0])), big_npy.shape[0] // 39)
|
||||
yield get_info_str("%s,%s" % (big_npy.shape, n_ivf))
|
||||
index = faiss.index_factory(256, "IVF%s,Flat" % n_ivf)
|
||||
index = faiss.index_factory(256 if version19 == "v1" else 768, "IVF%s,Flat" % n_ivf)
|
||||
yield get_info_str("training index")
|
||||
index_ivf = faiss.extract_index_ivf(index) #
|
||||
index_ivf.nprobe = 1
|
||||
index.train(big_npy)
|
||||
faiss.write_index(
|
||||
index,
|
||||
"%s/trained_IVF%s_Flat_nprobe_%s.index"
|
||||
% (model_log_dir, n_ivf, index_ivf.nprobe),
|
||||
"%s/trained_IVF%s_Flat_nprobe_%s_%s.index"
|
||||
% (model_log_dir, n_ivf, index_ivf.nprobe, version19),
|
||||
)
|
||||
yield get_info_str("adding index")
|
||||
batch_size_add = 8192
|
||||
@@ -958,11 +1040,12 @@ def train1key(
|
||||
index.add(big_npy[i : i + batch_size_add])
|
||||
faiss.write_index(
|
||||
index,
|
||||
"%s/added_IVF%s_Flat_nprobe_%s.index"
|
||||
% (model_log_dir, n_ivf, index_ivf.nprobe),
|
||||
"%s/added_IVF%s_Flat_nprobe_%s_%s.index"
|
||||
% (model_log_dir, n_ivf, index_ivf.nprobe, version19),
|
||||
)
|
||||
yield get_info_str(
|
||||
"成功构建索引, added_IVF%s_Flat_nprobe_%s.index" % (n_ivf, index_ivf.nprobe)
|
||||
"成功构建索引, added_IVF%s_Flat_nprobe_%s_%s.index"
|
||||
% (n_ivf, index_ivf.nprobe, version19)
|
||||
)
|
||||
yield get_info_str(i18n("全流程结束!"))
|
||||
|
||||
@@ -973,17 +1056,18 @@ def change_info_(ckpt_path):
|
||||
os.path.exists(ckpt_path.replace(os.path.basename(ckpt_path), "train.log"))
|
||||
== False
|
||||
):
|
||||
return {"__type__": "update"}, {"__type__": "update"}
|
||||
return {"__type__": "update"}, {"__type__": "update"}, {"__type__": "update"}
|
||||
try:
|
||||
with open(
|
||||
ckpt_path.replace(os.path.basename(ckpt_path), "train.log"), "r"
|
||||
) as f:
|
||||
info = eval(f.read().strip("\n").split("\n")[0].split("\t")[-1])
|
||||
sr, f0 = info["sample_rate"], info["if_f0"]
|
||||
return sr, str(f0)
|
||||
version = "v2" if ("version" in info and info["version"] == "v2") else "v1"
|
||||
return sr, str(f0), version
|
||||
except:
|
||||
traceback.print_exc()
|
||||
return {"__type__": "update"}, {"__type__": "update"}
|
||||
return {"__type__": "update"}, {"__type__": "update"}, {"__type__": "update"}
|
||||
|
||||
|
||||
from infer_pack.models_onnx_moess import SynthesizerTrnMs256NSFsidM
|
||||
@@ -1167,6 +1251,13 @@ with gr.Blocks(theme=gr.themes.Soft()) as app:
|
||||
step=1,
|
||||
interactive=True,
|
||||
)
|
||||
rms_mix_rate0 = gr.Slider(
|
||||
minimum=0,
|
||||
maximum=1,
|
||||
label=i18n("输入源音量包络替换输出音量包络融合比例,越靠近1越使用输出包络"),
|
||||
value=1,
|
||||
interactive=True,
|
||||
)
|
||||
f0_file = gr.File(label=i18n("F0曲线文件, 可选, 一行一个音高, 代替默认F0及升降调"))
|
||||
but0 = gr.Button(i18n("转换"), variant="primary")
|
||||
with gr.Column():
|
||||
@@ -1186,6 +1277,7 @@ with gr.Blocks(theme=gr.themes.Soft()) as app:
|
||||
index_rate1,
|
||||
filter_radius0,
|
||||
resample_sr0,
|
||||
rms_mix_rate0,
|
||||
crepe_hop_length
|
||||
],
|
||||
[vc_output1, vc_output2],
|
||||
@@ -1245,6 +1337,13 @@ with gr.Blocks(theme=gr.themes.Soft()) as app:
|
||||
step=1,
|
||||
interactive=True,
|
||||
)
|
||||
rms_mix_rate1 = gr.Slider(
|
||||
minimum=0,
|
||||
maximum=1,
|
||||
label=i18n("输入源音量包络替换输出音量包络融合比例,越靠近1越使用输出包络"),
|
||||
value=1,
|
||||
interactive=True,
|
||||
)
|
||||
with gr.Column():
|
||||
dir_input = gr.Textbox(
|
||||
label=i18n("输入待处理音频文件夹路径(去文件管理器地址栏拷就行了)"),
|
||||
@@ -1270,6 +1369,7 @@ with gr.Blocks(theme=gr.themes.Soft()) as app:
|
||||
index_rate2,
|
||||
filter_radius1,
|
||||
resample_sr1,
|
||||
rms_mix_rate1,
|
||||
],
|
||||
[vc_output3],
|
||||
)
|
||||
@@ -1338,6 +1438,13 @@ with gr.Blocks(theme=gr.themes.Soft()) as app:
|
||||
value=True,
|
||||
interactive=True,
|
||||
)
|
||||
version19 = gr.Radio(
|
||||
label=i18n("版本(目前仅40k支持了v2)"),
|
||||
choices=["v1", "v2"],
|
||||
value="v1",
|
||||
interactive=True,
|
||||
visible=True,
|
||||
)
|
||||
np7 = gr.Slider(
|
||||
minimum=0,
|
||||
maximum=ncpu,
|
||||
@@ -1400,7 +1507,7 @@ with gr.Blocks(theme=gr.themes.Soft()) as app:
|
||||
info2 = gr.Textbox(label=i18n("输出信息"), value="", max_lines=8)
|
||||
but2.click(
|
||||
extract_f0_feature,
|
||||
[gpus6, np7, f0method8, if_f0_3, exp_dir1, extraction_crepe_hop_length],
|
||||
[gpus6, np7, f0method8, if_f0_3, exp_dir1, version19, extraction_crepe_hop_length],
|
||||
[info2],
|
||||
)
|
||||
with gr.Group():
|
||||
@@ -1444,6 +1551,12 @@ with gr.Blocks(theme=gr.themes.Soft()) as app:
|
||||
value=i18n("否"),
|
||||
interactive=True,
|
||||
)
|
||||
if_save_every_weights18 = gr.Radio(
|
||||
label=i18n("是否在每次保存时间点将最终小模型保存至weights文件夹"),
|
||||
choices=[i18n("是"), i18n("否")],
|
||||
value=i18n("否"),
|
||||
interactive=True,
|
||||
)
|
||||
with gr.Row():
|
||||
pretrained_G14 = gr.Textbox(
|
||||
label=i18n("加载预训练底模G路径"),
|
||||
@@ -1456,12 +1569,19 @@ with gr.Blocks(theme=gr.themes.Soft()) as app:
|
||||
interactive=True,
|
||||
)
|
||||
sr2.change(
|
||||
change_sr2, [sr2, if_f0_3], [pretrained_G14, pretrained_D15]
|
||||
change_sr2,
|
||||
[sr2, if_f0_3, version19],
|
||||
[pretrained_G14, pretrained_D15, version19],
|
||||
)
|
||||
version19.change(
|
||||
change_version19,
|
||||
[sr2, if_f0_3, version19],
|
||||
[pretrained_G14, pretrained_D15],
|
||||
)
|
||||
if_f0_3.change(
|
||||
change_f0,
|
||||
[if_f0_3, sr2],
|
||||
[np7, f0method8, pretrained_G14, pretrained_D15],
|
||||
[if_f0_3, sr2, version19],
|
||||
[f0method8, pretrained_G14, pretrained_D15],
|
||||
)
|
||||
gpus16 = gr.Textbox(
|
||||
label=i18n("以-分隔输入使用的卡号, 例如 0-1-2 使用卡0和卡1和卡2"),
|
||||
@@ -1487,10 +1607,12 @@ with gr.Blocks(theme=gr.themes.Soft()) as app:
|
||||
pretrained_D15,
|
||||
gpus16,
|
||||
if_cache_gpu17,
|
||||
if_save_every_weights18,
|
||||
version19,
|
||||
],
|
||||
info3,
|
||||
)
|
||||
but4.click(train_index, [exp_dir1], info3)
|
||||
but4.click(train_index, [exp_dir1, version19], info3)
|
||||
but5.click(
|
||||
train1key,
|
||||
[
|
||||
@@ -1509,6 +1631,8 @@ with gr.Blocks(theme=gr.themes.Soft()) as app:
|
||||
pretrained_D15,
|
||||
gpus16,
|
||||
if_cache_gpu17,
|
||||
if_save_every_weights18,
|
||||
version19,
|
||||
],
|
||||
info3,
|
||||
)
|
||||
@@ -1548,12 +1672,27 @@ with gr.Blocks(theme=gr.themes.Soft()) as app:
|
||||
max_lines=1,
|
||||
interactive=True,
|
||||
)
|
||||
version_2 = gr.Radio(
|
||||
label=i18n("模型版本型号"),
|
||||
choices=["v1", "v2"],
|
||||
value="v1",
|
||||
interactive=True,
|
||||
)
|
||||
with gr.Row():
|
||||
but6 = gr.Button(i18n("融合"), variant="primary")
|
||||
info4 = gr.Textbox(label=i18n("输出信息"), value="", max_lines=8)
|
||||
but6.click(
|
||||
merge,
|
||||
[ckpt_a, ckpt_b, alpha_a, sr_, if_f0_, info__, name_to_save0],
|
||||
[
|
||||
ckpt_a,
|
||||
ckpt_b,
|
||||
alpha_a,
|
||||
sr_,
|
||||
if_f0_,
|
||||
info__,
|
||||
name_to_save0,
|
||||
version_2,
|
||||
],
|
||||
info4,
|
||||
) # def merge(path1,path2,alpha1,sr,f0,info):
|
||||
with gr.Group():
|
||||
@@ -1611,15 +1750,23 @@ with gr.Blocks(theme=gr.themes.Soft()) as app:
|
||||
value="1",
|
||||
interactive=True,
|
||||
)
|
||||
version_1 = gr.Radio(
|
||||
label=i18n("模型版本型号"),
|
||||
choices=["v1", "v2"],
|
||||
value="v1",
|
||||
interactive=True,
|
||||
)
|
||||
info___ = gr.Textbox(
|
||||
label=i18n("要置入的模型信息"), value="", max_lines=8, interactive=True
|
||||
)
|
||||
but9 = gr.Button(i18n("提取"), variant="primary")
|
||||
info7 = gr.Textbox(label=i18n("输出信息"), value="", max_lines=8)
|
||||
ckpt_path2.change(change_info_, [ckpt_path2], [sr__, if_f0__])
|
||||
ckpt_path2.change(
|
||||
change_info_, [ckpt_path2], [sr__, if_f0__, version_1]
|
||||
)
|
||||
but9.click(
|
||||
extract_small_model,
|
||||
[ckpt_path2, save_name, sr__, if_f0__, info___],
|
||||
[ckpt_path2, save_name, sr__, if_f0__, info___, version_1],
|
||||
info7,
|
||||
)
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ class TextEncoder256(nn.Module):
|
||||
return m, logs, x_mask
|
||||
|
||||
|
||||
class TextEncoder256Sim(nn.Module):
|
||||
class TextEncoder768(nn.Module):
|
||||
def __init__(
|
||||
self,
|
||||
out_channels,
|
||||
@@ -81,14 +81,14 @@ class TextEncoder256Sim(nn.Module):
|
||||
self.n_layers = n_layers
|
||||
self.kernel_size = kernel_size
|
||||
self.p_dropout = p_dropout
|
||||
self.emb_phone = nn.Linear(256, hidden_channels)
|
||||
self.emb_phone = nn.Linear(768, hidden_channels)
|
||||
self.lrelu = nn.LeakyReLU(0.1, inplace=True)
|
||||
if f0 == True:
|
||||
self.emb_pitch = nn.Embedding(256, hidden_channels) # pitch 256
|
||||
self.encoder = attentions.Encoder(
|
||||
hidden_channels, filter_channels, n_heads, n_layers, kernel_size, p_dropout
|
||||
)
|
||||
self.proj = nn.Conv1d(hidden_channels, out_channels, 1)
|
||||
self.proj = nn.Conv1d(hidden_channels, out_channels * 2, 1)
|
||||
|
||||
def forward(self, phone, pitch, lengths):
|
||||
if pitch == None:
|
||||
@@ -102,8 +102,10 @@ class TextEncoder256Sim(nn.Module):
|
||||
x.dtype
|
||||
)
|
||||
x = self.encoder(x * x_mask, x_mask)
|
||||
x = self.proj(x) * x_mask
|
||||
return x, x_mask
|
||||
stats = self.proj(x) * x_mask
|
||||
|
||||
m, logs = torch.split(stats, self.out_channels, dim=1)
|
||||
return m, logs, x_mask
|
||||
|
||||
|
||||
class ResidualCouplingBlock(nn.Module):
|
||||
@@ -638,6 +640,117 @@ class SynthesizerTrnMs256NSFsid(nn.Module):
|
||||
return o, x_mask, (z, z_p, m_p, logs_p)
|
||||
|
||||
|
||||
class SynthesizerTrnMs768NSFsid(nn.Module):
|
||||
def __init__(
|
||||
self,
|
||||
spec_channels,
|
||||
segment_size,
|
||||
inter_channels,
|
||||
hidden_channels,
|
||||
filter_channels,
|
||||
n_heads,
|
||||
n_layers,
|
||||
kernel_size,
|
||||
p_dropout,
|
||||
resblock,
|
||||
resblock_kernel_sizes,
|
||||
resblock_dilation_sizes,
|
||||
upsample_rates,
|
||||
upsample_initial_channel,
|
||||
upsample_kernel_sizes,
|
||||
spk_embed_dim,
|
||||
gin_channels,
|
||||
sr,
|
||||
**kwargs
|
||||
):
|
||||
super().__init__()
|
||||
if type(sr) == type("strr"):
|
||||
sr = sr2sr[sr]
|
||||
self.spec_channels = spec_channels
|
||||
self.inter_channels = inter_channels
|
||||
self.hidden_channels = hidden_channels
|
||||
self.filter_channels = filter_channels
|
||||
self.n_heads = n_heads
|
||||
self.n_layers = n_layers
|
||||
self.kernel_size = kernel_size
|
||||
self.p_dropout = p_dropout
|
||||
self.resblock = resblock
|
||||
self.resblock_kernel_sizes = resblock_kernel_sizes
|
||||
self.resblock_dilation_sizes = resblock_dilation_sizes
|
||||
self.upsample_rates = upsample_rates
|
||||
self.upsample_initial_channel = upsample_initial_channel
|
||||
self.upsample_kernel_sizes = upsample_kernel_sizes
|
||||
self.segment_size = segment_size
|
||||
self.gin_channels = gin_channels
|
||||
# self.hop_length = hop_length#
|
||||
self.spk_embed_dim = spk_embed_dim
|
||||
self.enc_p = TextEncoder768(
|
||||
inter_channels,
|
||||
hidden_channels,
|
||||
filter_channels,
|
||||
n_heads,
|
||||
n_layers,
|
||||
kernel_size,
|
||||
p_dropout,
|
||||
)
|
||||
self.dec = GeneratorNSF(
|
||||
inter_channels,
|
||||
resblock,
|
||||
resblock_kernel_sizes,
|
||||
resblock_dilation_sizes,
|
||||
upsample_rates,
|
||||
upsample_initial_channel,
|
||||
upsample_kernel_sizes,
|
||||
gin_channels=gin_channels,
|
||||
sr=sr,
|
||||
is_half=kwargs["is_half"],
|
||||
)
|
||||
self.enc_q = PosteriorEncoder(
|
||||
spec_channels,
|
||||
inter_channels,
|
||||
hidden_channels,
|
||||
5,
|
||||
1,
|
||||
16,
|
||||
gin_channels=gin_channels,
|
||||
)
|
||||
self.flow = ResidualCouplingBlock(
|
||||
inter_channels, hidden_channels, 5, 1, 3, gin_channels=gin_channels
|
||||
)
|
||||
self.emb_g = nn.Embedding(self.spk_embed_dim, gin_channels)
|
||||
print("gin_channels:", gin_channels, "self.spk_embed_dim:", self.spk_embed_dim)
|
||||
|
||||
def remove_weight_norm(self):
|
||||
self.dec.remove_weight_norm()
|
||||
self.flow.remove_weight_norm()
|
||||
self.enc_q.remove_weight_norm()
|
||||
|
||||
def forward(
|
||||
self, phone, phone_lengths, pitch, pitchf, y, y_lengths, ds
|
||||
): # 这里ds是id,[bs,1]
|
||||
# print(1,pitch.shape)#[bs,t]
|
||||
g = self.emb_g(ds).unsqueeze(-1) # [b, 256, 1]##1是t,广播的
|
||||
m_p, logs_p, x_mask = self.enc_p(phone, pitch, phone_lengths)
|
||||
z, m_q, logs_q, y_mask = self.enc_q(y, y_lengths, g=g)
|
||||
z_p = self.flow(z, y_mask, g=g)
|
||||
z_slice, ids_slice = commons.rand_slice_segments(
|
||||
z, y_lengths, self.segment_size
|
||||
)
|
||||
# print(-1,pitchf.shape,ids_slice,self.segment_size,self.hop_length,self.segment_size//self.hop_length)
|
||||
pitchf = commons.slice_segments2(pitchf, ids_slice, self.segment_size)
|
||||
# print(-2,pitchf.shape,z_slice.shape)
|
||||
o = self.dec(z_slice, pitchf, g=g)
|
||||
return o, ids_slice, x_mask, y_mask, (z, z_p, m_p, logs_p, m_q, logs_q)
|
||||
|
||||
def infer(self, phone, phone_lengths, pitch, nsff0, sid, max_len=None):
|
||||
g = self.emb_g(sid).unsqueeze(-1)
|
||||
m_p, logs_p, x_mask = self.enc_p(phone, pitch, phone_lengths)
|
||||
z_p = (m_p + torch.exp(logs_p) * torch.randn_like(m_p) * 0.66666) * x_mask
|
||||
z = self.flow(z_p, x_mask, g=g, reverse=True)
|
||||
o = self.dec((z * x_mask)[:, :, :max_len], nsff0, g=g)
|
||||
return o, x_mask, (z, z_p, m_p, logs_p)
|
||||
|
||||
|
||||
class SynthesizerTrnMs256NSFsid_nono(nn.Module):
|
||||
def __init__(
|
||||
self,
|
||||
@@ -740,11 +853,7 @@ class SynthesizerTrnMs256NSFsid_nono(nn.Module):
|
||||
return o, x_mask, (z, z_p, m_p, logs_p)
|
||||
|
||||
|
||||
class SynthesizerTrnMs256NSFsid_sim(nn.Module):
|
||||
"""
|
||||
Synthesizer for Training
|
||||
"""
|
||||
|
||||
class SynthesizerTrnMs768NSFsid_nono(nn.Module):
|
||||
def __init__(
|
||||
self,
|
||||
spec_channels,
|
||||
@@ -763,9 +872,8 @@ class SynthesizerTrnMs256NSFsid_sim(nn.Module):
|
||||
upsample_initial_channel,
|
||||
upsample_kernel_sizes,
|
||||
spk_embed_dim,
|
||||
# hop_length,
|
||||
gin_channels=0,
|
||||
use_sdp=True,
|
||||
gin_channels,
|
||||
sr=None,
|
||||
**kwargs
|
||||
):
|
||||
super().__init__()
|
||||
@@ -787,7 +895,7 @@ class SynthesizerTrnMs256NSFsid_sim(nn.Module):
|
||||
self.gin_channels = gin_channels
|
||||
# self.hop_length = hop_length#
|
||||
self.spk_embed_dim = spk_embed_dim
|
||||
self.enc_p = TextEncoder256Sim(
|
||||
self.enc_p = TextEncoder768(
|
||||
inter_channels,
|
||||
hidden_channels,
|
||||
filter_channels,
|
||||
@@ -795,8 +903,9 @@ class SynthesizerTrnMs256NSFsid_sim(nn.Module):
|
||||
n_layers,
|
||||
kernel_size,
|
||||
p_dropout,
|
||||
f0=False,
|
||||
)
|
||||
self.dec = GeneratorNSF(
|
||||
self.dec = Generator(
|
||||
inter_channels,
|
||||
resblock,
|
||||
resblock_kernel_sizes,
|
||||
@@ -805,9 +914,16 @@ class SynthesizerTrnMs256NSFsid_sim(nn.Module):
|
||||
upsample_initial_channel,
|
||||
upsample_kernel_sizes,
|
||||
gin_channels=gin_channels,
|
||||
is_half=kwargs["is_half"],
|
||||
)
|
||||
|
||||
self.enc_q = PosteriorEncoder(
|
||||
spec_channels,
|
||||
inter_channels,
|
||||
hidden_channels,
|
||||
5,
|
||||
1,
|
||||
16,
|
||||
gin_channels=gin_channels,
|
||||
)
|
||||
self.flow = ResidualCouplingBlock(
|
||||
inter_channels, hidden_channels, 5, 1, 3, gin_channels=gin_channels
|
||||
)
|
||||
@@ -819,28 +935,24 @@ class SynthesizerTrnMs256NSFsid_sim(nn.Module):
|
||||
self.flow.remove_weight_norm()
|
||||
self.enc_q.remove_weight_norm()
|
||||
|
||||
def forward(
|
||||
self, phone, phone_lengths, pitch, pitchf, y_lengths, ds
|
||||
): # y是spec不需要了现在
|
||||
def forward(self, phone, phone_lengths, y, y_lengths, ds): # 这里ds是id,[bs,1]
|
||||
g = self.emb_g(ds).unsqueeze(-1) # [b, 256, 1]##1是t,广播的
|
||||
x, x_mask = self.enc_p(phone, pitch, phone_lengths)
|
||||
x = self.flow(x, x_mask, g=g, reverse=True)
|
||||
m_p, logs_p, x_mask = self.enc_p(phone, None, phone_lengths)
|
||||
z, m_q, logs_q, y_mask = self.enc_q(y, y_lengths, g=g)
|
||||
z_p = self.flow(z, y_mask, g=g)
|
||||
z_slice, ids_slice = commons.rand_slice_segments(
|
||||
x, y_lengths, self.segment_size
|
||||
z, y_lengths, self.segment_size
|
||||
)
|
||||
o = self.dec(z_slice, g=g)
|
||||
return o, ids_slice, x_mask, y_mask, (z, z_p, m_p, logs_p, m_q, logs_q)
|
||||
|
||||
pitchf = commons.slice_segments2(pitchf, ids_slice, self.segment_size)
|
||||
o = self.dec(z_slice, pitchf, g=g)
|
||||
return o, ids_slice
|
||||
|
||||
def infer(
|
||||
self, phone, phone_lengths, pitch, pitchf, ds, max_len=None
|
||||
): # y是spec不需要了现在
|
||||
g = self.emb_g(ds).unsqueeze(-1) # [b, 256, 1]##1是t,广播的
|
||||
x, x_mask = self.enc_p(phone, pitch, phone_lengths)
|
||||
x = self.flow(x, x_mask, g=g, reverse=True)
|
||||
o = self.dec((x * x_mask)[:, :, :max_len], pitchf, g=g)
|
||||
return o, o
|
||||
def infer(self, phone, phone_lengths, sid, max_len=None):
|
||||
g = self.emb_g(sid).unsqueeze(-1)
|
||||
m_p, logs_p, x_mask = self.enc_p(phone, None, phone_lengths)
|
||||
z_p = (m_p + torch.exp(logs_p) * torch.randn_like(m_p) * 0.66666) * x_mask
|
||||
z = self.flow(z_p, x_mask, g=g, reverse=True)
|
||||
o = self.dec((z * x_mask)[:, :, :max_len], g=g)
|
||||
return o, x_mask, (z, z_p, m_p, logs_p)
|
||||
|
||||
|
||||
class MultiPeriodDiscriminator(torch.nn.Module):
|
||||
@@ -873,6 +985,36 @@ class MultiPeriodDiscriminator(torch.nn.Module):
|
||||
return y_d_rs, y_d_gs, fmap_rs, fmap_gs
|
||||
|
||||
|
||||
class MultiPeriodDiscriminatorV2(torch.nn.Module):
|
||||
def __init__(self, use_spectral_norm=False):
|
||||
super(MultiPeriodDiscriminatorV2, self).__init__()
|
||||
# periods = [2, 3, 5, 7, 11, 17]
|
||||
periods = [2, 3, 5, 7, 11, 17, 23, 37]
|
||||
|
||||
discs = [DiscriminatorS(use_spectral_norm=use_spectral_norm)]
|
||||
discs = discs + [
|
||||
DiscriminatorP(i, use_spectral_norm=use_spectral_norm) for i in periods
|
||||
]
|
||||
self.discriminators = nn.ModuleList(discs)
|
||||
|
||||
def forward(self, y, y_hat):
|
||||
y_d_rs = [] #
|
||||
y_d_gs = []
|
||||
fmap_rs = []
|
||||
fmap_gs = []
|
||||
for i, d in enumerate(self.discriminators):
|
||||
y_d_r, fmap_r = d(y)
|
||||
y_d_g, fmap_g = d(y_hat)
|
||||
# for j in range(len(fmap_r)):
|
||||
# print(i,j,y.shape,y_hat.shape,fmap_r[j].shape,fmap_g[j].shape)
|
||||
y_d_rs.append(y_d_r)
|
||||
y_d_gs.append(y_d_g)
|
||||
fmap_rs.append(fmap_r)
|
||||
fmap_gs.append(fmap_g)
|
||||
|
||||
return y_d_rs, y_d_gs, fmap_rs, fmap_gs
|
||||
|
||||
|
||||
class DiscriminatorS(torch.nn.Module):
|
||||
def __init__(self, use_spectral_norm=False):
|
||||
super(DiscriminatorS, self).__init__()
|
||||
|
||||
BIN
logs/mute/3_feature768/mute.npy
Normal file
BIN
logs/mute/3_feature768/mute.npy
Normal file
Binary file not shown.
2
pretrained_v2/.gitignore
vendored
Normal file
2
pretrained_v2/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
*
|
||||
!.gitignore
|
||||
@@ -51,9 +51,9 @@ def spectrogram_torch(y, n_fft, sampling_rate, hop_size, win_size, center=False)
|
||||
:: (B, Freq, Frame) - Linear-frequency Linear-amplitude spectrogram
|
||||
"""
|
||||
# Validation
|
||||
if torch.min(y) < -1.0:
|
||||
if torch.min(y) < -1.07:
|
||||
print("min value is ", torch.min(y))
|
||||
if torch.max(y) > 1.0:
|
||||
if torch.max(y) > 1.07:
|
||||
print("max value is ", torch.max(y))
|
||||
|
||||
# Window - Cache if needed
|
||||
|
||||
@@ -2,7 +2,7 @@ import torch, traceback, os, pdb
|
||||
from collections import OrderedDict
|
||||
|
||||
|
||||
def savee(ckpt, sr, if_f0, name, epoch):
|
||||
def savee(ckpt, sr, if_f0, name, epoch, version):
|
||||
try:
|
||||
opt = OrderedDict()
|
||||
opt["weight"] = {}
|
||||
@@ -76,6 +76,7 @@ def savee(ckpt, sr, if_f0, name, epoch):
|
||||
opt["info"] = "%sepoch" % epoch
|
||||
opt["sr"] = sr
|
||||
opt["f0"] = if_f0
|
||||
opt["version"] = version
|
||||
torch.save(opt, "weights/%s.pth" % name)
|
||||
return "Success."
|
||||
except:
|
||||
@@ -85,16 +86,17 @@ def savee(ckpt, sr, if_f0, name, epoch):
|
||||
def show_info(path):
|
||||
try:
|
||||
a = torch.load(path, map_location="cpu")
|
||||
return "模型信息:%s\n采样率:%s\n模型是否输入音高引导:%s" % (
|
||||
return "模型信息:%s\n采样率:%s\n模型是否输入音高引导:%s\n版本:%s" % (
|
||||
a.get("info", "None"),
|
||||
a.get("sr", "None"),
|
||||
a.get("f0", "None"),
|
||||
a.get("version", "None"),
|
||||
)
|
||||
except:
|
||||
return traceback.format_exc()
|
||||
|
||||
|
||||
def extract_small_model(path, name, sr, if_f0, info):
|
||||
def extract_small_model(path, name, sr, if_f0, info, version):
|
||||
try:
|
||||
ckpt = torch.load(path, map_location="cpu")
|
||||
if "model" in ckpt:
|
||||
@@ -171,6 +173,7 @@ def extract_small_model(path, name, sr, if_f0, info):
|
||||
if info == "":
|
||||
info = "Extracted model."
|
||||
opt["info"] = info
|
||||
opt["version"] = version
|
||||
opt["sr"] = sr
|
||||
opt["f0"] = int(if_f0)
|
||||
torch.save(opt, "weights/%s.pth" % name)
|
||||
@@ -191,7 +194,7 @@ def change_info(path, info, name):
|
||||
return traceback.format_exc()
|
||||
|
||||
|
||||
def merge(path1, path2, alpha1, sr, f0, info, name):
|
||||
def merge(path1, path2, alpha1, sr, f0, info, name, version):
|
||||
try:
|
||||
|
||||
def extract(ckpt):
|
||||
@@ -241,6 +244,7 @@ def merge(path1, path2, alpha1, sr, f0, info, name):
|
||||
"""
|
||||
opt["sr"] = sr
|
||||
opt["f0"] = 1 if f0 == "是" else 0
|
||||
opt["version"] = version
|
||||
opt["info"] = info
|
||||
torch.save(opt, "weights/%s.pth" % name)
|
||||
return "Success."
|
||||
|
||||
@@ -284,8 +284,8 @@ def get_hparams(init=True):
|
||||
bs done
|
||||
pretrainG、pretrainD done
|
||||
卡号:os.en["CUDA_VISIBLE_DEVICES"] done
|
||||
if_latest todo
|
||||
模型:if_f0 todo
|
||||
if_latest done
|
||||
模型:if_f0 done
|
||||
采样率:自动选择config done
|
||||
是否缓存数据集进GPU:if_cache_data_in_gpu done
|
||||
|
||||
@@ -321,6 +321,16 @@ def get_hparams(init=True):
|
||||
parser.add_argument(
|
||||
"-sr", "--sample_rate", type=str, required=True, help="sample rate, 32k/40k/48k"
|
||||
)
|
||||
parser.add_argument(
|
||||
"-sw",
|
||||
"--save_every_weights",
|
||||
type=str,
|
||||
default="0",
|
||||
help="save the extracted model in weights directory when saving checkpoints",
|
||||
)
|
||||
parser.add_argument(
|
||||
"-v", "--version", type=str, required=True, help="model version"
|
||||
)
|
||||
parser.add_argument(
|
||||
"-f0",
|
||||
"--if_f0",
|
||||
@@ -369,11 +379,13 @@ def get_hparams(init=True):
|
||||
hparams.total_epoch = args.total_epoch
|
||||
hparams.pretrainG = args.pretrainG
|
||||
hparams.pretrainD = args.pretrainD
|
||||
hparams.version = args.version
|
||||
hparams.gpus = args.gpus
|
||||
hparams.train.batch_size = args.batch_size
|
||||
hparams.sample_rate = args.sample_rate
|
||||
hparams.if_f0 = args.if_f0
|
||||
hparams.if_latest = args.if_latest
|
||||
hparams.save_every_weights = args.save_every_weights
|
||||
hparams.if_cache_data_in_gpu = args.if_cache_data_in_gpu
|
||||
hparams.data.training_files = "%s/filelist.txt" % experiment_dir
|
||||
return hparams
|
||||
|
||||
@@ -31,14 +31,22 @@ from data_utils import (
|
||||
TextAudioCollate,
|
||||
DistributedBucketSampler,
|
||||
)
|
||||
from infer_pack.models import (
|
||||
SynthesizerTrnMs256NSFsid,
|
||||
SynthesizerTrnMs256NSFsid_nono,
|
||||
MultiPeriodDiscriminator,
|
||||
)
|
||||
|
||||
if hps.version == "v1":
|
||||
from infer_pack.models import (
|
||||
SynthesizerTrnMs256NSFsid as RVC_Model_f0,
|
||||
SynthesizerTrnMs256NSFsid_nono as RVC_Model_nof0,
|
||||
MultiPeriodDiscriminator,
|
||||
)
|
||||
else:
|
||||
from infer_pack.models import (
|
||||
SynthesizerTrnMs768NSFsid as RVC_Model_f0,
|
||||
SynthesizerTrnMs768NSFsid_nono as RVC_Model_nof0,
|
||||
MultiPeriodDiscriminatorV2 as MultiPeriodDiscriminator,
|
||||
)
|
||||
from losses import generator_loss, discriminator_loss, feature_loss, kl_loss
|
||||
from mel_processing import mel_spectrogram_torch, spec_to_mel_torch
|
||||
|
||||
from process_ckpt import savee
|
||||
|
||||
global_step = 0
|
||||
|
||||
@@ -63,7 +71,7 @@ def run(rank, n_gpus, hps):
|
||||
if rank == 0:
|
||||
logger = utils.get_logger(hps.model_dir)
|
||||
logger.info(hps)
|
||||
utils.check_git_hash(hps.model_dir)
|
||||
# utils.check_git_hash(hps.model_dir)
|
||||
writer = SummaryWriter(log_dir=hps.model_dir)
|
||||
writer_eval = SummaryWriter(log_dir=os.path.join(hps.model_dir, "eval"))
|
||||
|
||||
@@ -104,7 +112,7 @@ def run(rank, n_gpus, hps):
|
||||
prefetch_factor=8,
|
||||
)
|
||||
if hps.if_f0 == 1:
|
||||
net_g = SynthesizerTrnMs256NSFsid(
|
||||
net_g = RVC_Model_f0(
|
||||
hps.data.filter_length // 2 + 1,
|
||||
hps.train.segment_size // hps.data.hop_length,
|
||||
**hps.model,
|
||||
@@ -112,7 +120,7 @@ def run(rank, n_gpus, hps):
|
||||
sr=hps.sample_rate,
|
||||
)
|
||||
else:
|
||||
net_g = SynthesizerTrnMs256NSFsid_nono(
|
||||
net_g = RVC_Model_nof0(
|
||||
hps.data.filter_length // 2 + 1,
|
||||
hps.train.segment_size // hps.data.hop_length,
|
||||
**hps.model,
|
||||
@@ -343,7 +351,7 @@ def train_and_evaluate(
|
||||
spec = spec.cuda(rank, non_blocking=True)
|
||||
spec_lengths = spec_lengths.cuda(rank, non_blocking=True)
|
||||
wave = wave.cuda(rank, non_blocking=True)
|
||||
wave_lengths = wave_lengths.cuda(rank, non_blocking=True)
|
||||
# wave_lengths = wave_lengths.cuda(rank, non_blocking=True)
|
||||
|
||||
# Calculate
|
||||
with autocast(enabled=hps.train.fp16_run):
|
||||
@@ -428,10 +436,10 @@ def train_and_evaluate(
|
||||
)
|
||||
)
|
||||
# Amor For Tensorboard display
|
||||
if loss_mel > 50:
|
||||
loss_mel = 50
|
||||
if loss_kl > 5:
|
||||
loss_kl = 5
|
||||
if loss_mel > 75:
|
||||
loss_mel = 75
|
||||
if loss_kl > 9:
|
||||
loss_kl = 9
|
||||
|
||||
logger.info([global_step, lr])
|
||||
logger.info(
|
||||
@@ -512,12 +520,31 @@ def train_and_evaluate(
|
||||
epoch,
|
||||
os.path.join(hps.model_dir, "D_{}.pth".format(2333333)),
|
||||
)
|
||||
if rank == 0 and hps.save_every_weights == "1":
|
||||
if hasattr(net_g, "module"):
|
||||
ckpt = net_g.module.state_dict()
|
||||
else:
|
||||
ckpt = net_g.state_dict()
|
||||
logger.info(
|
||||
"saving ckpt %s_e%s:%s"
|
||||
% (
|
||||
hps.name,
|
||||
epoch,
|
||||
savee(
|
||||
ckpt,
|
||||
hps.sample_rate,
|
||||
hps.if_f0,
|
||||
hps.name + "_e%s" % epoch,
|
||||
epoch,
|
||||
hps.version,
|
||||
),
|
||||
)
|
||||
)
|
||||
|
||||
if rank == 0:
|
||||
logger.info("====> Epoch: {}".format(epoch))
|
||||
if epoch >= hps.total_epoch and rank == 0:
|
||||
logger.info("Training is done. The program is closed.")
|
||||
from process_ckpt import savee # def savee(ckpt,sr,if_f0,name,epoch):
|
||||
|
||||
if hasattr(net_g, "module"):
|
||||
ckpt = net_g.module.state_dict()
|
||||
@@ -525,7 +552,7 @@ def train_and_evaluate(
|
||||
ckpt = net_g.state_dict()
|
||||
logger.info(
|
||||
"saving final ckpt:%s"
|
||||
% (savee(ckpt, hps.sample_rate, hps.if_f0, hps.name, epoch))
|
||||
% (savee(ckpt, hps.sample_rate, hps.if_f0, hps.name, epoch, hps.version))
|
||||
)
|
||||
sleep(1)
|
||||
os._exit(2333333)
|
||||
|
||||
@@ -32,19 +32,19 @@ class PreProcess:
|
||||
def __init__(self, sr, exp_dir):
|
||||
self.slicer = Slicer(
|
||||
sr=sr,
|
||||
threshold=-40,
|
||||
min_length=800,
|
||||
threshold=-42,
|
||||
min_length=1500,
|
||||
min_interval=400,
|
||||
hop_size=15,
|
||||
max_sil_kept=150,
|
||||
max_sil_kept=500,
|
||||
)
|
||||
self.sr = sr
|
||||
self.bh, self.ah = signal.butter(N=5, Wn=48, btype="high", fs=self.sr)
|
||||
self.per = 3.7
|
||||
self.overlap = 0.3
|
||||
self.tail = self.per + self.overlap
|
||||
self.max = 0.95
|
||||
self.alpha = 0.8
|
||||
self.max = 0.9
|
||||
self.alpha = 0.75
|
||||
self.exp_dir = exp_dir
|
||||
self.gt_wavs_dir = "%s/0_gt_wavs" % exp_dir
|
||||
self.wavs16k_dir = "%s/1_16k_wavs" % exp_dir
|
||||
|
||||
@@ -26,6 +26,28 @@ def cache_harvest_f0(input_audio_path, fs, f0max, f0min, frame_period):
|
||||
return f0
|
||||
|
||||
|
||||
def change_rms(data1, sr1, data2, sr2, rate): # 1是输入音频,2是输出音频,rate是2的占比
|
||||
# print(data1.max(),data2.max())
|
||||
rms1 = librosa.feature.rms(
|
||||
y=data1, frame_length=sr1 // 2 * 2, hop_length=sr1 // 2
|
||||
) # 每半秒一个点
|
||||
rms2 = librosa.feature.rms(y=data2, frame_length=sr2 // 2 * 2, hop_length=sr2 // 2)
|
||||
rms1 = torch.from_numpy(rms1)
|
||||
rms1 = F.interpolate(
|
||||
rms1.unsqueeze(0), size=data2.shape[0], mode="linear"
|
||||
).squeeze()
|
||||
rms2 = torch.from_numpy(rms2)
|
||||
rms2 = F.interpolate(
|
||||
rms2.unsqueeze(0), size=data2.shape[0], mode="linear"
|
||||
).squeeze()
|
||||
rms2 = torch.max(rms2, torch.zeros_like(rms2) + 1e-6)
|
||||
data2 *= (
|
||||
torch.pow(rms1, torch.tensor(1 - rate))
|
||||
* torch.pow(rms2, torch.tensor(rate - 1))
|
||||
).numpy()
|
||||
return data2
|
||||
|
||||
|
||||
class VC(object):
|
||||
def __init__(self, tgt_sr, config):
|
||||
self.x_pad, self.x_query, self.x_center, self.x_max, self.is_half = (
|
||||
@@ -178,6 +200,7 @@ class VC(object):
|
||||
index,
|
||||
big_npy,
|
||||
index_rate,
|
||||
version,
|
||||
): # ,file_index,file_big_npy
|
||||
feats = torch.from_numpy(audio0)
|
||||
if self.is_half:
|
||||
@@ -193,12 +216,12 @@ class VC(object):
|
||||
inputs = {
|
||||
"source": feats.to(self.device),
|
||||
"padding_mask": padding_mask,
|
||||
"output_layer": 9, # layer 9
|
||||
"output_layer": 9 if version == "v1" else 12,
|
||||
}
|
||||
t0 = ttime()
|
||||
with torch.no_grad():
|
||||
logits = model.extract_features(**inputs)
|
||||
feats = model.final_proj(logits[0])
|
||||
feats = model.final_proj(logits[0]) if version == "v1" else logits[0]
|
||||
|
||||
if (
|
||||
isinstance(index, type(None)) == False
|
||||
@@ -236,17 +259,14 @@ class VC(object):
|
||||
with torch.no_grad():
|
||||
if pitch != None and pitchf != None:
|
||||
audio1 = (
|
||||
(net_g.infer(feats, p_len, pitch, pitchf, sid)[0][0, 0] * 32768)
|
||||
(net_g.infer(feats, p_len, pitch, pitchf, sid)[0][0, 0])
|
||||
.data.cpu()
|
||||
.float()
|
||||
.numpy()
|
||||
)
|
||||
else:
|
||||
audio1 = (
|
||||
(net_g.infer(feats, p_len, sid)[0][0, 0] * 32768)
|
||||
.data.cpu()
|
||||
.float()
|
||||
.numpy()
|
||||
(net_g.infer(feats, p_len, sid)[0][0, 0]).data.cpu().float().numpy()
|
||||
)
|
||||
del feats, p_len, padding_mask
|
||||
if torch.cuda.is_available():
|
||||
@@ -273,6 +293,8 @@ class VC(object):
|
||||
filter_radius,
|
||||
tgt_sr,
|
||||
resample_sr,
|
||||
rms_mix_rate,
|
||||
version,
|
||||
crepe_hop_length,
|
||||
f0_file=None,
|
||||
):
|
||||
@@ -361,6 +383,7 @@ class VC(object):
|
||||
index,
|
||||
big_npy,
|
||||
index_rate,
|
||||
version,
|
||||
)[self.t_pad_tgt : -self.t_pad_tgt]
|
||||
)
|
||||
else:
|
||||
@@ -376,6 +399,7 @@ class VC(object):
|
||||
index,
|
||||
big_npy,
|
||||
index_rate,
|
||||
version,
|
||||
)[self.t_pad_tgt : -self.t_pad_tgt]
|
||||
)
|
||||
s = t
|
||||
@@ -392,6 +416,7 @@ class VC(object):
|
||||
index,
|
||||
big_npy,
|
||||
index_rate,
|
||||
version,
|
||||
)[self.t_pad_tgt : -self.t_pad_tgt]
|
||||
)
|
||||
else:
|
||||
@@ -407,14 +432,21 @@ class VC(object):
|
||||
index,
|
||||
big_npy,
|
||||
index_rate,
|
||||
version,
|
||||
)[self.t_pad_tgt : -self.t_pad_tgt]
|
||||
)
|
||||
audio_opt = np.concatenate(audio_opt)
|
||||
if rms_mix_rate != 1:
|
||||
audio_opt = change_rms(audio, 16000, audio_opt, tgt_sr, rms_mix_rate)
|
||||
if resample_sr >= 16000 and tgt_sr != resample_sr:
|
||||
audio_opt = librosa.resample(
|
||||
audio_opt, orig_sr=tgt_sr, target_sr=resample_sr
|
||||
)
|
||||
audio_opt = audio_opt.astype(np.int16)
|
||||
audio_max = np.abs(audio_opt).max() / 0.99
|
||||
max_int16 = 32768
|
||||
if audio_max > 1:
|
||||
max_int16 /= audio_max
|
||||
audio_opt = (audio_opt * max_int16).astype(np.int16)
|
||||
del pitch, pitchf, sid
|
||||
if torch.cuda.is_available():
|
||||
torch.cuda.empty_cache()
|
||||
|
||||
Reference in New Issue
Block a user