Spaces:
Build error
Build error
added dropdown to select which whisper model to use for transcription, added note that FFMPEG is required
Browse files- README.md +15 -1
- src/utils.py +6 -2
- src/webui.py +7 -2
- start.bat +1 -0
README.md
CHANGED
|
@@ -223,7 +223,17 @@ To import a voice, click `Import Voice`. Remember to click `Refresh Voice List`
|
|
| 223 |
|
| 224 |
This tab will contain a collection of sub-tabs pertaining to training.
|
| 225 |
|
| 226 |
-
####
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 227 |
|
| 228 |
This will generate the YAML necessary to feed into training. For now, you can set:
|
| 229 |
* `Batch Size`: size of batches for training, more batches = faster training, at the cost of higher VRAM. setting this to 1 will lead to problems
|
|
@@ -255,6 +265,10 @@ Below are settings that override the default launch arguments. Some of these req
|
|
| 255 |
* `Embed Output Metadata`: enables embedding the settings and latents used to generate that audio clip inside that audio clip. Metadata is stored as a JSON string in the `lyrics` tag.
|
| 256 |
* `Slimmer Computed Latents`: falls back to the original, 12.9KiB way of storing latents (without the extra bits required for using the CVVP model).
|
| 257 |
* `Voice Fixer`: runs each generated audio clip through `voicefixer`, if available and installed.
|
|
|
|
|
|
|
|
|
|
|
|
|
| 258 |
* `Voice Latent Max Chunk Size`: during the voice latents calculation pass, this limits how large, in bytes, a chunk can be. Large values can run into VRAM OOM errors.
|
| 259 |
* `Sample Batch Size`: sets the batch size when generating autoregressive samples. Bigger batches result in faster compute, at the cost of increased VRAM consumption. Leave to 0 to calculate a "best" fit.
|
| 260 |
* `Concurrency Count`: how many Gradio events the queue can process at once. Leave this over 1 if you want to modify settings in the UI that updates other settings while generating audio clips.
|
|
|
|
| 223 |
|
| 224 |
This tab will contain a collection of sub-tabs pertaining to training.
|
| 225 |
|
| 226 |
+
#### Prepare Dataset
|
| 227 |
+
|
| 228 |
+
This section will aid in preparing the dataset for fine-tuning.
|
| 229 |
+
|
| 230 |
+
With it, you simply select a voice, then click the button, and wait for the console to tell you it's done. The results will be saved to `./training/{voice name}/`.
|
| 231 |
+
|
| 232 |
+
The web UI will leverage [openai/whisper](https://github.com/openai/whisper) to transcribe a given sample source, and split them into convenient pieces.
|
| 233 |
+
|
| 234 |
+
**!**NOTE**!**: transcription leverages FFMPEG, so please make sure you either have an FFMPEG installed visible to your PATH, or drop the binary in the `./bin/` folder.
|
| 235 |
+
|
| 236 |
+
#### Generate Configuration
|
| 237 |
|
| 238 |
This will generate the YAML necessary to feed into training. For now, you can set:
|
| 239 |
* `Batch Size`: size of batches for training, more batches = faster training, at the cost of higher VRAM. setting this to 1 will lead to problems
|
|
|
|
| 265 |
* `Embed Output Metadata`: enables embedding the settings and latents used to generate that audio clip inside that audio clip. Metadata is stored as a JSON string in the `lyrics` tag.
|
| 266 |
* `Slimmer Computed Latents`: falls back to the original, 12.9KiB way of storing latents (without the extra bits required for using the CVVP model).
|
| 267 |
* `Voice Fixer`: runs each generated audio clip through `voicefixer`, if available and installed.
|
| 268 |
+
* `Use CUDA for Voice Fixer`: allows voicefixer to use CUDA. Speeds up cleaning the output, but at the cost of more VRAM consumed. Disable if you OOM.
|
| 269 |
+
* `Device Override`: overrides the device name used to pass to PyTorch for hardware acceleration. You can use the accompanied `list_devices.py` script to map valid strings to GPU names. You can also pass `cpu` if you want to fallback to software mode.
|
| 270 |
+
* `Whisper Model`: the specific model to use for Whisper transcription, when preparing a dataset to finetune with.
|
| 271 |
+
|
| 272 |
* `Voice Latent Max Chunk Size`: during the voice latents calculation pass, this limits how large, in bytes, a chunk can be. Large values can run into VRAM OOM errors.
|
| 273 |
* `Sample Batch Size`: sets the batch size when generating autoregressive samples. Bigger batches result in faster compute, at the cost of increased VRAM consumption. Leave to 0 to calculate a "best" fit.
|
| 274 |
* `Concurrency Count`: how many Gradio events the queue can process at once. Leave this over 1 if you want to modify settings in the UI that updates other settings while generating audio clips.
|
src/utils.py
CHANGED
|
@@ -57,6 +57,7 @@ def setup_args():
|
|
| 57 |
'voice-fixer-use-cuda': True,
|
| 58 |
'force-cpu-for-conditioning-latents': False,
|
| 59 |
'device-override': None,
|
|
|
|
| 60 |
'concurrency-count': 2,
|
| 61 |
'output-sample-rate': 44100,
|
| 62 |
'output-volume': 1,
|
|
@@ -80,6 +81,7 @@ def setup_args():
|
|
| 80 |
parser.add_argument("--voice-fixer-use-cuda", action='store_true', default=default_arguments['voice-fixer-use-cuda'], help="Hints to voicefixer to use CUDA, if available.")
|
| 81 |
parser.add_argument("--force-cpu-for-conditioning-latents", default=default_arguments['force-cpu-for-conditioning-latents'], action='store_true', help="Forces computing conditional latents to be done on the CPU (if you constantyl OOM on low chunk counts)")
|
| 82 |
parser.add_argument("--device-override", default=default_arguments['device-override'], help="A device string to override pass through Torch")
|
|
|
|
| 83 |
parser.add_argument("--sample-batch-size", default=default_arguments['sample-batch-size'], type=int, help="Sets how many batches to use during the autoregressive samples pass")
|
| 84 |
parser.add_argument("--concurrency-count", type=int, default=default_arguments['concurrency-count'], help="How many Gradio events to process at once")
|
| 85 |
parser.add_argument("--output-sample-rate", type=int, default=default_arguments['output-sample-rate'], help="Sample rate to resample the output to (from 24KHz)")
|
|
@@ -463,7 +465,7 @@ whisper_model = None
|
|
| 463 |
def prepare_dataset( files, outdir ):
|
| 464 |
global whisper_model
|
| 465 |
if whisper_model is None:
|
| 466 |
-
whisper_model = whisper.load_model(
|
| 467 |
|
| 468 |
os.makedirs(outdir, exist_ok=True)
|
| 469 |
|
|
@@ -653,7 +655,7 @@ def get_voice_list(dir=get_voice_dir()):
|
|
| 653 |
os.makedirs(dir, exist_ok=True)
|
| 654 |
return sorted([d for d in os.listdir(dir) if os.path.isdir(os.path.join(dir, d)) and len(os.listdir(os.path.join(dir, d))) > 0 ]) + ["microphone", "random"]
|
| 655 |
|
| 656 |
-
def export_exec_settings( listen, share, check_for_updates, models_from_local_only, low_vram, embed_output_metadata, latents_lean_and_mean, voice_fixer, voice_fixer_use_cuda, force_cpu_for_conditioning_latents, device_override, sample_batch_size, concurrency_count, output_sample_rate, output_volume ):
|
| 657 |
global args
|
| 658 |
|
| 659 |
args.listen = listen
|
|
@@ -663,6 +665,7 @@ def export_exec_settings( listen, share, check_for_updates, models_from_local_on
|
|
| 663 |
args.low_vram = low_vram
|
| 664 |
args.force_cpu_for_conditioning_latents = force_cpu_for_conditioning_latents
|
| 665 |
args.device_override = device_override
|
|
|
|
| 666 |
args.sample_batch_size = sample_batch_size
|
| 667 |
args.embed_output_metadata = embed_output_metadata
|
| 668 |
args.latents_lean_and_mean = latents_lean_and_mean
|
|
@@ -680,6 +683,7 @@ def export_exec_settings( listen, share, check_for_updates, models_from_local_on
|
|
| 680 |
'models-from-local-only':args.models_from_local_only,
|
| 681 |
'force-cpu-for-conditioning-latents': args.force_cpu_for_conditioning_latents,
|
| 682 |
'device-override': args.device_override,
|
|
|
|
| 683 |
'sample-batch-size': args.sample_batch_size,
|
| 684 |
'embed-output-metadata': args.embed_output_metadata,
|
| 685 |
'latents-lean-and-mean': args.latents_lean_and_mean,
|
|
|
|
| 57 |
'voice-fixer-use-cuda': True,
|
| 58 |
'force-cpu-for-conditioning-latents': False,
|
| 59 |
'device-override': None,
|
| 60 |
+
'whisper-model': "base",
|
| 61 |
'concurrency-count': 2,
|
| 62 |
'output-sample-rate': 44100,
|
| 63 |
'output-volume': 1,
|
|
|
|
| 81 |
parser.add_argument("--voice-fixer-use-cuda", action='store_true', default=default_arguments['voice-fixer-use-cuda'], help="Hints to voicefixer to use CUDA, if available.")
|
| 82 |
parser.add_argument("--force-cpu-for-conditioning-latents", default=default_arguments['force-cpu-for-conditioning-latents'], action='store_true', help="Forces computing conditional latents to be done on the CPU (if you constantyl OOM on low chunk counts)")
|
| 83 |
parser.add_argument("--device-override", default=default_arguments['device-override'], help="A device string to override pass through Torch")
|
| 84 |
+
parser.add_argument("--whisper-model", default=default_arguments['whisper-model'], help="Specifies which whisper model to use for transcription.")
|
| 85 |
parser.add_argument("--sample-batch-size", default=default_arguments['sample-batch-size'], type=int, help="Sets how many batches to use during the autoregressive samples pass")
|
| 86 |
parser.add_argument("--concurrency-count", type=int, default=default_arguments['concurrency-count'], help="How many Gradio events to process at once")
|
| 87 |
parser.add_argument("--output-sample-rate", type=int, default=default_arguments['output-sample-rate'], help="Sample rate to resample the output to (from 24KHz)")
|
|
|
|
| 465 |
def prepare_dataset( files, outdir ):
|
| 466 |
global whisper_model
|
| 467 |
if whisper_model is None:
|
| 468 |
+
whisper_model = whisper.load_model(args.whisper_model)
|
| 469 |
|
| 470 |
os.makedirs(outdir, exist_ok=True)
|
| 471 |
|
|
|
|
| 655 |
os.makedirs(dir, exist_ok=True)
|
| 656 |
return sorted([d for d in os.listdir(dir) if os.path.isdir(os.path.join(dir, d)) and len(os.listdir(os.path.join(dir, d))) > 0 ]) + ["microphone", "random"]
|
| 657 |
|
| 658 |
+
def export_exec_settings( listen, share, check_for_updates, models_from_local_only, low_vram, embed_output_metadata, latents_lean_and_mean, voice_fixer, voice_fixer_use_cuda, force_cpu_for_conditioning_latents, device_override, whisper_model, sample_batch_size, concurrency_count, output_sample_rate, output_volume ):
|
| 659 |
global args
|
| 660 |
|
| 661 |
args.listen = listen
|
|
|
|
| 665 |
args.low_vram = low_vram
|
| 666 |
args.force_cpu_for_conditioning_latents = force_cpu_for_conditioning_latents
|
| 667 |
args.device_override = device_override
|
| 668 |
+
args.whisper_model = whisper_model
|
| 669 |
args.sample_batch_size = sample_batch_size
|
| 670 |
args.embed_output_metadata = embed_output_metadata
|
| 671 |
args.latents_lean_and_mean = latents_lean_and_mean
|
|
|
|
| 683 |
'models-from-local-only':args.models_from_local_only,
|
| 684 |
'force-cpu-for-conditioning-latents': args.force_cpu_for_conditioning_latents,
|
| 685 |
'device-override': args.device_override,
|
| 686 |
+
'whisper-model': args.whisper_model,
|
| 687 |
'sample-batch-size': args.sample_batch_size,
|
| 688 |
'embed-output-metadata': args.embed_output_metadata,
|
| 689 |
'latents-lean-and-mean': args.latents_lean_and_mean,
|
src/webui.py
CHANGED
|
@@ -370,6 +370,7 @@ def setup_gradio():
|
|
| 370 |
]
|
| 371 |
)
|
| 372 |
with gr.Tab("Training"):
|
|
|
|
| 373 |
with gr.Row():
|
| 374 |
with gr.Column():
|
| 375 |
dataset_settings = [
|
|
@@ -377,6 +378,7 @@ def setup_gradio():
|
|
| 377 |
]
|
| 378 |
dataset_voices = dataset_settings[0]
|
| 379 |
|
|
|
|
| 380 |
prepare_dataset_button = gr.Button(value="Prepare")
|
| 381 |
|
| 382 |
def prepare_dataset_proxy( voice ):
|
|
@@ -387,7 +389,8 @@ def setup_gradio():
|
|
| 387 |
inputs=dataset_settings,
|
| 388 |
outputs=None
|
| 389 |
)
|
| 390 |
-
|
|
|
|
| 391 |
with gr.Column():
|
| 392 |
training_settings = [
|
| 393 |
gr.Slider(label="Batch Size", value=128),
|
|
@@ -395,6 +398,7 @@ def setup_gradio():
|
|
| 395 |
gr.Number(label="Print Frequency", value=50),
|
| 396 |
gr.Number(label="Save Frequency", value=50),
|
| 397 |
]
|
|
|
|
| 398 |
with gr.Column():
|
| 399 |
training_settings = training_settings + [
|
| 400 |
gr.Textbox(label="Training Name", placeholder="finetune"),
|
|
@@ -403,7 +407,7 @@ def setup_gradio():
|
|
| 403 |
gr.Textbox(label="Validation Name", placeholder="finetune"),
|
| 404 |
gr.Textbox(label="Validation Path", placeholder="./experiments/finetune/val.txt"),
|
| 405 |
]
|
| 406 |
-
|
| 407 |
save_yaml_button.click(save_training_settings,
|
| 408 |
inputs=training_settings,
|
| 409 |
outputs=None
|
|
@@ -424,6 +428,7 @@ def setup_gradio():
|
|
| 424 |
gr.Checkbox(label="Use CUDA for Voice Fixer", value=args.voice_fixer_use_cuda),
|
| 425 |
gr.Checkbox(label="Force CPU for Conditioning Latents", value=args.force_cpu_for_conditioning_latents),
|
| 426 |
gr.Textbox(label="Device Override", value=args.device_override),
|
|
|
|
| 427 |
]
|
| 428 |
gr.Button(value="Check for Updates").click(check_for_updates)
|
| 429 |
gr.Button(value="Reload TTS").click(reload_tts)
|
|
|
|
| 370 |
]
|
| 371 |
)
|
| 372 |
with gr.Tab("Training"):
|
| 373 |
+
with gr.Tab("Prepare Dataset"):
|
| 374 |
with gr.Row():
|
| 375 |
with gr.Column():
|
| 376 |
dataset_settings = [
|
|
|
|
| 378 |
]
|
| 379 |
dataset_voices = dataset_settings[0]
|
| 380 |
|
| 381 |
+
with gr.Column():
|
| 382 |
prepare_dataset_button = gr.Button(value="Prepare")
|
| 383 |
|
| 384 |
def prepare_dataset_proxy( voice ):
|
|
|
|
| 389 |
inputs=dataset_settings,
|
| 390 |
outputs=None
|
| 391 |
)
|
| 392 |
+
with gr.Tab("Generate Configuration"):
|
| 393 |
+
with gr.Row():
|
| 394 |
with gr.Column():
|
| 395 |
training_settings = [
|
| 396 |
gr.Slider(label="Batch Size", value=128),
|
|
|
|
| 398 |
gr.Number(label="Print Frequency", value=50),
|
| 399 |
gr.Number(label="Save Frequency", value=50),
|
| 400 |
]
|
| 401 |
+
save_yaml_button = gr.Button(value="Save Training Configuration")
|
| 402 |
with gr.Column():
|
| 403 |
training_settings = training_settings + [
|
| 404 |
gr.Textbox(label="Training Name", placeholder="finetune"),
|
|
|
|
| 407 |
gr.Textbox(label="Validation Name", placeholder="finetune"),
|
| 408 |
gr.Textbox(label="Validation Path", placeholder="./experiments/finetune/val.txt"),
|
| 409 |
]
|
| 410 |
+
|
| 411 |
save_yaml_button.click(save_training_settings,
|
| 412 |
inputs=training_settings,
|
| 413 |
outputs=None
|
|
|
|
| 428 |
gr.Checkbox(label="Use CUDA for Voice Fixer", value=args.voice_fixer_use_cuda),
|
| 429 |
gr.Checkbox(label="Force CPU for Conditioning Latents", value=args.force_cpu_for_conditioning_latents),
|
| 430 |
gr.Textbox(label="Device Override", value=args.device_override),
|
| 431 |
+
gr.Dropdown(label="Whisper Model", value=args.whisper_model, choices=["tiny", "base", "small", "medium", "large"]),
|
| 432 |
]
|
| 433 |
gr.Button(value="Check for Updates").click(check_for_updates)
|
| 434 |
gr.Button(value="Reload TTS").click(reload_tts)
|
start.bat
CHANGED
|
@@ -1,4 +1,5 @@
|
|
| 1 |
call .\venv\Scripts\activate.bat
|
|
|
|
| 2 |
python .\src\main.py
|
| 3 |
deactivate
|
| 4 |
pause
|
|
|
|
| 1 |
call .\venv\Scripts\activate.bat
|
| 2 |
+
set PATH=.\bin\;%PATH%
|
| 3 |
python .\src\main.py
|
| 4 |
deactivate
|
| 5 |
pause
|