Spaces:
Paused
Paused
Commit
·
ea3ebc0
1
Parent(s):
b0f46ba
feat: tab ui
Browse files- app.py +50 -50
- 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(
|
| 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 |
-
|
| 213 |
-
|
| 214 |
-
|
| 215 |
-
|
| 216 |
-
|
| 217 |
-
|
| 218 |
-
|
| 219 |
-
|
| 220 |
-
|
| 221 |
-
|
| 222 |
-
|
| 223 |
-
|
| 224 |
-
|
| 225 |
-
|
| 226 |
-
|
| 227 |
-
|
| 228 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 229 |
|
| 230 |
-
|
| 231 |
-
|
| 232 |
-
|
| 233 |
-
|
| 234 |
-
|
| 235 |
-
|
| 236 |
-
|
| 237 |
-
|
| 238 |
-
|
| 239 |
|
| 240 |
-
|
| 241 |
-
|
| 242 |
-
|
| 243 |
-
|
| 244 |
-
|
| 245 |
|
| 246 |
-
|
| 247 |
-
|
| 248 |
-
|
| 249 |
-
|
| 250 |
-
|
| 251 |
-
|
| 252 |
-
download_weight_output = gr.File(label="Download latest model")
|
| 253 |
|
| 254 |
-
|
| 255 |
-
|
| 256 |
-
|
| 257 |
-
|
| 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(
|