Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
aitronz committed Jul 4, 2024
1 parent fe21e93 commit 2238908
Show file tree
Hide file tree
Showing 9 changed files with 37 additions and 36 deletions.
29 changes: 14 additions & 15 deletions UVR/uvr/architectures/demucs_separator.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
from pathlib import Path
import torch
import numpy as np
from uvr.common_separator import CommonSeparator
from uvr.uvr_lib_v5.demucs.apply import apply_model, demucs_segments
from uvr.uvr_lib_v5.demucs.hdemucs import HDemucs
from uvr.uvr_lib_v5.demucs.pretrained import get_model as get_demucs_model
from uvr.uvr_lib_v5 import spec_utils
from tabs.plugins.installed.UVR.uvr.common_separator import CommonSeparator
from tabs.plugins.installed.UVR.uvr.uvr_lib_v5.demucs.apply import apply_model, demucs_segments
from tabs.plugins.installed.UVR.uvr.uvr_lib_v5.demucs.hdemucs import HDemucs
from tabs.plugins.installed.UVR.uvr.uvr_lib_v5.demucs.pretrained import get_model as get_demucs_model
from tabs.plugins.installed.UVR.uvr.uvr_lib_v5 import spec_utils

DEMUCS_4_SOURCE = ["drums", "bass", "other", "vocals"]

Expand Down Expand Up @@ -147,16 +147,15 @@ def separate(self, audio_file_path):
self.logger.debug(
f"Processing source array, source length is {source_length}"
)
match source_length:
case 2:
self.logger.debug("Setting source map to 2-stem...")
self.demucs_source_map = DEMUCS_2_SOURCE_MAPPER
case 6:
self.logger.debug("Setting source map to 6-stem...")
self.demucs_source_map = DEMUCS_6_SOURCE_MAPPER
case _:
self.logger.debug("Setting source map to 4-stem...")
self.demucs_source_map = DEMUCS_4_SOURCE_MAPPER
if source_length == 2:
self.logger.debug("Setting source map to 2-stem...")
self.demucs_source_map = DEMUCS_2_SOURCE_MAPPER
elif source_length == 6:
self.logger.debug("Setting source map to 6-stem...")
self.demucs_source_map = DEMUCS_6_SOURCE_MAPPER
else:
self.logger.debug("Setting source map to 4-stem...")
self.demucs_source_map = DEMUCS_4_SOURCE_MAPPER

self.logger.debug("Processing for all stems...")
for stem_name, stem_value in self.demucs_source_map.items():
Expand Down
8 changes: 4 additions & 4 deletions UVR/uvr/architectures/mdx_separator.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
import numpy as np
import onnx2torch
from tqdm import tqdm
from uvr.uvr_lib_v5 import spec_utils
from uvr.uvr_lib_v5.stft import STFT
from uvr.common_separator import CommonSeparator
from tabs.plugins.installed.UVR.uvr.uvr_lib_v5 import spec_utils
from tabs.plugins.installed.UVR.uvr.uvr_lib_v5.stft import STFT
from tabs.plugins.installed.UVR.uvr.common_separator import CommonSeparator


class MDXSeparator(CommonSeparator):
Expand Down Expand Up @@ -244,7 +244,7 @@ def separate(self, audio_file_path):
)
output_files.append(self.primary_stem_output_path)

# Not yet implemented from UVR features:
# Not yet implemented from tabs.plugins.installed.UVR.uvr features:
# self.process_vocal_split_chain(secondary_sources)
# self.logger.debug("Vocal split chain processed.")

Expand Down
10 changes: 5 additions & 5 deletions UVR/uvr/architectures/mdxc_separator.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
from ml_collections import ConfigDict
from scipy import signal

from uvr.common_separator import CommonSeparator
from uvr.uvr_lib_v5 import spec_utils
from uvr.uvr_lib_v5.tfc_tdf_v3 import TFC_TDF_net
from uvr.uvr_lib_v5.mel_band_roformer import MelBandRoformer
from uvr.uvr_lib_v5.bs_roformer import BSRoformer
from tabs.plugins.installed.UVR.uvr.common_separator import CommonSeparator
from tabs.plugins.installed.UVR.uvr.uvr_lib_v5 import spec_utils
from tabs.plugins.installed.UVR.uvr.uvr_lib_v5.tfc_tdf_v3 import TFC_TDF_net
from tabs.plugins.installed.UVR.uvr.uvr_lib_v5.mel_band_roformer import MelBandRoformer
from tabs.plugins.installed.UVR.uvr.uvr_lib_v5.bs_roformer import BSRoformer


