Blane187 commited on
Commit
f3630ac
·
verified ·
1 Parent(s): 9a6579e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +46 -50
app.py CHANGED
@@ -21,7 +21,8 @@ with gr.Blocks(title="RVC UI") as app:
21
 
22
  with gr.Tabs():
23
  models = gr.Dropdown(label="voice model", choices=sorted(names))
24
- clean_button = gr.Button("Refresh model", variant="primary")
 
25
  with gr.Row():
26
  with gr.Row():
27
  pith_voice = gr.Number(label="Transpose 12 for femal, -12 fo male)", value=0)
@@ -63,53 +64,48 @@ with gr.Blocks(title="RVC UI") as app:
63
  but1 = gr.Button("Convert", variant="primary")
64
  vc_output3 = gr.Textbox(label="Output information", interactive=False)
65
 
66
- with gr.TabItem("Train"):
67
- gr.Markdown("### Step 1. Fill in the experimental configuration.\nExperimental data is stored in the 'logs' folder, with each experiment having a separate folder. Manually enter the experiment name path, which contains the experimental configuration, logs, and trained model files.")
68
- exp_dir1 = gr.Textbox(label="Enter the experiment name", value="my voice")
69
- author = gr.Textbox(label="Model Author (Nullable)")
70
- #np7 = gr.Slider(minimum=0, maximum=config.n_cpu, step=1, label="Number of CPU processes used for pitch extraction and data processing", value=int(np.ceil(config.n_cpu / 1.5)), interactive=True)
71
- sr2 = gr.Radio(label="Target sample rate", choices=["40k", "48k"], value="40k", interactive=True)
72
- if_f0_3 = gr.Radio(label="Whether the model has pitch guidance (required for singing, optional for speech)", choices=["Yes", "No"], value="Yes", interactive=True)
73
- version19 = gr.Radio(label="Version", choices=["v1", "v2"], value="v2", interactive=True, visible=True)
74
- gr.Markdown("### Step 2. Audio processing. \n#### 1. Slicing.\nAutomatically traverse all files in the training folder that can be decoded into audio and perform slice normalization. Generates 2 wav folders in the experiment directory. Currently, only single-singer/speaker training is supported.")
75
-
76
- trainset_dir4 = gr.Textbox(label="Enter the path of the training folder")
77
- spk_id5 = gr.Slider(minimum=0, maximum=4, step=1, label="Please specify the speaker/singer ID", value=0, interactive=True)
78
- but1 = gr.Button("Process data", variant="primary")
79
-
80
- info1 = gr.Textbox(label="Output information", value="")
81
- #but1.click(preprocess_dataset,[trainset_dir4, exp_dir1, sr2, np7],[info1],api_name="train_preprocess")
82
- gr.Markdown("#### 2. Feature extraction.\nUse CPU to extract pitch (if the model has pitch), use GPU to extract features (select GPU index).")
83
-
84
- #gpu_info9 = gr.Textbox(label="GPU Information",value=gpu_info,visible=F0GPUVisible)
85
- #gpus6 = gr.Textbox(label="Enter the GPU index(es) separated by '-', e.g., 0-1-2 to use GPU 0, 1, and 2",value=gpus,interactive=True,visible=F0GPUVisible)
86
- #gpus_rmvpe = gr.Textbox(label="Enter the GPU index(es) separated by '-', e.g., 0-0-1 to use 2 processes in GPU0 and 1 process in GPU1",value="%s-%s" % (gpus, gpus),interactive=True,visible=F0GPUVisible)
87
- f0method8 = gr.Radio(label="Select the pitch extraction algorithm: when extracting singing, you can use 'pm' to speed up. For high-quality speech with fast performance, but worse CPU usage, you can use 'dio'. 'harvest' results in better quality but is slower. 'rmvpe' has the best results and consumes less CPU/GPU", choices=["pm", "harvest", "dio", "rmvpe", "rmvpe_gpu"], value="rmvpe_gpu", interactive=True)
88
-
89
- but2 = gr.Button("Feature extraction", variant="primary")
90
- info2 = gr.Textbox(label="Output information", value="")
91
- #f0method8.change(fn=change_f0_method,inputs=[f0method8],outputs=[gpus_rmvpe])
92
- #but2.click(extract_f0_feature,[gpus6,np7,f0method8,if_f0_3,exp_dir1,version19,gpus_rmvpe,],[info2],api_name="train_extract_f0_feature")
93
- gr.Markdown("### Step 3. Start training.\nFill in the training settings and start training the model and index.")
94
- save_epoch10 = gr.Slider(minimum=1, maximum=50, step=1, label="Save frequency (save_every_epoch)", value=5, interactive=True)
95
- total_epoch11 = gr.Slider(minimum=2, maximum=1000, step=1, label="Total training epochs (total_epoch)", value=20, interactive=True)
96
- batch_size12 = gr.Slider(minimum=1, maximum=40, step=1, label="Batch size per GPU", value=20, interactive=True)
97
- if_save_latest13 = gr.Radio(label="Save only the latest '.ckpt' file to save disk space", choices=["Yes", "No"], value="No", interactive=True)
98
- if_cache_gpu17 = gr.Radio(label="Cache all training sets to GPU memory. Caching small datasets (less than 10 minutes) can speed up training, but caching large datasets will consume a lot of GPU memory and may not provide much speed improvement", choices=["Yes", "No"], value="No", interactive=True)
99
- if_save_every_weights18 = gr.Radio(label="Save a small final model to the 'weights' folder at each save point", choices=["Yes","No"], value="No", interactive=True)
100
-
101
- pretrained_G14 = gr.Textbox(label="Load pre-trained base model G path", value="assets/pretrained_v2/f0G40k.pth", interactive=True)
102
- pretrained_D15 = gr.Textbox(label="Load pre-trained base model D path", value="assets/pretrained_v2/f0D40k.pth", interactive=True)
103
- gpus16 = gr.Textbox(label="Enter the GPU index(es) separated by '-', e.g., 0-1-2 to use GPU 0, 1, and 2", value="0", interactive=True)
104
- #sr2.change(change_sr2,[sr2, if_f0_3, version19],[pretrained_G14, pretrained_D15])
105
- #version19.change(change_version19,[sr2, if_f0_3, version19],[pretrained_G14, pretrained_D15, sr2])
106
- #if_f0_3.change(fn=lambda: None, inputs=[if_f0_3, sr2, version19], outputs=[f0method8, gpus_rmvpe, pretrained_G14, pretrained_D15])
107
- but3 = gr.Button("Train model", variant="primary")
108
- but4 = gr.Button("Train feature index", variant="primary")
109
- but5 = gr.Button("One-click training", variant="primary")
110
- #info3 = gr.Textbox(label=i18n("Output information"), value="")
111
- #but3.click(click_train,[exp_dir1,sr2,if_f0_3,spk_id5,save_epoch10,total_epoch11,batch_size12,if_save_latest13,pretrained_G14,pretrained_D15,gpus16,if_cache_gpu17,if_save_every_weights18,version19,author,],info3,api_name="train_start")
112
- #but4.click(train_index, [exp_dir1, version19], info3)
113
- #but5.click(train1key,[exp_dir1,sr2,if_f0_3,trainset_dir4,spk_id5,np7,f0method8,save_epoch10,total_epoch11,batch_size12,if_save_latest13,pretrained_G14,pretrained_D15,gpus16,if_cache_gpu17,if_save_every_weights18,version19,gpus_rmvpe,author],info3,api_name="train_start_all")
114
 
