Skip to content

Commit f557072

Browse files
committed
chore: make Ruff happy
1 parent bf543d2 commit f557072

File tree

5 files changed

+20
-12
lines changed

5 files changed

+20
-12
lines changed

.ruff.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
select = ["E", "F", "I"]
22

33
# Never enforce `E501` (line length violations).
4-
ignore = ["E501"]
4+
ignore = ["E501", "E741"]

modules/DSConv.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import torch
21
import torch.nn as nn
3-
from torch.nn.utils import weight_norm, remove_weight_norm
2+
from torch.nn.utils import remove_weight_norm, weight_norm
3+
44

55
class Depthwise_Separable_Conv1D(nn.Module):
66
def __init__(

modules/mel_processing.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,9 @@ def spectrogram_torch(y, n_fft, sampling_rate, hop_size, win_size, center=False)
5353
y = y.squeeze(1)
5454

5555
y_dtype = y.dtype
56-
if y.dtype == torch.bfloat16: y = y.to(torch.float32)
56+
if y.dtype == torch.bfloat16:
57+
y = y.to(torch.float32)
58+
5759
spec = torch.stft(y, n_fft, hop_length=hop_size, win_length=win_size, window=hann_window[wnsize_dtype_device],
5860
center=center, pad_mode='reflect', normalized=False, onesided=True, return_complex=True)
5961
spec = torch.view_as_real(spec).to(y_dtype)

modules/modules.py

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
import torch
22
from torch import nn
3-
from torch.nn import Conv1d
43
from torch.nn import functional as F
54

6-
from modules.DSConv import weight_norm_modules, remove_weight_norm_modules, Depthwise_Separable_Conv1D
7-
85
import modules.commons as commons
9-
from modules.commons import init_weights, get_padding
6+
from modules.commons import get_padding, init_weights
7+
from modules.DSConv import (
8+
Depthwise_Separable_Conv1D,
9+
remove_weight_norm_modules,
10+
weight_norm_modules,
11+
)
1012

1113
LRELU_SLOPE = 0.1
1214

webUI.py

+8-4
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import time
77
import traceback
88
from itertools import chain
9+
from pathlib import Path
910

1011
# os.system("wget -P cvec/ https://huggingface.co/spaces/innnky/nanami/resolve/main/checkpoint_best_legacy_500.pt")
1112
import gradio as gr
@@ -15,7 +16,6 @@
1516
import soundfile
1617
import torch
1718
from scipy.io import wavfile
18-
from pathlib import Path
1919

2020
from compress_model import removeOptimizer
2121
from inference.infer_tool import Svc
@@ -172,14 +172,18 @@ def vc_fn(sid, input_audio, output_format, vc_transform, auto_f0,cluster_ratio,
172172
model.clear_empty()
173173
#os.remove(temp_path)
174174
#构建保存文件的路径,并保存到results文件夹内
175-
timestamp = str(int(time.time()))
175+
str(int(time.time()))
176176
if not os.path.exists("results"):
177177
os.makedirs("results")
178178
key = "auto" if auto_f0 else f"{int(vc_transform)}key"
179179
cluster = "_" if cluster_ratio == 0 else f"_{cluster_ratio}_"
180180
isdiffusion = "sovits"
181-
if model.shallow_diffusion : isdiffusion = "sovdiff"
182-
if model.only_diffusion : isdiffusion = "diff"
181+
if model.shallow_diffusion:
182+
isdiffusion = "sovdiff"
183+
184+
if model.only_diffusion:
185+
isdiffusion = "diff"
186+
183187
output_file_name = 'result_'+truncated_basename+f'_{sid}_{key}{cluster}{isdiffusion}.{output_format}'
184188
output_file = os.path.join("results", output_file_name)
185189
soundfile.write(output_file, _audio, model.target_sample, format=output_format)

0 commit comments

Comments
 (0)