class MDXCSeparator(CommonSeparator):
Expand Down
16 changes: 9 additions & 7 deletions UVR/uvr/architectures/vr_separator.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,13 @@
# Check if we really need the rerun_mp3 function, remove if not
import audioread

from uvr.common_separator import CommonSeparator
from uvr.uvr_lib_v5 import spec_utils
from uvr.uvr_lib_v5.vr_network import nets
from uvr.uvr_lib_v5.vr_network import nets_new
from uvr.uvr_lib_v5.vr_network.model_param_init import ModelParameters
from tabs.plugins.installed.UVR.uvr.common_separator import CommonSeparator
from tabs.plugins.installed.UVR.uvr.uvr_lib_v5 import spec_utils
from tabs.plugins.installed.UVR.uvr.uvr_lib_v5.vr_network import nets
from tabs.plugins.installed.UVR.uvr.uvr_lib_v5.vr_network import nets_new
from tabs.plugins.installed.UVR.uvr.uvr_lib_v5.vr_network.model_param_init import (
ModelParameters,
)


class VRSeparator(CommonSeparator):
Expand Down Expand Up @@ -214,7 +216,7 @@ def separate(self, audio_file_path):
f"v_spec stats - min: {np.min(v_spec)}, max: {np.max(v_spec)}, isnan: {np.isnan(v_spec).any()}, isinf: {np.isinf(v_spec).any()}"
)

# Not yet implemented from UVR features:
# Not yet implemented from tabs.plugins.installed.UVR.uvr features:
#
# if not self.is_vocal_split_model:
# self.cache_source((y_spec, v_spec))
Expand Down Expand Up @@ -301,7 +303,7 @@ def separate(self, audio_file_path):
)
output_files.append(self.secondary_stem_output_path)

# Not yet implemented from UVR features:
# Not yet implemented from tabs.plugins.installed.UVR.uvr features:
# self.process_vocal_split_chain(secondary_sources)
# self.logger.debug("Vocal split chain processed.")

Expand Down
2 changes: 1 addition & 1 deletion UVR/uvr/common_separator.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import librosa
import torch
from pydub import AudioSegment
from uvr.uvr_lib_v5 import spec_utils
from tabs.plugins.installed.UVR.uvr.uvr_lib_v5 import spec_utils


class CommonSeparator:
Expand Down
2 changes: 1 addition & 1 deletion UVR/uvr/separator.py
Original file line number Diff line number Diff line change
Expand Up @@ -728,7 +728,7 @@ def load_model(
)

module_name, class_name = separator_classes[model_type].split(".")
module = importlib.import_module(f"uvr.architectures.{module_name}")
module = importlib.import_module(f"tabs.plugins.installed.UVR.uvr.architectures.{module_name}")
separator_class = getattr(module, class_name)

self.logger.debug(
Expand Down
2 changes: 1 addition & 1 deletion UVR/uvr/uvr_lib_v5/spec_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import math
import platform
import traceback
from uvr.uvr_lib_v5 import pyrb
from tabs.plugins.installed.UVR.uvr.uvr_lib_v5 import pyrb
from scipy.signal import correlate, hilbert
import io

Expand Down
2 changes: 1 addition & 1 deletion UVR/uvr/uvr_lib_v5/vr_network/layers.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from torch import nn
import torch.nn.functional as F

from uvr.uvr_lib_v5 import spec_utils
from tabs.plugins.installed.UVR.uvr.uvr_lib_v5 import spec_utils


class Conv2DBNActiv(nn.Module):
Expand Down
2 changes: 1 addition & 1 deletion UVR/uvr/uvr_lib_v5/vr_network/layers_new.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from torch import nn
import torch.nn.functional as F

from uvr.uvr_lib_v5 import spec_utils
from tabs.plugins.installed.UVR.uvr.uvr_lib_v5 import spec_utils


class Conv2DBNActiv(nn.Module):
Expand Down

0 comments on commit 2238908

Please sign in to comment.