mirror of
https://github.com/RVC-Project/Retrieval-based-Voice-Conversion-WebUI.git
synced 2025-04-04 03:38:58 +08:00
Remove unused imports
This commit is contained in:
parent
322638d597
commit
43c294bd47
@ -7,17 +7,11 @@ sys.path.append(now_dir)
|
||||
load_dotenv()
|
||||
from infer.modules.vc.modules import VC
|
||||
from configs.config import Config
|
||||
from sklearn.cluster import MiniBatchKMeans
|
||||
import torch, platform
|
||||
import numpy as np
|
||||
import torch
|
||||
import gradio as gr
|
||||
import faiss
|
||||
import fairseq
|
||||
import pathlib
|
||||
import json
|
||||
from time import sleep
|
||||
from subprocess import Popen
|
||||
from random import shuffle
|
||||
import warnings
|
||||
import traceback
|
||||
import threading
|
||||
|
@ -2,7 +2,6 @@ import platform, os
|
||||
import ffmpeg
|
||||
import numpy as np
|
||||
import av
|
||||
from io import BytesIO
|
||||
import traceback
|
||||
import re
|
||||
|
||||
|
@ -1,13 +1,11 @@
|
||||
import copy
|
||||
import math
|
||||
from typing import Optional
|
||||
|
||||
import numpy as np
|
||||
import torch
|
||||
from torch import nn
|
||||
from torch.nn import functional as F
|
||||
|
||||
from infer.lib.infer_pack import commons, modules
|
||||
from infer.lib.infer_pack import commons
|
||||
from infer.lib.infer_pack.modules import LayerNorm
|
||||
|
||||
|
||||
|
@ -6,16 +6,14 @@
|
||||
# Do Not Use All Of Non-Torch Types! #
|
||||
# #
|
||||
############################## Warning! ##############################
|
||||
import copy
|
||||
import math
|
||||
from typing import Optional
|
||||
|
||||
import numpy as np
|
||||
import torch
|
||||
from torch import nn
|
||||
from torch.nn import functional as F
|
||||
|
||||
from infer.lib.infer_pack import commons, modules
|
||||
from infer.lib.infer_pack import commons
|
||||
from infer.lib.infer_pack.modules import LayerNorm
|
||||
|
||||
|
||||
|
@ -1,9 +1,7 @@
|
||||
from typing import List, Optional
|
||||
import math
|
||||
|
||||
import numpy as np
|
||||
import torch
|
||||
from torch import nn
|
||||
from torch.nn import functional as F
|
||||
|
||||
|
||||
|
@ -7,7 +7,7 @@ logger = logging.getLogger(__name__)
|
||||
import numpy as np
|
||||
import torch
|
||||
from torch import nn
|
||||
from torch.nn import AvgPool1d, Conv1d, Conv2d, ConvTranspose1d
|
||||
from torch.nn import Conv1d, Conv2d, ConvTranspose1d
|
||||
from torch.nn import functional as F
|
||||
from torch.nn.utils import remove_weight_norm, spectral_norm, weight_norm
|
||||
from infer.lib.infer_pack import attentions, commons, modules
|
||||
|
@ -15,7 +15,7 @@ logger = logging.getLogger(__name__)
|
||||
import numpy as np
|
||||
import torch
|
||||
from torch import nn
|
||||
from torch.nn import AvgPool1d, Conv1d, Conv2d, ConvTranspose1d
|
||||
from torch.nn import Conv1d, Conv2d, ConvTranspose1d
|
||||
from torch.nn import functional as F
|
||||
from torch.nn.utils import remove_weight_norm, spectral_norm, weight_norm
|
||||
|
||||
|
@ -1,12 +1,9 @@
|
||||
import copy
|
||||
import math
|
||||
from typing import Optional, Tuple
|
||||
|
||||
import numpy as np
|
||||
import scipy
|
||||
import torch
|
||||
from torch import nn
|
||||
from torch.nn import AvgPool1d, Conv1d, Conv2d, ConvTranspose1d
|
||||
from torch.nn import Conv1d
|
||||
from torch.nn import functional as F
|
||||
from torch.nn.utils import remove_weight_norm, weight_norm
|
||||
|
||||
|
@ -5,7 +5,6 @@ class F0Predictor(object):
|
||||
p_len:int
|
||||
output: f0:[signal_length//hop_length]
|
||||
"""
|
||||
pass
|
||||
|
||||
def compute_f0_uv(self, wav, p_len):
|
||||
"""
|
||||
@ -13,4 +12,3 @@ class F0Predictor(object):
|
||||
p_len:int
|
||||
output: f0:[signal_length//hop_length],uv:[signal_length//hop_length]
|
||||
"""
|
||||
pass
|
||||
|
@ -1,7 +1,6 @@
|
||||
import librosa
|
||||
import numpy as np
|
||||
import onnxruntime
|
||||
import soundfile
|
||||
|
||||
import logging
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
from io import BytesIO
|
||||
import os
|
||||
from typing import List, Optional, Tuple
|
||||
from typing import List
|
||||
import numpy as np
|
||||
import torch
|
||||
|
||||
@ -18,7 +18,7 @@ except Exception: # pylint: disable=broad-exception-caught
|
||||
pass
|
||||
import torch.nn as nn
|
||||
import torch.nn.functional as F
|
||||
from librosa.util import normalize, pad_center, tiny
|
||||
from librosa.util import pad_center
|
||||
from scipy.signal import get_window
|
||||
|
||||
import logging
|
||||
|
@ -1,5 +1,4 @@
|
||||
import json
|
||||
import os
|
||||
import pathlib
|
||||
|
||||
default_param = {}
|
||||
|
@ -3,7 +3,6 @@ import torch
|
||||
import torch.nn.functional as F
|
||||
from torch import nn
|
||||
|
||||
from . import spec_utils
|
||||
|
||||
|
||||
class BaseASPPNet(nn.Module):
|
||||
|
@ -1,4 +1,3 @@
|
||||
import numpy as np
|
||||
import torch
|
||||
import torch.nn.functional as F
|
||||
from torch import nn
|
||||
|
@ -1,4 +1,3 @@
|
||||
import numpy as np
|
||||
import torch
|
||||
import torch.nn.functional as F
|
||||
from torch import nn
|
||||
|
@ -528,7 +528,6 @@ def istft(spec, hl):
|
||||
|
||||
if __name__ == "__main__":
|
||||
import argparse
|
||||
import sys
|
||||
import time
|
||||
|
||||
import cv2
|
||||
|
@ -2,14 +2,12 @@ import os
|
||||
import sys
|
||||
import traceback
|
||||
|
||||
import parselmouth
|
||||
|
||||
now_dir = os.getcwd()
|
||||
sys.path.append(now_dir)
|
||||
import logging
|
||||
|
||||
import numpy as np
|
||||
import pyworld
|
||||
|
||||
from infer.lib.audio import load_audio
|
||||
|
||||
|
@ -2,14 +2,12 @@ import os
|
||||
import sys
|
||||
import traceback
|
||||
|
||||
import parselmouth
|
||||
|
||||
now_dir = os.getcwd()
|
||||
sys.path.append(now_dir)
|
||||
import logging
|
||||
|
||||
import numpy as np
|
||||
import pyworld
|
||||
|
||||
from infer.lib.audio import load_audio
|
||||
|
||||
|
29
poetry.lock
generated
29
poetry.lock
generated
@ -239,6 +239,21 @@ files = [
|
||||
[package.extras]
|
||||
test = ["tox"]
|
||||
|
||||
[[package]]
|
||||
name = "autoflake"
|
||||
version = "2.3.1"
|
||||
description = "Removes unused imports and unused variables"
|
||||
optional = false
|
||||
python-versions = ">=3.8"
|
||||
groups = ["main"]
|
||||
files = [
|
||||
{file = "autoflake-2.3.1-py3-none-any.whl", hash = "sha256:3ae7495db9084b7b32818b4140e6dc4fc280b712fb414f5b8fe57b0a8e85a840"},
|
||||
{file = "autoflake-2.3.1.tar.gz", hash = "sha256:c98b75dc5b0a86459c4f01a1d32ac7eb4338ec4317a4469515ff1e687ecd909e"},
|
||||
]
|
||||
|
||||
[package.dependencies]
|
||||
pyflakes = ">=3.0.0"
|
||||
|
||||
[[package]]
|
||||
name = "av"
|
||||
version = "12.3.0"
|
||||
@ -3189,6 +3204,18 @@ files = [
|
||||
{file = "pydub-0.25.1.tar.gz", hash = "sha256:980a33ce9949cab2a569606b65674d748ecbca4f0796887fd6f46173a7b0d30f"},
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pyflakes"
|
||||
version = "3.2.0"
|
||||
description = "passive checker of Python programs"
|
||||
optional = false
|
||||
python-versions = ">=3.8"
|
||||
groups = ["main"]
|
||||
files = [
|
||||
{file = "pyflakes-3.2.0-py2.py3-none-any.whl", hash = "sha256:84b5be138a2dfbb40689ca07e2152deb896a65c3a3e24c251c5c62489568074a"},
|
||||
{file = "pyflakes-3.2.0.tar.gz", hash = "sha256:1c61603ff154621fb2a9172037d84dca3500def8c8b630657d1701f026f8af3f"},
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pygments"
|
||||
version = "2.18.0"
|
||||
@ -4545,4 +4572,4 @@ multidict = ">=4.0"
|
||||
[metadata]
|
||||
lock-version = "2.1"
|
||||
python-versions = ">=3.11,<3.12"
|
||||
content-hash = "e8a01f5b9b6ce9748c030a0366ebcda95bcd7dc4325ac501634230bacb9f0f11"
|
||||
content-hash = "5ef0f447e5d31988bef98d041d4d80a69fa118d05ac27c1a5cbe1e8d3cb5c8f1"
|
||||
|
@ -52,6 +52,9 @@ torchaudio = "2.4.1"
|
||||
torch-directml = "^0.2.5.dev240914"
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
# Depndenciees for temp_tools
|
||||
autoflake = "^2.3.1"
|
||||
|
||||
[tool.poetry.group.dev.dependencies]
|
||||
# Add any development dependencies here
|
||||
|
||||
|
32
temp_tools/remove_unused_imports.py
Normal file
32
temp_tools/remove_unused_imports.py
Normal file
@ -0,0 +1,32 @@
|
||||
import os
|
||||
import subprocess
|
||||
|
||||
def process_file(file_path):
|
||||
"""
|
||||
Run autoflake on the file to remove unused imports in-place.
|
||||
"""
|
||||
try:
|
||||
# The --in-place option modifies the file, and
|
||||
# --remove-all-unused-imports removes unused imports.
|
||||
subprocess.run(
|
||||
["autoflake", "--in-place", "--remove-all-unused-imports", file_path],
|
||||
check=True
|
||||
)
|
||||
print(f"Processed: {file_path}")
|
||||
except subprocess.CalledProcessError as e:
|
||||
print(f"Error processing {file_path}: {e}")
|
||||
|
||||
def process_directory(root_dir):
|
||||
"""
|
||||
Walk recursively through root_dir and process all .py files.
|
||||
"""
|
||||
for dirpath, _, filenames in os.walk(root_dir):
|
||||
for filename in filenames:
|
||||
if filename.endswith(".py"):
|
||||
file_path = os.path.join(dirpath, filename)
|
||||
process_file(file_path)
|
||||
|
||||
if __name__ == '__main__':
|
||||
# Start from the current directory (you can change this to your project root)
|
||||
project_root = os.getcwd()
|
||||
process_directory(project_root)
|
@ -1,4 +1,3 @@
|
||||
import os
|
||||
import requests
|
||||
import zipfile
|
||||
import argparse
|
||||
|
@ -1,4 +1,3 @@
|
||||
import pdb
|
||||
|
||||
import torch
|
||||
|
||||
|
@ -10,4 +10,3 @@ torchgate imports all the functions from PyTorch, and in addition provides:
|
||||
|
||||
"""
|
||||
|
||||
from .torchgate import TorchGate
|
||||
|
Loading…
x
Reference in New Issue
Block a user