mirror of
https://github.com/Anjok07/ultimatevocalremovergui.git
synced 2024-11-12 01:50:48 +01:00
Add files via upload
This commit is contained in:
parent
20ffe5eef6
commit
4dd7fb1842
39
UVR.py
39
UVR.py
@ -109,6 +109,13 @@ elif OPERATING_SYSTEM=="Windows":
|
|||||||
right_click_button = '<Button-3>'
|
right_click_button = '<Button-3>'
|
||||||
application_extension = ".exe"
|
application_extension = ".exe"
|
||||||
|
|
||||||
|
if is_macos:
|
||||||
|
from torch.mps import empty_cache
|
||||||
|
else:
|
||||||
|
from torch.cuda import empty_cache
|
||||||
|
|
||||||
|
clear_gpu_cache = empty_cache
|
||||||
|
|
||||||
def right_click_release_linux(window, top_win=None):
|
def right_click_release_linux(window, top_win=None):
|
||||||
if OPERATING_SYSTEM=="Linux":
|
if OPERATING_SYSTEM=="Linux":
|
||||||
root.bind('<Button-1>', lambda e:window.destroy())
|
root.bind('<Button-1>', lambda e:window.destroy())
|
||||||
@ -1279,7 +1286,6 @@ class MainWindow(TkinterDnD.Tk if is_dnd_compatible else tk.Tk):
|
|||||||
style.configure('TCombobox', selectbackground='#0c0c0c')
|
style.configure('TCombobox', selectbackground='#0c0c0c')
|
||||||
#style.configure('TCheckbutton', indicatorsize=30)
|
#style.configure('TCheckbutton', indicatorsize=30)
|
||||||
|
|
||||||
|
|
||||||
# Calculate window height
|
# Calculate window height
|
||||||
height = self.IMAGE_HEIGHT + self.FILEPATHS_HEIGHT + self.OPTIONS_HEIGHT
|
height = self.IMAGE_HEIGHT + self.FILEPATHS_HEIGHT + self.OPTIONS_HEIGHT
|
||||||
height += self.CONVERSIONBUTTON_HEIGHT + self.COMMAND_HEIGHT + self.PROGRESS_HEIGHT
|
height += self.CONVERSIONBUTTON_HEIGHT + self.COMMAND_HEIGHT + self.PROGRESS_HEIGHT
|
||||||
@ -1310,7 +1316,7 @@ class MainWindow(TkinterDnD.Tk if is_dnd_compatible else tk.Tk):
|
|||||||
|
|
||||||
#Load Images
|
#Load Images
|
||||||
img = ImagePath(BASE_PATH)
|
img = ImagePath(BASE_PATH)
|
||||||
self.logo_img = img.open_image(path=img.banner_path, size=(width, 9999))
|
self.logo_img = img.open_image(path=img.banner_path, size=(width, height))
|
||||||
self.efile_img = img.efile_img
|
self.efile_img = img.efile_img
|
||||||
self.stop_img = img.stop_img
|
self.stop_img = img.stop_img
|
||||||
self.help_img = img.help_img
|
self.help_img = img.help_img
|
||||||
@ -2105,6 +2111,12 @@ class MainWindow(TkinterDnD.Tk if is_dnd_compatible else tk.Tk):
|
|||||||
if not is_macos:
|
if not is_macos:
|
||||||
self.bind("<Configure>", self.adjust_toplevel_positions)
|
self.bind("<Configure>", self.adjust_toplevel_positions)
|
||||||
|
|
||||||
|
def auto_save(self):
|
||||||
|
try:
|
||||||
|
self.save_values(app_close=False, is_auto_save=True)
|
||||||
|
except Exception as e:
|
||||||
|
print(e)
|
||||||
|
|
||||||
#--Input/Export Methods--
|
#--Input/Export Methods--
|
||||||
|
|
||||||
def linux_filebox_fix(self, is_on=True):
|
def linux_filebox_fix(self, is_on=True):
|
||||||
@ -5478,10 +5490,9 @@ class MainWindow(TkinterDnD.Tk if is_dnd_compatible else tk.Tk):
|
|||||||
"""Update the model dropdown menus"""
|
"""Update the model dropdown menus"""
|
||||||
|
|
||||||
if self.clear_cache_torch:
|
if self.clear_cache_torch:
|
||||||
#self.set_app_font(is_chosen_font=True)
|
clear_gpu_cache()
|
||||||
torch.cuda.empty_cache()
|
|
||||||
self.clear_cache_torch = False
|
self.clear_cache_torch = False
|
||||||
|
|
||||||
if self.is_process_stopped:
|
if self.is_process_stopped:
|
||||||
if self.thread_check(self.active_processing_thread):
|
if self.thread_check(self.active_processing_thread):
|
||||||
self.conversion_Button_Text_var.set(STOP_PROCESSING)
|
self.conversion_Button_Text_var.set(STOP_PROCESSING)
|
||||||
@ -5492,9 +5503,9 @@ class MainWindow(TkinterDnD.Tk if is_dnd_compatible else tk.Tk):
|
|||||||
self.conversion_Button_Text_var.set(START_PROCESSING)
|
self.conversion_Button_Text_var.set(START_PROCESSING)
|
||||||
self.conversion_Button.configure(state=tk.NORMAL)
|
self.conversion_Button.configure(state=tk.NORMAL)
|
||||||
self.progress_bar_main_var.set(0)
|
self.progress_bar_main_var.set(0)
|
||||||
torch.cuda.empty_cache()
|
clear_gpu_cache()
|
||||||
self.is_process_stopped = False
|
self.is_process_stopped = False
|
||||||
|
|
||||||
if self.is_confirm_error_var.get():
|
if self.is_confirm_error_var.get():
|
||||||
self.check_is_menu_open(ERROR_OPTION)
|
self.check_is_menu_open(ERROR_OPTION)
|
||||||
self.is_confirm_error_var.set(False)
|
self.is_confirm_error_var.set(False)
|
||||||
@ -5508,6 +5519,8 @@ class MainWindow(TkinterDnD.Tk if is_dnd_compatible else tk.Tk):
|
|||||||
close_process(self.msg_queue)
|
close_process(self.msg_queue)
|
||||||
self.is_check_splash = False
|
self.is_check_splash = False
|
||||||
|
|
||||||
|
#self.auto_save()
|
||||||
|
|
||||||
self.update_available_models()
|
self.update_available_models()
|
||||||
self.after(600, self.update_loop)
|
self.after(600, self.update_loop)
|
||||||
|
|
||||||
@ -5551,7 +5564,7 @@ class MainWindow(TkinterDnD.Tk if is_dnd_compatible else tk.Tk):
|
|||||||
|
|
||||||
option_menu['values'] = option_list_option_menu
|
option_menu['values'] = option_list_option_menu
|
||||||
option_menu.set(current_selection)
|
option_menu.set(current_selection)
|
||||||
option_menu.update_dropdown_size(model_list, model_type)
|
option_menu.update_dropdown_size(option_list, model_type)
|
||||||
|
|
||||||
if self.is_root_defined_var.get() and model_type == MDX_ARCH_TYPE and self.chosen_process_method_var.get() == MDX_ARCH_TYPE:
|
if self.is_root_defined_var.get() and model_type == MDX_ARCH_TYPE and self.chosen_process_method_var.get() == MDX_ARCH_TYPE:
|
||||||
self.selection_action_models_sub(current_selection, model_type, option_var)
|
self.selection_action_models_sub(current_selection, model_type, option_var)
|
||||||
@ -6147,6 +6160,7 @@ class MainWindow(TkinterDnD.Tk if is_dnd_compatible else tk.Tk):
|
|||||||
self.active_processing_thread.start()
|
self.active_processing_thread.start()
|
||||||
|
|
||||||
def process_button_init(self):
|
def process_button_init(self):
|
||||||
|
self.auto_save()
|
||||||
self.conversion_Button_Text_var.set(WAIT_PROCESSING)
|
self.conversion_Button_Text_var.set(WAIT_PROCESSING)
|
||||||
self.conversion_Button.configure(state=tk.DISABLED)
|
self.conversion_Button.configure(state=tk.DISABLED)
|
||||||
self.command_Text.clear()
|
self.command_Text.clear()
|
||||||
@ -6177,6 +6191,8 @@ class MainWindow(TkinterDnD.Tk if is_dnd_compatible else tk.Tk):
|
|||||||
def confirm_stop_process(self):
|
def confirm_stop_process(self):
|
||||||
"""Asks for confirmation before halting active process"""
|
"""Asks for confirmation before halting active process"""
|
||||||
|
|
||||||
|
self.auto_save()
|
||||||
|
|
||||||
if self.thread_check(self.active_processing_thread):
|
if self.thread_check(self.active_processing_thread):
|
||||||
confirm = messagebox.askyesno(parent=root, title=STOP_PROCESS_CONFIRM[0], message=STOP_PROCESS_CONFIRM[1])
|
confirm = messagebox.askyesno(parent=root, title=STOP_PROCESS_CONFIRM[0], message=STOP_PROCESS_CONFIRM[1])
|
||||||
|
|
||||||
@ -6192,6 +6208,7 @@ class MainWindow(TkinterDnD.Tk if is_dnd_compatible else tk.Tk):
|
|||||||
def process_end(self, error=None):
|
def process_end(self, error=None):
|
||||||
"""End of process actions"""
|
"""End of process actions"""
|
||||||
|
|
||||||
|
self.auto_save()
|
||||||
self.cached_sources_clear()
|
self.cached_sources_clear()
|
||||||
self.clear_cache_torch = True
|
self.clear_cache_torch = True
|
||||||
self.conversion_Button_Text_var.set(START_PROCESSING)
|
self.conversion_Button_Text_var.set(START_PROCESSING)
|
||||||
@ -6589,7 +6606,7 @@ class MainWindow(TkinterDnD.Tk if is_dnd_compatible else tk.Tk):
|
|||||||
if os.path.isfile(audio_file):
|
if os.path.isfile(audio_file):
|
||||||
os.remove(audio_file)
|
os.remove(audio_file)
|
||||||
|
|
||||||
torch.cuda.empty_cache()
|
clear_gpu_cache()
|
||||||
|
|
||||||
shutil.rmtree(export_path) if is_ensemble and len(os.listdir(export_path)) == 0 else None
|
shutil.rmtree(export_path) if is_ensemble and len(os.listdir(export_path)) == 0 else None
|
||||||
|
|
||||||
@ -6923,7 +6940,7 @@ class MainWindow(TkinterDnD.Tk if is_dnd_compatible else tk.Tk):
|
|||||||
self.model_sample_mode_duration_checkbox_var.set(SAMPLE_MODE_CHECKBOX(self.model_sample_mode_duration_var.get()))
|
self.model_sample_mode_duration_checkbox_var.set(SAMPLE_MODE_CHECKBOX(self.model_sample_mode_duration_var.get()))
|
||||||
self.model_sample_mode_duration_label_var.set(f'{self.model_sample_mode_duration_var.get()} Seconds')
|
self.model_sample_mode_duration_label_var.set(f'{self.model_sample_mode_duration_var.get()} Seconds')
|
||||||
|
|
||||||
def save_values(self, app_close=True, is_restart=False):
|
def save_values(self, app_close=True, is_restart=False, is_auto_save=False):
|
||||||
"""Saves application data"""
|
"""Saves application data"""
|
||||||
|
|
||||||
# -Save Data-
|
# -Save Data-
|
||||||
@ -7079,6 +7096,8 @@ class MainWindow(TkinterDnD.Tk if is_dnd_compatible else tk.Tk):
|
|||||||
|
|
||||||
self.destroy()
|
self.destroy()
|
||||||
|
|
||||||
|
elif is_auto_save:
|
||||||
|
save_data(data={**main_settings, **other_data})
|
||||||
else:
|
else:
|
||||||
return {**main_settings, **user_saved_extras}
|
return {**main_settings, **user_saved_extras}
|
||||||
|
|
||||||
|
15
separate.py
15
separate.py
@ -32,12 +32,19 @@ import math
|
|||||||
from onnx import load
|
from onnx import load
|
||||||
from onnx2pytorch import ConvertModel
|
from onnx2pytorch import ConvertModel
|
||||||
|
|
||||||
|
if is_macos:
|
||||||
|
from torch.mps import empty_cache
|
||||||
|
else:
|
||||||
|
from torch.cuda import empty_cache
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from UVR import ModelData
|
from UVR import ModelData
|
||||||
|
|
||||||
warnings.filterwarnings("ignore")
|
warnings.filterwarnings("ignore")
|
||||||
cpu = torch.device('cpu')
|
cpu = torch.device('cpu')
|
||||||
|
|
||||||
|
clear_gpu_cache = empty_cache
|
||||||
|
|
||||||
class SeperateAttributes:
|
class SeperateAttributes:
|
||||||
def __init__(self, model_data: ModelData,
|
def __init__(self, model_data: ModelData,
|
||||||
process_data: dict,
|
process_data: dict,
|
||||||
@ -485,7 +492,7 @@ class SeperateMDX(SeperateAttributes):
|
|||||||
|
|
||||||
self.primary_source_map = self.final_process(primary_stem_path, self.primary_source, self.secondary_source_primary, self.primary_stem, samplerate)
|
self.primary_source_map = self.final_process(primary_stem_path, self.primary_source, self.secondary_source_primary, self.primary_stem, samplerate)
|
||||||
|
|
||||||
torch.cuda.empty_cache()
|
clear_gpu_cache()
|
||||||
|
|
||||||
secondary_sources = {**self.primary_source_map, **self.secondary_source_map}
|
secondary_sources = {**self.primary_source_map, **self.secondary_source_map}
|
||||||
|
|
||||||
@ -685,7 +692,7 @@ class SeperateMDXC(SeperateAttributes):
|
|||||||
|
|
||||||
self.primary_source_map = self.final_process(primary_stem_path, self.primary_source, self.secondary_source_primary, self.primary_stem, samplerate)
|
self.primary_source_map = self.final_process(primary_stem_path, self.primary_source, self.secondary_source_primary, self.primary_stem, samplerate)
|
||||||
|
|
||||||
torch.cuda.empty_cache()
|
clear_gpu_cache()
|
||||||
|
|
||||||
secondary_sources = {**self.primary_source_map, **self.secondary_source_map}
|
secondary_sources = {**self.primary_source_map, **self.secondary_source_map}
|
||||||
self.process_vocal_split_chain(secondary_sources)
|
self.process_vocal_split_chain(secondary_sources)
|
||||||
@ -830,7 +837,7 @@ class SeperateDemucs(SeperateAttributes):
|
|||||||
self.write_to_console(DONE, base_text='')
|
self.write_to_console(DONE, base_text='')
|
||||||
|
|
||||||
del self.demucs
|
del self.demucs
|
||||||
torch.cuda.empty_cache()
|
clear_gpu_cache()
|
||||||
|
|
||||||
if isinstance(inst_source, np.ndarray):
|
if isinstance(inst_source, np.ndarray):
|
||||||
source_reshape = spec_utils.reshape_sources(inst_source[self.demucs_source_map[VOCAL_STEM]], source[self.demucs_source_map[VOCAL_STEM]])
|
source_reshape = spec_utils.reshape_sources(inst_source[self.demucs_source_map[VOCAL_STEM]], source[self.demucs_source_map[VOCAL_STEM]])
|
||||||
@ -1050,7 +1057,7 @@ class SeperateVR(SeperateAttributes):
|
|||||||
|
|
||||||
self.secondary_source_map = self.final_process(secondary_stem_path, self.secondary_source, self.secondary_source_secondary, self.secondary_stem, 44100)
|
self.secondary_source_map = self.final_process(secondary_stem_path, self.secondary_source, self.secondary_source_secondary, self.secondary_stem, 44100)
|
||||||
|
|
||||||
torch.cuda.empty_cache()
|
clear_gpu_cache()
|
||||||
secondary_sources = {**self.primary_source_map, **self.secondary_source_map}
|
secondary_sources = {**self.primary_source_map, **self.secondary_source_map}
|
||||||
|
|
||||||
self.process_vocal_split_chain(secondary_sources)
|
self.process_vocal_split_chain(secondary_sources)
|
||||||
|
Loading…
Reference in New Issue
Block a user