jhj0517 commited on
Commit
4171011
·
unverified ·
2 Parent(s): 29cce95 790409b

Merge pull request #291 from jhj0517/feature/add-offload

Browse files
app.py CHANGED
@@ -138,6 +138,8 @@ class App:
138
  choices=self.whisper_inf.music_separator.available_models)
139
  nb_uvr_segment_size = gr.Number(label="Segment Size", value=uvr_params["segment_size"], precision=0)
140
  cb_uvr_save_file = gr.Checkbox(label="Save separated files to output", value=uvr_params["save_file"])
 
 
141
 
142
  with gr.Accordion("VAD", open=False):
143
  cb_vad_filter = gr.Checkbox(label="Enable Silero VAD Filter", value=vad_params["vad_filter"],
@@ -187,7 +189,7 @@ class App:
187
  language_detection_segments=nb_language_detection_segments,
188
  prompt_reset_on_temperature=sld_prompt_reset_on_temperature, is_bgm_separate=cb_bgm_separation,
189
  uvr_device=dd_uvr_device, uvr_model_size=dd_uvr_model_size, uvr_segment_size=nb_uvr_segment_size,
190
- uvr_save_file=cb_uvr_save_file
191
  ),
192
  dd_file_format,
193
  cb_timestamp
 
138
  choices=self.whisper_inf.music_separator.available_models)
139
  nb_uvr_segment_size = gr.Number(label="Segment Size", value=uvr_params["segment_size"], precision=0)
140
  cb_uvr_save_file = gr.Checkbox(label="Save separated files to output", value=uvr_params["save_file"])
141
+ cb_uvr_enable_offload = gr.Checkbox(label="Offload UVR model after separation",
142
+ value=uvr_params["enable_offload"])
143
 
144
  with gr.Accordion("VAD", open=False):
145
  cb_vad_filter = gr.Checkbox(label="Enable Silero VAD Filter", value=vad_params["vad_filter"],
 
189
  language_detection_segments=nb_language_detection_segments,
190
  prompt_reset_on_temperature=sld_prompt_reset_on_temperature, is_bgm_separate=cb_bgm_separation,
191
  uvr_device=dd_uvr_device, uvr_model_size=dd_uvr_model_size, uvr_segment_size=nb_uvr_segment_size,
192
+ uvr_save_file=cb_uvr_save_file, uvr_enable_offload=cb_uvr_enable_offload
193
  ),
194
  dd_file_format,
195
  cb_timestamp
configs/default_parameters.yaml CHANGED
@@ -48,6 +48,7 @@ bgm_separation:
48
  model_size: "UVR-MDX-NET-Inst_HQ_4"
49
  segment_size: 256
50
  save_file: false
 
51
 
52
  translation:
53
  deepl:
 
48
  model_size: "UVR-MDX-NET-Inst_HQ_4"
49
  segment_size: 256
50
  save_file: false
51
+ enable_offload: true
52
 
53
  translation:
54
  deepl:
modules/whisper/whisper_parameter.py CHANGED
@@ -51,6 +51,7 @@ class WhisperParameters:
51
  uvr_device: gr.Dropdown
52
  uvr_segment_size: gr.Number
53
  uvr_save_file: gr.Checkbox
 
54
  """
55
  A data class for Gradio components of the Whisper Parameters. Use "before" Gradio pre-processing.
56
  This data class is used to mitigate the key-value problem between Gradio components and function parameters.
@@ -218,6 +219,10 @@ class WhisperParameters:
218
 
219
  uvr_save_file: gr.Checkbox
220
  This parameter is related to UVR. Boolean value that determines whether to save the file or not.
 
 
 
 
221
  """
222
 
223
  def as_list(self) -> list:
@@ -292,6 +297,7 @@ class WhisperValues:
292
  uvr_device: str = "cuda"
293
  uvr_segment_size: int = 256
294
  uvr_save_file: bool = False
 
295
  """
296
  A data class to use Whisper parameters.
297
  """
@@ -347,6 +353,7 @@ class WhisperValues:
347
  "model_size": self.uvr_model_size,
348
  "segment_size": self.uvr_segment_size,
349
  "save_file": self.uvr_save_file,
 
350
  },
351
  }
352
  return data
 
51
  uvr_device: gr.Dropdown
52
  uvr_segment_size: gr.Number
53
  uvr_save_file: gr.Checkbox
54
+ uvr_enable_offload: gr.Checkbox
55
  """
56
  A data class for Gradio components of the Whisper Parameters. Use "before" Gradio pre-processing.
57
  This data class is used to mitigate the key-value problem between Gradio components and function parameters.
 
219
 
220
  uvr_save_file: gr.Checkbox
221
  This parameter is related to UVR. Boolean value that determines whether to save the file or not.
222
+
223
+ uvr_enable_offload: gr.Checkbox
224
+ This parameter is related to UVR. Boolean value that determines whether to offload the UVR model or not
225
+ after each transcription.
226
  """
227
 
228
  def as_list(self) -> list:
 
297
  uvr_device: str = "cuda"
298
  uvr_segment_size: int = 256
299
  uvr_save_file: bool = False
300
+ uvr_enable_offload: bool = True
301
  """
302
  A data class to use Whisper parameters.
303
  """
 
353
  "model_size": self.uvr_model_size,
354
  "segment_size": self.uvr_segment_size,
355
  "save_file": self.uvr_save_file,
356
+ "enable_offload": self.uvr_enable_offload
357
  },
358
  }
359
  return data