JacobLinCool commited on
Commit
ea3ebc0
1 Parent(s): b0f46ba

feat: tab ui

Browse files
Files changed (2) hide show
  1. app.py +50 -50
  2. infer/modules/train/train.py +2 -2
app.py CHANGED
@@ -47,10 +47,6 @@ def extract_audio_files(zip_file: str, target_dir: str) -> list[str]:
47
  return audio_files
48
 
49
 
50
- def train_rvc_model(audio_files: list[str]) -> str:
51
- return "model_path"
52
-
53
-
54
  def preprocess(zip_file: str) -> str:
55
  temp_dir = tempfile.mkdtemp()
56
  print(f"Using exp dir: {temp_dir}")
@@ -59,7 +55,7 @@ def preprocess(zip_file: str) -> str:
59
  os.makedirs(data_dir)
60
  audio_files = extract_audio_files(zip_file, data_dir)
61
 
62
- pp = PreProcess(48000, temp_dir, 3.0, False)
63
  pp.pipeline_mp_inp_dir(data_dir, 4)
64
 
65
  pp.logfile.seek(0)
@@ -209,55 +205,59 @@ def restore_expdir(zip: str) -> str:
209
 
210
 
211
  with gr.Blocks() as app:
212
- with gr.Row():
213
- with gr.Column():
214
- zip_file = gr.File(
215
- label="Upload a zip file containing audio files for training",
216
- file_types=["zip"],
217
- )
218
- exp_dir = gr.Textbox(label="Experiment directory", visible=True)
219
- preprocess_btn = gr.Button(value="Preprocess", variant="primary")
220
- with gr.Column():
221
- preprocess_output = gr.Textbox(label="Preprocessing output", lines=5)
222
-
223
- with gr.Row():
224
- restore_zip_file = gr.File(
225
- label="Upload the experiment directory zip file",
226
- file_types=["zip"],
227
- )
228
- restore_btn = gr.Button(value="Preprocess")
 
 
 
 
 
 
 
229
 
230
- with gr.Row():
231
- with gr.Column():
232
- extract_features_btn = gr.Button(
233
- value="Extract features", variant="primary"
234
- )
235
- with gr.Column():
236
- extract_features_output = gr.Textbox(
237
- label="Feature extraction output", lines=5
238
- )
239
 
240
- with gr.Row():
241
- with gr.Column():
242
- train_btn = gr.Button(value="Train", variant="primary")
243
- with gr.Column():
244
- latest_model = gr.File(label="Latest checkpoint")
245
 
246
- with gr.Row():
247
- with gr.Column():
248
- download_weight_btn = gr.Button(
249
- value="Download latest model", variant="primary"
250
- )
251
- with gr.Column():
252
- download_weight_output = gr.File(label="Download latest model")
253
 
254
- with gr.Row():
255
- with gr.Column():
256
- download_expdir_btn = gr.Button(
257
- value="Download experiment directory", variant="primary"
258
- )
259
- with gr.Column():
260
- download_expdir_output = gr.File(label="Download experiment directory")
261
 
262
  preprocess_btn.click(
263
  fn=preprocess,
 
47
  return audio_files
48
 
49
 
 
 
 
 
50
  def preprocess(zip_file: str) -> str:
51
  temp_dir = tempfile.mkdtemp()
52
  print(f"Using exp dir: {temp_dir}")
 
55
  os.makedirs(data_dir)
56
  audio_files = extract_audio_files(zip_file, data_dir)
57
 
58
+ pp = PreProcess(40000, temp_dir, 3.0, False)
59
  pp.pipeline_mp_inp_dir(data_dir, 4)
60
 
61
  pp.logfile.seek(0)
 
205
 
206
 
207
  with gr.Blocks() as app:
208
+ exp_dir = gr.Textbox(label="Experiment directory", visible=True, interactive=False)
209
+
210
+ with gr.Tabs():
211
+ with gr.Tab(label="New / Restore"):
212
+ with gr.Row():
213
+ with gr.Column():
214
+ zip_file = gr.File(
215
+ label="Upload a zip file containing audio files for training",
216
+ file_types=["zip"],
217
+ )
218
+ preprocess_output = gr.Textbox(
219
+ label="Preprocessing output", lines=5
220
+ )
221
+ with gr.Column():
222
+ preprocess_btn = gr.Button(
223
+ value="Start New Experiment", variant="primary"
224
+ )
225
+
226
+ with gr.Row():
227
+ restore_zip_file = gr.File(
228
+ label="Upload the experiment directory zip file",
229
+ file_types=["zip"],
230
+ )
231
+ restore_btn = gr.Button(value="Restore Experiment", variant="primary")
232
 
233
+ with gr.Tab(label="Extract features"):
234
+ with gr.Row():
235
+ extract_features_btn = gr.Button(
236
+ value="Extract features", variant="primary"
237
+ )
238
+ with gr.Row():
239
+ extract_features_output = gr.Textbox(
240
+ label="Feature extraction output", lines=10
241
+ )
242
 
243
+ with gr.Tab(label="Train"):
244
+ with gr.Row():
245
+ train_btn = gr.Button(value="Train", variant="primary")
246
+ with gr.Row():
247
+ latest_model = gr.File(label="Latest checkpoint")
248
 
249
+ with gr.Tab(label="Download"):
250
+ with gr.Row():
251
+ download_weight_btn = gr.Button(
252
+ value="Download latest model", variant="primary"
253
+ )
254
+ download_weight_output = gr.File(label="Download latest model")
 
255
 
256
+ with gr.Row():
257
+ download_expdir_btn = gr.Button(
258
+ value="Download experiment directory", variant="primary"
259
+ )
260
+ download_expdir_output = gr.File(label="Download experiment directory")
 
 
261
 
262
  preprocess_btn.click(
263
  fn=preprocess,
infer/modules/train/train.py CHANGED
@@ -152,8 +152,8 @@ def run(rank, n_gpus, hps, logger: logging.Logger, state):
152
  pin_memory=True,
153
  collate_fn=collate_fn,
154
  batch_sampler=train_sampler,
155
- persistent_workers=True,
156
- prefetch_factor=8,
157
  )
158
  if hps.if_f0 == 1:
159
  net_g = RVC_Model_f0(
 
152
  pin_memory=True,
153
  collate_fn=collate_fn,
154
  batch_sampler=train_sampler,
155
+ # persistent_workers=True,
156
+ # prefetch_factor=8,
157
  )
158
  if hps.if_f0 == 1:
159
  net_g = RVC_Model_f0(