r3gm commited on
Commit
8b6afc9
1 Parent(s): 5456dde

Update infer-web.py

Browse files
Files changed (1) hide show
  1. infer-web.py +305 -305
infer-web.py CHANGED
@@ -1835,7 +1835,7 @@ def GradioSetup():
1835
  with gr.Blocks(theme=my_applio, title="Applio-RVC-Fork") as app:
1836
  gr.Markdown("🍏 Applio-RVC-Fork")
1837
 
1838
- gr.Markdown("More spaces: [RVC_Inference_HF](https://huggingface.co/spaces/r3gm/RVC_Inference_HF), [AICoverGen](https://huggingface.co/spaces/r3gm/AICoverGen), [Ultimate-Vocal-Remover-WebUI](https://huggingface.co/spaces/r3gm/Ultimate-Vocal-Remover-WebUI), [Advanced-RVC-Inference](https://huggingface.co/spaces/r3gm/Advanced-RVC-Inference)")
1839
 
1840
  gr.Markdown("Duplicate the space to select the language")
1841
  gr.Markdown(
@@ -2451,310 +2451,310 @@ def GradioSetup():
2451
  outputs=[advanced_settings_batch],
2452
  )
2453
 
2454
- # with gr.TabItem(i18n("Train")):
2455
- # with gr.Accordion(label=i18n("Step 1: Processing data")):
2456
- # with gr.Row():
2457
- # with gr.Column():
2458
- # exp_dir1 = gr.Textbox(
2459
- # label=i18n("Enter the model name:"),
2460
- # value=i18n("Model_Name"),
2461
- # )
2462
- # if_f0_3 = gr.Checkbox(
2463
- # label=i18n("Whether the model has pitch guidance."),
2464
- # value=True,
2465
- # interactive=True,
2466
- # )
2467
- # sr2 = gr.Radio(
2468
- # label=i18n("Target sample rate:"),
2469
- # choices=["40k", "48k", "32k"],
2470
- # value="40k",
2471
- # interactive=True,
2472
- # )
2473
- # version19 = gr.Radio(
2474
- # label=i18n("Version:"),
2475
- # choices=["v1", "v2"],
2476
- # value="v2",
2477
- # interactive=True,
2478
- # visible=True,
2479
- # )
2480
-
2481
- # with gr.Column():
2482
- # np7 = gr.Slider(
2483
- # minimum=1,
2484
- # maximum=config.n_cpu,
2485
- # step=1,
2486
- # label=i18n("Number of CPU processes:"),
2487
- # value=config.n_cpu,
2488
- # interactive=True,
2489
- # )
2490
- # spk_id5 = gr.Slider(
2491
- # minimum=0,
2492
- # maximum=4,
2493
- # step=1,
2494
- # label=i18n("Specify the model ID:"),
2495
- # value=0,
2496
- # interactive=True,
2497
- # )
2498
-
2499
- # with gr.Row():
2500
- # with gr.Column():
2501
- # trainset_dir4 = gr.Dropdown(
2502
- # choices=sorted(datasets),
2503
- # label=i18n("Select your dataset:"),
2504
- # value=get_dataset(),
2505
- # )
2506
-
2507
- # dataset_path = gr.Textbox(
2508
- # label=i18n("Or add your dataset path:"),
2509
- # interactive=True,
2510
- # )
2511
- # btn_update_dataset_list = gr.Button(
2512
- # i18n("Update list"), variant="primary"
2513
- # )
2514
-
2515
- # btn_update_dataset_list.click(
2516
- # resources.update_dataset_list, [spk_id5], trainset_dir4
2517
- # )
2518
- # but1 = gr.Button(i18n("Process data"), variant="primary")
2519
- # info1 = gr.Textbox(label=i18n("Output information:"), value="")
2520
- # but1.click(
2521
- # preprocess_dataset,
2522
- # [trainset_dir4, exp_dir1, sr2, np7, dataset_path],
2523
- # [info1],
2524
- # api_name="train_preprocess",
2525
- # )
2526
-
2527
- # with gr.Accordion(label=i18n("Step 2: Extracting features")):
2528
- # with gr.Row():
2529
- # with gr.Column():
2530
- # gpus6 = gr.Textbox(
2531
- # label=i18n(
2532
- # "Provide the GPU index(es) separated by '-', like 0-1-2 for using GPUs 0, 1, and 2:"
2533
- # ),
2534
- # value=gpus,
2535
- # interactive=True,
2536
- # )
2537
- # gpu_info9 = gr.Textbox(
2538
- # label=i18n("GPU Information:"),
2539
- # value=gpu_info,
2540
- # visible=F0GPUVisible,
2541
- # )
2542
- # with gr.Column():
2543
- # f0method8 = gr.Radio(
2544
- # label=i18n("Select the pitch extraction algorithm:"),
2545
- # choices=[
2546
- # "pm",
2547
- # "harvest",
2548
- # "dio",
2549
- # "crepe",
2550
- # "mangio-crepe",
2551
- # "rmvpe",
2552
- # "rmvpe_gpu",
2553
- # ],
2554
- # value="rmvpe",
2555
- # interactive=True,
2556
- # )
2557
- # hop_length = gr.Slider(
2558
- # minimum=1,
2559
- # maximum=512,
2560
- # step=1,
2561
- # label=i18n(
2562
- # "Hop Length (lower hop lengths take more time to infer but are more pitch accurate):"
2563
- # ),
2564
- # value=64,
2565
- # interactive=True,
2566
- # )
2567
-
2568
- # with gr.Row():
2569
- # but2 = gr.Button(i18n("Feature extraction"), variant="primary")
2570
- # info2 = gr.Textbox(
2571
- # label=i18n("Output information:"),
2572
- # value="",
2573
- # max_lines=8,
2574
- # interactive=False,
2575
- # )
2576
-
2577
- # but2.click(
2578
- # extract_f0_feature,
2579
- # [
2580
- # gpus6,
2581
- # np7,
2582
- # f0method8,
2583
- # if_f0_3,
2584
- # exp_dir1,
2585
- # version19,
2586
- # hop_length,
2587
- # ],
2588
- # [info2],
2589
- # api_name="train_extract_f0_feature",
2590
- # )
2591
-
2592
- # with gr.Row():
2593
- # with gr.Accordion(label=i18n("Step 3: Model training started")):
2594
- # with gr.Row():
2595
- # save_epoch10 = gr.Slider(
2596
- # minimum=1,
2597
- # maximum=100,
2598
- # step=1,
2599
- # label=i18n("Save frequency:"),
2600
- # value=10,
2601
- # interactive=True,
2602
- # visible=True,
2603
- # )
2604
- # total_epoch11 = gr.Slider(
2605
- # minimum=1,
2606
- # maximum=10000,
2607
- # step=2,
2608
- # label=i18n("Training epochs:"),
2609
- # value=750,
2610
- # interactive=True,
2611
- # )
2612
- # batch_size12 = gr.Slider(
2613
- # minimum=1,
2614
- # maximum=50,
2615
- # step=1,
2616
- # label=i18n("Batch size per GPU:"),
2617
- # value=default_batch_size,
2618
- # # value=20,
2619
- # interactive=True,
2620
- # )
2621
-
2622
- # with gr.Row():
2623
- # if_save_latest13 = gr.Checkbox(
2624
- # label=i18n(
2625
- # "Whether to save only the latest .ckpt file to save hard drive space"
2626
- # ),
2627
- # value=True,
2628
- # interactive=True,
2629
- # )
2630
- # if_cache_gpu17 = gr.Checkbox(
2631
- # label=i18n(
2632
- # "Cache all training sets to GPU memory. Caching small datasets (less than 10 minutes) can speed up training"
2633
- # ),
2634
- # value=False,
2635
- # interactive=True,
2636
- # )
2637
- # if_save_every_weights18 = gr.Checkbox(
2638
- # label=i18n(
2639
- # "Save a small final model to the 'weights' folder at each save point"
2640
- # ),
2641
- # value=True,
2642
- # interactive=True,
2643
- # )
2644
- # with gr.Column():
2645
- # with gr.Row():
2646
- # pretrained_G14 = gr.Textbox(
2647
- # label=i18n("Load pre-trained base model G path:"),
2648
- # value="assets/pretrained_v2/f0G40k.pth",
2649
- # interactive=True,
2650
- # )
2651
- # pretrained_D15 = gr.Textbox(
2652
- # label=i18n("Load pre-trained base model D path:"),
2653
- # value="assets/pretrained_v2/f0D40k.pth",
2654
- # interactive=True,
2655
- # )
2656
- # with gr.Row():
2657
- # gpus16 = gr.Textbox(
2658
- # label=i18n(
2659
- # "Provide the GPU index(es) separated by '-', like 0-1-2 for using GPUs 0, 1, and 2:"
2660
- # ),
2661
- # value=gpus,
2662
- # interactive=True,
2663
- # )
2664
- # sr2.change(
2665
- # change_sr2,
2666
- # [sr2, if_f0_3, version19],
2667
- # [pretrained_G14, pretrained_D15],
2668
- # )
2669
- # version19.change(
2670
- # change_version19,
2671
- # [sr2, if_f0_3, version19],
2672
- # [pretrained_G14, pretrained_D15, sr2],
2673
- # )
2674
- # if_f0_3.change(
2675
- # fn=change_f0,
2676
- # inputs=[if_f0_3, sr2, version19],
2677
- # outputs=[f0method8, pretrained_G14, pretrained_D15],
2678
- # )
2679
- # with gr.Row():
2680
- # butstop = gr.Button(
2681
- # i18n("Stop training"),
2682
- # variant="primary",
2683
- # visible=False,
2684
- # )
2685
- # but3 = gr.Button(
2686
- # i18n("Train model"), variant="primary", visible=True
2687
- # )
2688
- # but3.click(
2689
- # fn=stoptraining,
2690
- # inputs=[gr.Number(value=0, visible=False)],
2691
- # outputs=[but3, butstop],
2692
- # api_name="train_stop",
2693
- # )
2694
- # butstop.click(
2695
- # fn=stoptraining,
2696
- # inputs=[gr.Number(value=1, visible=False)],
2697
- # outputs=[but3, butstop],
2698
- # )
2699
- # info3 = gr.Textbox(
2700
- # label=i18n("Output information:"),
2701
- # value="",
2702
- # lines=4,
2703
- # max_lines=4,
2704
- # )
2705
-
2706
- # with gr.Column():
2707
- # save_action = gr.Dropdown(
2708
- # label=i18n("Save type"),
2709
- # choices=[
2710
- # i18n("Save all"),
2711
- # i18n("Save D and G"),
2712
- # i18n("Save voice"),
2713
- # ],
2714
- # value=i18n("Choose the method"),
2715
- # interactive=True,
2716
- # )
2717
- # but4 = gr.Button(
2718
- # i18n("Train feature index"), variant="primary"
2719
- # )
2720
-
2721
- # but7 = gr.Button(i18n("Save model"), variant="primary")
2722
-
2723
- # if_save_every_weights18.change(
2724
- # fn=lambda if_save_every_weights: (
2725
- # {
2726
- # "visible": if_save_every_weights,
2727
- # "__type__": "update",
2728
- # }
2729
- # ),
2730
- # inputs=[if_save_every_weights18],
2731
- # outputs=[save_epoch10],
2732
- # )
2733
-
2734
- # but3.click(
2735
- # click_train,
2736
- # [
2737
- # exp_dir1,
2738
- # sr2,
2739
- # if_f0_3,
2740
- # spk_id5,
2741
- # save_epoch10,
2742
- # total_epoch11,
2743
- # batch_size12,
2744
- # if_save_latest13,
2745
- # pretrained_G14,
2746
- # pretrained_D15,
2747
- # gpus16,
2748
- # if_cache_gpu17,
2749
- # if_save_every_weights18,
2750
- # version19,
2751
- # ],
2752
- # [info3, butstop, but3],
2753
- # api_name="train_start",
2754
- # )
2755
-
2756
- # but4.click(train_index, [exp_dir1, version19], info3)
2757
- # but7.click(resources.save_model, [exp_dir1, save_action], info3)
2758
 
