lorneluo commited on
Commit
351457d
1 Parent(s): 218611c

tqdm progress bar

Browse files
Files changed (3) hide show
  1. args.py +3 -3
  2. inst.py +18 -0
  3. requirements.txt +2 -1
args.py CHANGED
@@ -173,7 +173,7 @@ mdx23c_8kfft_instvoc_hq_process_data = {
173
  'set_progress_bar': lambda step, inference_iterations=0: print(
174
  f"iteration {inference_iterations} of step #{step}"),
175
  'write_to_console': lambda progress_text, base_text='': print(
176
- f"{progress_text} {base_text}"),
177
  'process_iteration': lambda iteration: iteration + 1,
178
  'cached_source_callback': cached_source_callback,
179
  'cached_model_source_holder': cached_model_source_holder,
@@ -301,7 +301,7 @@ uvr_mdx_net_voc_ft_process_data = {
301
  'set_progress_bar': lambda step, inference_iterations=0: print(
302
  f"iteration {inference_iterations} of step #{step}"),
303
  'write_to_console': lambda progress_text, base_text='': print(
304
- f"{progress_text} {base_text}"),
305
  'process_iteration': lambda iteration: iteration + 1,
306
  'cached_source_callback': cached_source_callback,
307
  'cached_model_source_holder': cached_model_source_holder,
@@ -425,7 +425,7 @@ htdemucs_ft_process_data = {
425
  'set_progress_bar': lambda step, inference_iterations=0: print(
426
  f"iteration {inference_iterations} of step #{step}"),
427
  'write_to_console': lambda progress_text, base_text='': print(
428
- f"{progress_text} {base_text}"),
429
  'process_iteration': lambda iteration: iteration + 1,
430
  'cached_source_callback': cached_source_callback,
431
  'cached_model_source_holder': cached_model_source_holder,
 
173
  'set_progress_bar': lambda step, inference_iterations=0: print(
174
  f"iteration {inference_iterations} of step #{step}"),
175
  'write_to_console': lambda progress_text, base_text='': print(
176
+ f"{progress_text} {base_text} @ MDX23C Model: MDX23C-InstVoc HQ"),
177
  'process_iteration': lambda iteration: iteration + 1,
178
  'cached_source_callback': cached_source_callback,
179
  'cached_model_source_holder': cached_model_source_holder,
 
301
  'set_progress_bar': lambda step, inference_iterations=0: print(
302
  f"iteration {inference_iterations} of step #{step}"),
303
  'write_to_console': lambda progress_text, base_text='': print(
304
+ f"{progress_text} {base_text} @ MDX-Net Model: UVR-MDX-NET Voc FT"),
305
  'process_iteration': lambda iteration: iteration + 1,
306
  'cached_source_callback': cached_source_callback,
307
  'cached_model_source_holder': cached_model_source_holder,
 
425
  'set_progress_bar': lambda step, inference_iterations=0: print(
426
  f"iteration {inference_iterations} of step #{step}"),
427
  'write_to_console': lambda progress_text, base_text='': print(
428
+ f"{progress_text} {base_text} @ Demucs v4: htdemucs_ft"),
429
  'process_iteration': lambda iteration: iteration + 1,
430
  'cached_source_callback': cached_source_callback,
431
  'cached_model_source_holder': cached_model_source_holder,
inst.py CHANGED
@@ -5,6 +5,8 @@ from datetime import datetime
5
  from pathlib import Path
6
  from time import sleep
7
 
 
 
8
  from args import mdx23c_8kfft_instvoc_hq_process_data, htdemucs_ft_process_data, uvr_mdx_net_voc_ft_process_data
9
  from download import download_model, get_model_file
10
  from gui_data.constants import VR_ARCH_TYPE, MDX_ARCH_TYPE, DEMUCS_ARCH_TYPE, ENSEMBLE_MODE, TIME_STRETCH, \
@@ -36,11 +38,25 @@ def run_ensemble_models(audio_path, export_path, format=WAV, clean=True):
36
  vocals_export_paths = []
37
 
38
  for process_data in process_datas:
 
 
 
 
 
 
 
 
 
 
 
 
39
  current_model = process_data['model_data']
40
  audio_file_base = Path(audio_path).stem + '_' + current_model.model_basename
41
  process_data['export_path'] = temp_export_path
42
  process_data['audio_file_base'] = audio_file_base
43
  process_data['audio_file'] = audio_path
 
 
44
 
45
  if current_model.process_method == VR_ARCH_TYPE:
46
  seperator = SeperateVR(current_model, process_data)
@@ -76,6 +92,8 @@ def run_ensemble_models(audio_path, export_path, format=WAV, clean=True):
76
 
77
 
78
  def ensemble(stem_outputs, stem_save_path, format=WAV):
 
 
79
  algorithm = 'Average'
80
  is_normalization = True
81
  spec_utils.ensemble_inputs(stem_outputs, algorithm, is_normalization, 'PCM_16', stem_save_path, is_wave=True)
 
5
  from pathlib import Path
6
  from time import sleep
7
 
8
+ from tqdm import tqdm
9
+
10
  from args import mdx23c_8kfft_instvoc_hq_process_data, htdemucs_ft_process_data, uvr_mdx_net_voc_ft_process_data
11
  from download import download_model, get_model_file
12
  from gui_data.constants import VR_ARCH_TYPE, MDX_ARCH_TYPE, DEMUCS_ARCH_TYPE, ENSEMBLE_MODE, TIME_STRETCH, \
 
38
  vocals_export_paths = []
39
 
40
  for process_data in process_datas:
41
+ progress_bar = tqdm(total=100, desc=process_data["model_name"], unit="%")
42
+
43
+ def set_progress_bar(step, inference_iterations=0):
44
+ # print(step, inference_iterations, round(inference_iterations * 100, 2))
45
+ if inference_iterations > 0:
46
+ progress_bar.update(round(inference_iterations * 100, 2) - progress_bar.n)
47
+
48
+ def write_to_console(progress_text, base_text=''):
49
+ text = f"{progress_text} {base_text}"
50
+ if text.strip():
51
+ return f'{text} @ process_data["model_name"]'
52
+
53
  current_model = process_data['model_data']
54
  audio_file_base = Path(audio_path).stem + '_' + current_model.model_basename
55
  process_data['export_path'] = temp_export_path
56
  process_data['audio_file_base'] = audio_file_base
57
  process_data['audio_file'] = audio_path
58
+ process_data['set_progress_bar'] = set_progress_bar
59
+ process_data['write_to_console'] = write_to_console
60
 
61
  if current_model.process_method == VR_ARCH_TYPE:
62
  seperator = SeperateVR(current_model, process_data)
 
92
 
93
 
94
  def ensemble(stem_outputs, stem_save_path, format=WAV):
95
+ stem_save_path = str(stem_save_path)
96
+ stem_outputs = [str(s) for s in stem_outputs]
97
  algorithm = 'Average'
98
  is_normalization = True
99
  spec_utils.ensemble_inputs(stem_outputs, algorithm, is_normalization, 'PCM_16', stem_save_path, is_wave=True)
requirements.txt CHANGED
@@ -42,5 +42,6 @@ PySoundFile==0.9.0.post1; sys_platform == 'darwin'
42
  numpy==1.23.5
43
  addict
44
  matplotlib
45
- sklearn==0.0.post12
 
46
  click
 
42
  numpy==1.23.5
43
  addict
44
  matplotlib
45
+ #sklearn==0.0.post12
46
+ scikit-learn
47
  click