115
- app.launch()
 
21
 
22
  with gr.Tabs():
23
  models = gr.Dropdown(label="voice model", choices=sorted(names))
24
+ with gr.Row():
25
+ clean_button = gr.Button("Refresh model", variant="primary")
26
  with gr.Row():
27
  with gr.Row():
28
  pith_voice = gr.Number(label="Transpose 12 for femal, -12 fo male)", value=0)
 
64
  but1 = gr.Button("Convert", variant="primary")
65
  vc_output3 = gr.Textbox(label="Output information", interactive=False)
66
 
67
+ with gr.TabItem("Train"):
68
+ gr.Markdown("### Step 1. Fill in the experimental configuration.\nExperimental data is stored in the 'logs' folder, with each experiment having a separate folder. Manually enter the experiment name path, which contains the experimental configuration, logs, and trained model files.")
69
+ exp_dir1 = gr.Textbox(label="Enter the experiment name", value="my voice")
70
+ author = gr.Textbox(label="Model Author (Nullable)")
71
+ #np7 = gr.Slider(minimum=0, maximum=config.n_cpu, step=1, label="Number of CPU processes used for pitch extraction and data processing", value=int(np.ceil(config.n_cpu / 1.5)), interactive=True)
72
+ sr2 = gr.Radio(label="Target sample rate", choices=["40k", "48k"], value="40k", interactive=True)
73
+ if_f0_3 = gr.Radio(label="Whether the model has pitch guidance (required for singing, optional for speech)", choices=["Yes", "No"], value="Yes", interactive=True)
74
+ version19 = gr.Radio(label="Version", choices=["v1", "v2"], value="v2", interactive=True, visible=True)
75
+ gr.Markdown("### Step 2. Audio processing. \n#### 1. Slicing.\nAutomatically traverse all files in the training folder that can be decoded into audio and perform slice normalization. Generates 2 wav folders in the experiment directory. Currently, only single-singer/speaker training is supported.")
76
+ trainset_dir4 = gr.Textbox(label="Enter the path of the training folder")
77
+ spk_id5 = gr.Slider(minimum=0, maximum=4, step=1, label="Please specify the speaker/singer ID", value=0, interactive=True)
78
+ but1 = gr.Button("Process data", variant="primary")
79
+ info1 = gr.Textbox(label="Output information", value="")
80
+ #but1.click(preprocess_dataset,[trainset_dir4, exp_dir1, sr2, np7],[info1],api_name="train_preprocess")
81
+ gr.Markdown("#### 2. Feature extraction.\nUse CPU to extract pitch (if the model has pitch), use GPU to extract features (select GPU index).")
82
+ #gpu_info9 = gr.Textbox(label="GPU Information",value=gpu_info,visible=F0GPUVisible)
83
+ #gpus6 = gr.Textbox(label="Enter the GPU index(es) separated by '-', e.g., 0-1-2 to use GPU 0, 1, and 2",value=gpus,interactive=True,visible=F0GPUVisible)
84
+ #gpus_rmvpe = gr.Textbox(label="Enter the GPU index(es) separated by '-', e.g., 0-0-1 to use 2 processes in GPU0 and 1 process in GPU1",value="%s-%s" % (gpus, gpus),interactive=True,visible=F0GPUVisible)
85
+ f0method8 = gr.Radio(label="Select the pitch extraction algorithm: when extracting singing, you can use 'pm' to speed up. For high-quality speech with fast performance, but worse CPU usage, you can use 'dio'. 'harvest' results in better quality but is slower. 'rmvpe' has the best results and consumes less CPU/GPU", choices=["pm", "harvest", "dio", "rmvpe", "rmvpe_gpu"], value="rmvpe_gpu", interactive=True)
86
+ but2 = gr.Button("Feature extraction", variant="primary")
87
+ info2 = gr.Textbox(label="Output information", value="")
88
+ #f0method8.change(fn=change_f0_method,inputs=[f0method8],outputs=[gpus_rmvpe])
89
+ #but2.click(extract_f0_feature,[gpus6,np7,f0method8,if_f0_3,exp_dir1,version19,gpus_rmvpe,],[info2],api_name="train_extract_f0_feature")
90
+ gr.Markdown("### Step 3. Start training.\nFill in the training settings and start training the model and index.")
91
+ save_epoch10 = gr.Slider(minimum=1, maximum=50, step=1, label="Save frequency (save_every_epoch)", value=5, interactive=True)
92
+ total_epoch11 = gr.Slider(minimum=2, maximum=1000, step=1, label="Total training epochs (total_epoch)", value=20, interactive=True)
93
+ batch_size12 = gr.Slider(minimum=1, maximum=40, step=1, label="Batch size per GPU", value=20, interactive=True)
94
+ if_save_latest13 = gr.Radio(label="Save only the latest '.ckpt' file to save disk space", choices=["Yes", "No"], value="No", interactive=True)
95
+ if_cache_gpu17 = gr.Radio(label="Cache all training sets to GPU memory. Caching small datasets (less than 10 minutes) can speed up training, but caching large datasets will consume a lot of GPU memory and may not provide much speed improvement", choices=["Yes", "No"], value="No", interactive=True)
96
+ if_save_every_weights18 = gr.Radio(label="Save a small final model to the 'weights' folder at each save point", choices=["Yes","No"], value="No", interactive=True)
97
+ pretrained_G14 = gr.Textbox(label="Load pre-trained base model G path", value="assets/pretrained_v2/f0G40k.pth", interactive=True)
98
+ pretrained_D15 = gr.Textbox(label="Load pre-trained base model D path", value="assets/pretrained_v2/f0D40k.pth", interactive=True)
99
+ gpus16 = gr.Textbox(label="Enter the GPU index(es) separated by '-', e.g., 0-1-2 to use GPU 0, 1, and 2", value="0", interactive=True)
100
+ #sr2.change(change_sr2,[sr2, if_f0_3, version19],[pretrained_G14, pretrained_D15])
101
+ #version19.change(change_version19,[sr2, if_f0_3, version19],[pretrained_G14, pretrained_D15, sr2])
102
+ #if_f0_3.change(fn=lambda: None, inputs=[if_f0_3, sr2, version19], outputs=[f0method8, gpus_rmvpe, pretrained_G14, pretrained_D15])
103
+ but3 = gr.Button("Train model", variant="primary")
104
+ but4 = gr.Button("Train feature index", variant="primary")
105
+ but5 = gr.Button("One-click training", variant="primary")
106
+ #info3 = gr.Textbox(label=i18n("Output information"), value="")
107
+ #but3.click(click_train,[exp_dir1,sr2,if_f0_3,spk_id5,save_epoch10,total_epoch11,batch_size12,if_save_latest13,pretrained_G14,pretrained_D15,gpus16,if_cache_gpu17,if_save_every_weights18,version19,author,],info3,api_name="train_start")
108
+ #but4.click(train_index, [exp_dir1, version19], info3)
109
+ #but5.click(train1key,[exp_dir1,sr2,if_f0_3,trainset_dir4,spk_id5,np7,f0method8,save_epoch10,total_epoch11,batch_size12,if_save_latest13,pretrained_G14,pretrained_D15,gpus16,if_cache_gpu17,if_save_every_weights18,version19,gpus_rmvpe,author],info3,api_name="train_start_all")
 
 
 
 
 
110
 
111
+ app.launch(view_api=False)