2759
  with gr.TabItem(i18n("UVR5")): # UVR section
2760
  with gr.Row():
 
1835
  with gr.Blocks(theme=my_applio, title="Applio-RVC-Fork") as app:
1836
  gr.Markdown("🍏 Applio-RVC-Fork")
1837
 
1838
+ gr.Markdown("More spaces: [RVC_HF](https://huggingface.co/spaces/r3gm/RVC_HF), [AICoverGen](https://huggingface.co/spaces/r3gm/AICoverGen), [Ultimate-Vocal-Remover-WebUI](https://huggingface.co/spaces/r3gm/Ultimate-Vocal-Remover-WebUI), [Advanced-RVC-Inference](https://huggingface.co/spaces/r3gm/Advanced-RVC-Inference)")
1839
 
1840
  gr.Markdown("Duplicate the space to select the language")
1841
  gr.Markdown(
 
2451
  outputs=[advanced_settings_batch],
2452
  )
2453
 
2454
+ with gr.TabItem(i18n("Train")):
2455
+ with gr.Accordion(label=i18n("Step 1: Processing data")):
2456
+ with gr.Row():
2457
+ with gr.Column():
2458
+ exp_dir1 = gr.Textbox(
2459
+ label=i18n("Enter the model name:"),
2460
+ value=i18n("Model_Name"),
2461
+ )
2462
+ if_f0_3 = gr.Checkbox(
2463
+ label=i18n("Whether the model has pitch guidance."),
2464
+ value=True,
2465
+ interactive=True,
2466
+ )
2467
+ sr2 = gr.Radio(
2468
+ label=i18n("Target sample rate:"),
2469
+ choices=["40k", "48k", "32k"],
2470
+ value="40k",
2471
+ interactive=True,
2472
+ )
2473
+ version19 = gr.Radio(
2474
+ label=i18n("Version:"),
2475
+ choices=["v1", "v2"],
2476
+ value="v2",
2477
+ interactive=True,
2478
+ visible=True,
2479
+ )
2480
+
2481
+ with gr.Column():
2482
+ np7 = gr.Slider(
2483
+ minimum=1,
2484
+ maximum=config.n_cpu,
2485
+ step=1,
2486
+ label=i18n("Number of CPU processes:"),
2487
+ value=config.n_cpu,
2488
+ interactive=True,
2489
+ )
2490
+ spk_id5 = gr.Slider(
2491
+ minimum=0,
2492
+ maximum=4,
2493
+ step=1,
2494
+ label=i18n("Specify the model ID:"),
2495
+ value=0,
2496
+ interactive=True,
2497
+ )
2498
+
2499
+ with gr.Row():
2500
+ with gr.Column():
2501
+ trainset_dir4 = gr.Dropdown(
2502
+ choices=sorted(datasets),
2503
+ label=i18n("Select your dataset:"),
2504
+ value=get_dataset(),
2505
+ )
2506
+
2507
+ dataset_path = gr.Textbox(
2508
+ label=i18n("Or add your dataset path:"),
2509
+ interactive=True,
2510
+ )
2511
+ btn_update_dataset_list = gr.Button(
2512
+ i18n("Update list"), variant="primary"
2513
+ )
2514
+
2515
+ btn_update_dataset_list.click(
2516
+ resources.update_dataset_list, [spk_id5], trainset_dir4
2517
+ )
2518
+ but1 = gr.Button(i18n("Process data"), variant="primary")
2519
+ info1 = gr.Textbox(label=i18n("Output information:"), value="")
2520
+ but1.click(
2521
+ preprocess_dataset,
2522
+ [trainset_dir4, exp_dir1, sr2, np7, dataset_path],
2523
+ [info1],
2524
+ api_name="train_preprocess",
2525
+ )
2526
+
2527
+ with gr.Accordion(label=i18n("Step 2: Extracting features")):
2528
+ with gr.Row():
2529
+ with gr.Column():
2530
+ gpus6 = gr.Textbox(
2531
+ label=i18n(
2532
+ "Provide the GPU index(es) separated by '-', like 0-1-2 for using GPUs 0, 1, and 2:"
2533
+ ),
2534
+ value=gpus,
2535
+ interactive=True,
2536
+ )
2537
+ gpu_info9 = gr.Textbox(
2538
+ label=i18n("GPU Information:"),
2539
+ value=gpu_info,
2540
+ visible=F0GPUVisible,
2541
+ )
2542
+ with gr.Column():
2543
+ f0method8 = gr.Radio(
2544
+ label=i18n("Select the pitch extraction algorithm:"),
2545
+ choices=[
2546
+ "pm",
2547
+ "harvest",
2548
+ "dio",
2549
+ "crepe",
2550
+ "mangio-crepe",
2551
+ "rmvpe",
2552
+ "rmvpe_gpu",
2553
+ ],
2554
+ value="rmvpe",
2555
+ interactive=True,
2556
+ )
2557
+ hop_length = gr.Slider(
2558
+ minimum=1,
2559
+ maximum=512,
2560
+ step=1,
2561
+ label=i18n(
2562
+ "Hop Length (lower hop lengths take more time to infer but are more pitch accurate):"
2563
+ ),
2564
+ value=64,
2565
+ interactive=True,
2566
+ )
2567
+
2568
+ with gr.Row():
2569
+ but2 = gr.Button(i18n("Feature extraction"), variant="primary")
2570
+ info2 = gr.Textbox(
2571
+ label=i18n("Output information:"),
2572
+ value="",
2573
+ max_lines=8,
2574
+ interactive=False,
2575
+ )
2576
+
2577
+ but2.click(
2578
+ extract_f0_feature,
2579
+ [
2580
+ gpus6,
2581
+ np7,
2582
+ f0method8,
2583
+ if_f0_3,
2584
+ exp_dir1,
2585
+ version19,
2586
+ hop_length,
2587
+ ],
2588
+ [info2],
2589
+ api_name="train_extract_f0_feature",
2590
+ )
2591
+
2592
+ with gr.Row():
2593
+ with gr.Accordion(label=i18n("Step 3: Model training started")):
2594
+ with gr.Row():
2595
+ save_epoch10 = gr.Slider(
2596
+ minimum=1,
2597
+ maximum=100,
2598
+ step=1,
2599
+ label=i18n("Save frequency:"),
2600
+ value=10,
2601
+ interactive=True,
2602
+ visible=True,
2603
+ )
2604
+ total_epoch11 = gr.Slider(
2605
+ minimum=1,
2606
+ maximum=10000,
2607
+ step=2,
2608
+ label=i18n("Training epochs:"),
2609
+ value=750,
2610
+ interactive=True,
2611
+ )
2612
+ batch_size12 = gr.Slider(
2613
+ minimum=1,
2614
+ maximum=50,
2615
+ step=1,
2616
+ label=i18n("Batch size per GPU:"),
2617
+ value=default_batch_size,
2618
+ # value=20,
2619
+ interactive=True,
2620
+ )
2621
+
2622
+ with gr.Row():
2623
+ if_save_latest13 = gr.Checkbox(
2624
+ label=i18n(
2625
+ "Whether to save only the latest .ckpt file to save hard drive space"
2626
+ ),
2627
+ value=True,
2628
+ interactive=True,
2629
+ )
2630
+ if_cache_gpu17 = gr.Checkbox(
2631
+ label=i18n(
2632
+ "Cache all training sets to GPU memory. Caching small datasets (less than 10 minutes) can speed up training"
2633
+ ),
2634
+ value=False,
2635
+ interactive=True,
2636
+ )
2637
+ if_save_every_weights18 = gr.Checkbox(
2638
+ label=i18n(
2639
+ "Save a small final model to the 'weights' folder at each save point"
2640
+ ),
2641
+ value=True,
2642
+ interactive=True,
2643
+ )
2644
+ with gr.Column():
2645
+ with gr.Row():
2646
+ pretrained_G14 = gr.Textbox(
2647
+ label=i18n("Load pre-trained base model G path:"),
2648
+ value="assets/pretrained_v2/f0G40k.pth",
2649
+ interactive=True,
2650
+ )
2651
+ pretrained_D15 = gr.Textbox(
2652
+ label=i18n("Load pre-trained base model D path:"),
2653
+ value="assets/pretrained_v2/f0D40k.pth",
2654
+ interactive=True,
2655
+ )
2656
+ with gr.Row():
2657
+ gpus16 = gr.Textbox(
2658
+ label=i18n(
2659
+ "Provide the GPU index(es) separated by '-', like 0-1-2 for using GPUs 0, 1, and 2:"
2660
+ ),
2661
+ value=gpus,
2662
+ interactive=True,
2663
+ )
2664
+ sr2.change(
2665
+ change_sr2,
2666
+ [sr2, if_f0_3, version19],
2667
+ [pretrained_G14, pretrained_D15],
2668
+ )
2669
+ version19.change(
2670
+ change_version19,
2671
+ [sr2, if_f0_3, version19],
2672
+ [pretrained_G14, pretrained_D15, sr2],
2673
+ )
2674
+ if_f0_3.change(
2675
+ fn=change_f0,
2676
+ inputs=[if_f0_3, sr2, version19],
2677
+ outputs=[f0method8, pretrained_G14, pretrained_D15],
2678
+ )
2679
+ with gr.Row():
2680
+ butstop = gr.Button(
2681
+ i18n("Stop training"),
2682
+ variant="primary",
2683
+ visible=False,
2684
+ )
2685
+ but3 = gr.Button(
2686
+ i18n("Train model"), variant="primary", visible=True
2687
+ )
2688
+ but3.click(
2689
+ fn=stoptraining,
2690
+ inputs=[gr.Number(value=0, visible=False)],
2691
+ outputs=[but3, butstop],
2692
+ api_name="train_stop",
2693
+ )
2694
+ butstop.click(
2695
+ fn=stoptraining,
2696
+ inputs=[gr.Number(value=1, visible=False)],
2697
+ outputs=[but3, butstop],
2698
+ )
2699
+ info3 = gr.Textbox(
2700
+ label=i18n("Output information:"),
2701
+ value="",
2702
+ lines=4,
2703
+ max_lines=4,
2704
+ )
2705
+
2706
+ with gr.Column():
2707
+ save_action = gr.Dropdown(
2708
+ label=i18n("Save type"),
2709
+ choices=[
2710
+ i18n("Save all"),
2711
+ i18n("Save D and G"),
2712
+ i18n("Save voice"),
2713
+ ],
2714
+ value=i18n("Choose the method"),
2715
+ interactive=True,
2716
+ )
2717
+ but4 = gr.Button(
2718
+ i18n("Train feature index"), variant="primary"
2719
+ )
2720
+
2721
+ but7 = gr.Button(i18n("Save model"), variant="primary")
2722
+
2723
+ if_save_every_weights18.change(
2724
+ fn=lambda if_save_every_weights: (
2725
+ {
2726
+ "visible": if_save_every_weights,
2727
+ "__type__": "update",
2728
+ }
2729
+ ),
2730
+ inputs=[if_save_every_weights18],
2731
+ outputs=[save_epoch10],
2732
+ )
2733
+
2734
+ but3.click(
2735
+ click_train,
2736
+ [
2737
+ exp_dir1,
2738
+ sr2,
2739
+ if_f0_3,
2740
+ spk_id5,
2741
+ save_epoch10,
2742
+ total_epoch11,
2743
+ batch_size12,
2744
+ if_save_latest13,
2745
+ pretrained_G14,
2746
+ pretrained_D15,
2747
+ gpus16,
2748
+ if_cache_gpu17,
2749
+ if_save_every_weights18,
2750
+ version19,
2751
+ ],
2752
+ [info3, butstop, but3],
2753
+ api_name="train_start",
2754
+ )
2755
+
2756
+ but4.click(train_index, [exp_dir1, version19], info3)
2757
+ but7.click(resources.save_model, [exp_dir1, save_action], info3)
2758
 
2759
  with gr.TabItem(i18n("UVR5")): # UVR section
2760
  with gr.Row():