mirror of
https://github.com/svc-develop-team/so-vits-svc.git
synced 2025-01-08 11:57:43 +08:00
chore: make Ruff happy
This commit is contained in:
parent
fab65746d6
commit
4ae070bb77
@ -1,4 +1,4 @@
|
|||||||
select = ["E", "F", "I"]
|
select = ["E", "F", "I"]
|
||||||
|
|
||||||
# Never enforce `E501` (line length violations).
|
# Never enforce `E501` (line length violations).
|
||||||
ignore = ["E501"]
|
ignore = ["E501", "E741"]
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import torch
|
|
||||||
import torch.nn as nn
|
import torch.nn as nn
|
||||||
from torch.nn.utils import weight_norm, remove_weight_norm
|
from torch.nn.utils import remove_weight_norm, weight_norm
|
||||||
|
|
||||||
|
|
||||||
class Depthwise_Separable_Conv1D(nn.Module):
|
class Depthwise_Separable_Conv1D(nn.Module):
|
||||||
def __init__(
|
def __init__(
|
||||||
|
@ -53,7 +53,9 @@ def spectrogram_torch(y, n_fft, sampling_rate, hop_size, win_size, center=False)
|
|||||||
y = y.squeeze(1)
|
y = y.squeeze(1)
|
||||||
|
|
||||||
y_dtype = y.dtype
|
y_dtype = y.dtype
|
||||||
if y.dtype == torch.bfloat16: y = y.to(torch.float32)
|
if y.dtype == torch.bfloat16:
|
||||||
|
y = y.to(torch.float32)
|
||||||
|
|
||||||
spec = torch.stft(y, n_fft, hop_length=hop_size, win_length=win_size, window=hann_window[wnsize_dtype_device],
|
spec = torch.stft(y, n_fft, hop_length=hop_size, win_length=win_size, window=hann_window[wnsize_dtype_device],
|
||||||
center=center, pad_mode='reflect', normalized=False, onesided=True, return_complex=True)
|
center=center, pad_mode='reflect', normalized=False, onesided=True, return_complex=True)
|
||||||
spec = torch.view_as_real(spec).to(y_dtype)
|
spec = torch.view_as_real(spec).to(y_dtype)
|
||||||
|
@ -1,12 +1,14 @@
|
|||||||
import torch
|
import torch
|
||||||
from torch import nn
|
from torch import nn
|
||||||
from torch.nn import Conv1d
|
|
||||||
from torch.nn import functional as F
|
from torch.nn import functional as F
|
||||||
|
|
||||||
from modules.DSConv import weight_norm_modules, remove_weight_norm_modules, Depthwise_Separable_Conv1D
|
|
||||||
|
|
||||||
import modules.commons as commons
|
import modules.commons as commons
|
||||||
from modules.commons import init_weights, get_padding
|
from modules.commons import get_padding, init_weights
|
||||||
|
from modules.DSConv import (
|
||||||
|
Depthwise_Separable_Conv1D,
|
||||||
|
remove_weight_norm_modules,
|
||||||
|
weight_norm_modules,
|
||||||
|
)
|
||||||
|
|
||||||
LRELU_SLOPE = 0.1
|
LRELU_SLOPE = 0.1
|
||||||
|
|
||||||
|
12
webUI.py
12
webUI.py
@ -6,6 +6,7 @@ import subprocess
|
|||||||
import time
|
import time
|
||||||
import traceback
|
import traceback
|
||||||
from itertools import chain
|
from itertools import chain
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
# os.system("wget -P cvec/ https://huggingface.co/spaces/innnky/nanami/resolve/main/checkpoint_best_legacy_500.pt")
|
# os.system("wget -P cvec/ https://huggingface.co/spaces/innnky/nanami/resolve/main/checkpoint_best_legacy_500.pt")
|
||||||
import gradio as gr
|
import gradio as gr
|
||||||
@ -15,7 +16,6 @@ import numpy as np
|
|||||||
import soundfile
|
import soundfile
|
||||||
import torch
|
import torch
|
||||||
from scipy.io import wavfile
|
from scipy.io import wavfile
|
||||||
from pathlib import Path
|
|
||||||
|
|
||||||
from compress_model import removeOptimizer
|
from compress_model import removeOptimizer
|
||||||
from inference.infer_tool import Svc
|
from inference.infer_tool import Svc
|
||||||
@ -172,14 +172,18 @@ def vc_fn(sid, input_audio, output_format, vc_transform, auto_f0,cluster_ratio,
|
|||||||
model.clear_empty()
|
model.clear_empty()
|
||||||
#os.remove(temp_path)
|
#os.remove(temp_path)
|
||||||
#构建保存文件的路径,并保存到results文件夹内
|
#构建保存文件的路径,并保存到results文件夹内
|
||||||
timestamp = str(int(time.time()))
|
str(int(time.time()))
|
||||||
if not os.path.exists("results"):
|
if not os.path.exists("results"):
|
||||||
os.makedirs("results")
|
os.makedirs("results")
|
||||||
key = "auto" if auto_f0 else f"{int(vc_transform)}key"
|
key = "auto" if auto_f0 else f"{int(vc_transform)}key"
|
||||||
cluster = "_" if cluster_ratio == 0 else f"_{cluster_ratio}_"
|
cluster = "_" if cluster_ratio == 0 else f"_{cluster_ratio}_"
|
||||||
isdiffusion = "sovits"
|
isdiffusion = "sovits"
|
||||||
if model.shallow_diffusion : isdiffusion = "sovdiff"
|
if model.shallow_diffusion:
|
||||||
if model.only_diffusion : isdiffusion = "diff"
|
isdiffusion = "sovdiff"
|
||||||
|
|
||||||
|
if model.only_diffusion:
|
||||||
|
isdiffusion = "diff"
|
||||||
|
|
||||||
output_file_name = 'result_'+truncated_basename+f'_{sid}_{key}{cluster}{isdiffusion}.{output_format}'
|
output_file_name = 'result_'+truncated_basename+f'_{sid}_{key}{cluster}{isdiffusion}.{output_format}'
|
||||||
output_file = os.path.join("results", output_file_name)
|
output_file = os.path.join("results", output_file_name)
|
||||||
soundfile.write(output_file, _audio, model.target_sample, format=output_format)
|
soundfile.write(output_file, _audio, model.target_sample, format=output_format)
|
||||||
|
Loading…
Reference in New Issue
Block a user