Updates to TTS Engines
This commit is contained in:
1 parent
7e73053fd7
commit
1a5c10710d
19 files changed
+6420
-2572
No files matched your search
@@ -2,8 +2,16 @@ import os
|
||||
import json
|
||||
import requests
|
||||
import gradio as gr
|
||||
import whisper
|
||||
from typing import List, Tuple
|
||||
from tqdm import tqdm
|
||||
from pathlib import Path
|
||||
import gc
|
||||
import torch
|
||||
import warnings
|
||||
# Filter Flash Attention warning
|
||||
warnings.filterwarnings("ignore", message="1Torch was not compiled with flash attention")
|
||||
from .help_content import AllTalkHelpContent
|
||||
this_dir = Path(__file__).parent.resolve() # Sets up self.this_dir as a variable for the folder THIS script is running in.
|
||||
main_dir = Path(__file__).parent.parent.parent.parent.resolve() # Sets up self.main_dir as a variable for the folder AllTalk is running in
|
||||
|
||||
@@ -53,6 +61,71 @@ def f5tts_voices_file_list():
|
||||
|
||||
return sorted(voices)
|
||||
|
||||
def get_files_needing_transcription(directory: Path) -> List[Tuple[Path, str]]:
|
||||
"""Get all audio files that need transcription."""
|
||||
files_to_transcribe = []
|
||||
|
||||
for ext in ['.wav', '.mp3', '.flac']:
|
||||
# Check main directory
|
||||
for f in directory.glob(f"*{ext}"):
|
||||
if not f.with_suffix('.reference.txt').exists():
|
||||
files_to_transcribe.append((f, ext[1:])) # Remove the dot from extension
|
||||
|
||||
# Check subdirectories
|
||||
for folder in directory.iterdir():
|
||||
if folder.is_dir():
|
||||
for f in folder.glob(f"*{ext}"):
|
||||
if not f.with_suffix('.reference.txt').exists():
|
||||
files_to_transcribe.append((f, ext[1:]))
|
||||
|
||||
return files_to_transcribe
|
||||
|
||||
def transcribe_files(model_name: str, use_cpu: bool = False, progress=gr.Progress()) -> str:
|
||||
"""Transcribe all files without reference text."""
|
||||
files = get_files_needing_transcription(Path(main_dir)/'voices')
|
||||
|
||||
if not files:
|
||||
return "No files need transcription!"
|
||||
|
||||
model = None
|
||||
try:
|
||||
progress(0, desc="Loading Whisper model...")
|
||||
|
||||
# Determine device
|
||||
device = "cpu" if use_cpu else ("cuda" if torch.cuda.is_available() else "cpu")
|
||||
model = whisper.load_model(model_name).to(device)
|
||||
|
||||
progress(0, desc=f"Transcribing files using {device.upper()}...")
|
||||
|
||||
for idx, (file_path, _) in enumerate(progress.tqdm(files, desc="Transcribing files")):
|
||||
# Transcribe the audio
|
||||
result = model.transcribe(str(file_path))
|
||||
|
||||
# Save the transcription
|
||||
with open(file_path.with_suffix('.reference.txt'), 'w', encoding='utf-8') as f:
|
||||
f.write(result["text"].strip())
|
||||
|
||||
progress((idx + 1) / len(files))
|
||||
|
||||
return f"Successfully transcribed {len(files)} files using {device.upper()}!"
|
||||
|
||||
except Exception as e:
|
||||
return f"Error during transcription: {str(e)}"
|
||||
|
||||
finally:
|
||||
if model is not None:
|
||||
# Move model to CPU before deletion if it was on CUDA
|
||||
if torch.cuda.is_available() and not use_cpu:
|
||||
model.cpu()
|
||||
torch.cuda.empty_cache()
|
||||
|
||||
# Delete the model explicitly
|
||||
del model
|
||||
model = None # Add this line to explicitly clear the reference
|
||||
|
||||
# Run garbage collection
|
||||
gc.collect()
|
||||
|
||||
######################################################
|
||||
# REQUIRED CHANGE #
|
||||
# Imports and saves the TTS engine-specific settings #
|
||||
@@ -143,10 +216,16 @@ def f5tts_model_alltalk_settings(model_config_data):
|
||||
def_narrator_voice_gr = gr.Dropdown(value=model_config_data["settings"]["def_narrator_voice"], label="Narrator Voice", choices=voice_list, allow_custom_value=True)
|
||||
with gr.Group():
|
||||
with gr.Row():
|
||||
details_text = gr.Textbox(label="Details", show_label=False, lines=5, interactive=False, value="In this section, you can set the default settings for this TTS engine. Settings that are not supported by the current engine will be greyed out and cannot be selected. Default voices specified here will be used when no specific voice is provided in the TTS generation request. If a voice is specified in the request, it will override these default settings. When using the OpenAI API compatable API with this TTS engine, the voice mappings will be applied. As the OpenAI API has a limited set of 6 voices, these mappings ensure compatibility by mapping the OpenAI voices to the available voices in this TTS engine.")
|
||||
details_text = gr.Textbox(label="Details", show_label=False, lines=5, interactive=False, value="Configure default settings and voice mappings for the selected TTS engine. Unavailable options are grayed out based on engine capabilities. See the Help section below for detailed information about each setting.")
|
||||
with gr.Row():
|
||||
submit_button = gr.Button("Update Settings")
|
||||
output_message = gr.Textbox(label="Output Message", interactive=False, show_label=False)
|
||||
with gr.Accordion("HELP - 🔊 Understanding TTS Engine Default Settings Page", open=False):
|
||||
with gr.Row():
|
||||
gr.Markdown(AllTalkHelpContent.DEFAULT_SETTINGS, elem_classes="custom-markdown")
|
||||
with gr.Row():
|
||||
gr.Markdown(AllTalkHelpContent.DEFAULT_SETTINGS1, elem_classes="custom-markdown")
|
||||
gr.Markdown(AllTalkHelpContent.DEFAULT_SETTINGS2, elem_classes="custom-markdown")
|
||||
submit_button.click(f5tts_model_update_settings, inputs=[def_character_voice_gr, def_narrator_voice_gr, lowvram_enabled_gr, deepspeed_enabled_gr, temperature_set_gr, repetitionpenalty_set_gr, pitch_set_gr, generationspeed_set_gr, alloy_gr, echo_gr, fable_gr, nova_gr, onyx_gr, shimmer_gr], outputs=output_message)
|
||||
|
||||
###########################################################################################
|
||||
@@ -180,34 +259,12 @@ def f5tts_model_alltalk_settings(model_config_data):
|
||||
gr.Textbox(label="Linux Support", value='Yes' if features_list['linux_capable'] else 'No', interactive=False)
|
||||
gr.Textbox(label="Mac Support", value='Yes' if features_list['mac_capable'] else 'No', interactive=False)
|
||||
with gr.Row():
|
||||
gr.Markdown("""
|
||||
#### 🟧 DeepSpeed Capable
|
||||
DeepSpeed is a deep learning optimization library that can significantly speed up model training and inference. If a model is DeepSpeed capable, it means it can utilize DeepSpeed to accelerate the generation of text-to-speech output. This requires the model to be loaded into CUDA/VRAM on an Nvidia GPU and the model's inference method to support DeepSpeed.
|
||||
#### 🟧 Pitch Capable
|
||||
Pitch refers to the highness or lowness of a sound. If a model is pitch capable, it can adjust the pitch of the generated speech, allowing for more expressive and varied output.
|
||||
#### 🟧 Generation Speed Capable
|
||||
Generation speed refers to the rate at which the model can generate text-to-speech output. If a model is generation speed capable, it means the speed of the generated speech can be adjusted, making it faster or slower depending on the desired output.
|
||||
#### 🟧 Repetition Penalty Capable
|
||||
Repetition penalty is a technique used to discourage the model from repeating the same words or phrases multiple times in the same sounding way. If a model is repetition penalty capable, it can apply this penalty during generation to improve the diversity and naturalness of the output.
|
||||
#### 🟧 Multi-Languages Capable
|
||||
Multi-language capable models can generate speech in multiple languages. This means that the model has been trained on data from different languages and can switch between them during generation. Some models are language-specific.
|
||||
#### 🟧 Multi-Voice Capable
|
||||
Multi-voice capable models generate speech in multiple voices or speaking styles. This means that the model has been trained on data from different speakers and can mimic their voices during generation, or is a voice cloning model that can generate speech based on the input sample.
|
||||
""")
|
||||
gr.Markdown("""
|
||||
#### 🟧 Streaming Capable
|
||||
Streaming refers to the ability to generate speech output in real-time, without the need to generate the entire output before playback. If a model is streaming capable, it can generate speech on-the-fly, allowing for faster response times and more interactive applications.
|
||||
#### 🟧 Low VRAM Capable
|
||||
VRAM (Video Random Access Memory) is a type of memory used by GPUs to store and process data. If a model is low VRAM capable, it can efficiently utilize the available VRAM by moving data between CPU and GPU memory as needed, allowing for generation even on systems with limited VRAM where it may be competing with an LLM model for VRAM.
|
||||
#### 🟧 Temperature Capable
|
||||
Temperature is a hyperparameter that controls the randomness of the generated output. If a model is temperature capable, the temperature can be adjusted to make the output more or less random, affecting the creativity and variability of the generated speech.
|
||||
#### 🟧 Multi-Model Capable Engine
|
||||
If an engine is multi-model capable, it means that it can support and utilize multiple models for text-to-speech generation. This allows for greater flexibility and the ability to switch between different models depending on the desired output. Different models may be capable of different languages, specific languages, voices, etc.
|
||||
#### 🟧 Default Audio Output Format
|
||||
Specifies the file format in which the generated speech will be saved. Common audio formats include WAV, MP3, FLAC, Opus, AAC, and PCM. If you want different outputs, you can set the transcode function to change the output audio, though transcoding will add a little time to the generation and is not available for streaming generation.
|
||||
#### 🟧 Windows/Linux/Mac Support
|
||||
These indicators show whether the model and engine are compatible with Windows, Linux, or macOS. However, additional setup or requirements may be necessary to ensure full functionality on your operating system. Please note that full platform support has not been extensively tested.
|
||||
""")
|
||||
with gr.Accordion("HELP - 🔊 Understanding TTS Engine Capabilities", open=False):
|
||||
with gr.Row():
|
||||
gr.Markdown(AllTalkHelpContent.ENGINE_INFORMATION, elem_classes="custom-markdown")
|
||||
with gr.Row():
|
||||
gr.Markdown(AllTalkHelpContent.ENGINE_INFORMATION1, elem_classes="custom-markdown")
|
||||
gr.Markdown(AllTalkHelpContent.ENGINE_INFORMATION2, elem_classes="custom-markdown")
|
||||
|
||||
#######################################################################################################################################################################################################
|
||||
# REQUIRED CHANGE #
|
||||
@@ -292,7 +349,6 @@ def f5tts_model_alltalk_settings(model_config_data):
|
||||
confirm_button.click(confirm_download, inputs=model_dropdown, outputs=[confirm_button, download_button, cancel_button, download_status])
|
||||
cancel_button.click(cancel_download, inputs=None, outputs=[confirm_button, download_button, cancel_button, download_status])
|
||||
|
||||
|
||||
def get_voice_files():
|
||||
"""Get list of voice files with their status"""
|
||||
files = [
|
||||
@@ -302,76 +358,47 @@ def f5tts_model_alltalk_settings(model_config_data):
|
||||
]
|
||||
return sorted(files)
|
||||
|
||||
with gr.Tab("Reference Text/Sample Manager"):
|
||||
with gr.Tab("Reference Text/Sample Manager"):
|
||||
with gr.Row():
|
||||
gr.Markdown("""
|
||||
### Reference Text/Sample Manager
|
||||
This tool helps you manage reference text files for your voice samples. Each WAV file should have a corresponding .reference.txt file
|
||||
containing the exact text that was spoken in the recording. This is important for voice cloning quality.<br>
|
||||
|
||||
Files marked in 🔴 red need a reference text file<br>
|
||||
Files marked in 🟢 green already have a reference text file<br>
|
||||
|
||||
It is important to note that F5-TTS only supports English and Chinese languages.
|
||||
|
||||
For more information on the F5-TTS engine, please visit the: [F5-TTS GitHub Repository](https://github.com/SWivid/F5-TTS/)
|
||||
""")
|
||||
|
||||
gr.Markdown("""
|
||||
#### Important Guidelines:
|
||||
* Reference WAV files should be no longer than 15 seconds in length, or it may affect playback speed.
|
||||
* You can play the audio below and listen to it. You then need to populate the Reference Text box with the exact spoken audio, preferably adding punctuation where appropriate:<br>
|
||||
- Period (.)<br>
|
||||
- Comma (,)<br>
|
||||
- Semi-colon (;)<br>
|
||||
- Apostrophe (') - Important for words like "I'm", "don't", "can't", etc.<br>
|
||||
* After saving the reference text file, you'll need to go to the main generation page and click "Refresh Server Settings" for the voice to be shown as available.
|
||||
""")
|
||||
|
||||
# List all WAV files and their status
|
||||
file_list = gr.Dropdown(
|
||||
label="Voice Files",
|
||||
choices=get_voice_files(),
|
||||
value=None
|
||||
)
|
||||
refresh_btn = gr.Button("Refresh List")
|
||||
model_selector = gr.Dropdown(
|
||||
label="Whisper Model",
|
||||
choices=["base", "medium", "large-v3"],
|
||||
value="base"
|
||||
)
|
||||
transcribe_button = gr.Button("Auto-Transcribe Missing Files")
|
||||
with gr.Row():
|
||||
with gr.Column():
|
||||
# List all WAV files and their status
|
||||
file_list = gr.Dropdown(
|
||||
label="Voice Files",
|
||||
choices=get_voice_files(),
|
||||
value=None
|
||||
)
|
||||
|
||||
# Add audio player with small height
|
||||
audio_player = gr.Audio(
|
||||
label="Preview Voice Sample",
|
||||
type="filepath",
|
||||
interactive=False,
|
||||
elem_classes="small-audio-player" # Custom CSS class for sizing
|
||||
)
|
||||
|
||||
refresh_btn = gr.Button("Refresh List")
|
||||
|
||||
with gr.Column():
|
||||
current_text = gr.Textbox(
|
||||
label="Reference Text",
|
||||
placeholder="Enter the exact text that was spoken in the recording...",
|
||||
lines=5
|
||||
)
|
||||
|
||||
with gr.Row():
|
||||
save_btn = gr.Button("Save Reference Text", variant="primary")
|
||||
delete_btn = gr.Button("Delete Reference Text", variant="secondary")
|
||||
|
||||
status_text = gr.Textbox(label="Status", interactive=False)
|
||||
|
||||
# Add custom CSS to make the audio player smaller
|
||||
gr.HTML("""
|
||||
<style>
|
||||
.small-audio-player audio {
|
||||
height: 40px !important;
|
||||
margin-top: 0px !important;
|
||||
}
|
||||
.small-audio-player {
|
||||
margin-bottom: 10px !important;
|
||||
}
|
||||
</style>
|
||||
""")
|
||||
# Add audio player with small height
|
||||
audio_player = gr.Audio(
|
||||
label="Preview Voice Sample",
|
||||
type="filepath",
|
||||
interactive=False,
|
||||
elem_classes="small-audio-player" # Custom CSS class for sizing
|
||||
)
|
||||
with gr.Row():
|
||||
current_text = gr.Textbox(
|
||||
label="Manually Edit Reference Text",
|
||||
placeholder="Enter the exact text that was spoken in the recording...",
|
||||
lines=2,
|
||||
scale=2
|
||||
)
|
||||
status_text = gr.Textbox(label="Status", interactive=False, scale=1)
|
||||
with gr.Row():
|
||||
save_btn = gr.Button("Save Reference Text", variant="primary")
|
||||
delete_btn = gr.Button("Delete Reference Text", variant="secondary")
|
||||
with gr.Accordion("HELP - 🎯 Reference Text/Sample Manager", open=False):
|
||||
with gr.Row():
|
||||
gr.Markdown(AllTalkHelpContent.REFERENCE_MANAGER, elem_classes="custom-markdown")
|
||||
with gr.Row():
|
||||
gr.Markdown(AllTalkHelpContent.REFERENCE_MANAGER1, elem_classes="custom-markdown")
|
||||
gr.Markdown(AllTalkHelpContent.REFERENCE_MANAGER2, elem_classes="custom-markdown")
|
||||
|
||||
|
||||
def load_file_data(wav_file):
|
||||
if not wav_file:
|
||||
@@ -457,6 +484,14 @@ def f5tts_model_alltalk_settings(model_config_data):
|
||||
outputs=file_list
|
||||
)
|
||||
refresh_btn.click(refresh_file_list, outputs=file_list)
|
||||
transcribe_button.click(
|
||||
fn=transcribe_files,
|
||||
inputs=[model_selector],
|
||||
outputs=status_text # Use the existing status box instead of creating a new one
|
||||
).then(
|
||||
fn=refresh_file_list,
|
||||
outputs=file_list
|
||||
)
|
||||
|
||||
###################################################################################################
|
||||
# REQUIRED CHANGE #
|
||||
@@ -465,43 +500,10 @@ def f5tts_model_alltalk_settings(model_config_data):
|
||||
###################################################################################################
|
||||
with gr.Tab("Engine Help"):
|
||||
with gr.Row():
|
||||
gr.Markdown("""
|
||||
### 🟧 Where are the f5tts models stored?
|
||||
This extension will download the f5tts models to `/alltalk_tts/models/f5tts/` folder.
|
||||
|
||||
### 🟧 How do clone/reference voices work?
|
||||
F5-TTS uses voice samples with corresponding reference text files for voice cloning:
|
||||
1. Place your WAV voice samples in the `/alltalk_tts/voices/` folder
|
||||
2. Create a matching `.reference.txt` file containing the exact text spoken in the recording.
|
||||
3. Use the `Reference Text/Sample Manager` tab to create and manage these text files
|
||||
4. Only voice samples with valid reference text files will be available for use
|
||||
|
||||
For best results:
|
||||
- Keep voice samples under 15 seconds
|
||||
- Ensure the reference text exactly matches what is spoken
|
||||
- Use high-quality recordings with minimal background noise
|
||||
|
||||
### 🟧 Where are the outputs stored & Automatic output wav file deletion
|
||||
Voice outputs are stored in `/alltalk_tts/outputs/`. You can configure automatic maintenance deletion of old wav files by setting `Del WAV's older than` in the global settings.
|
||||
|
||||
> When `Disabled`, your output wav files will be left untouched.
|
||||
> When set to a setting `1 Day` or greater, your output wav files older than that time period will be automatically deleted on start-up of AllTalk.
|
||||
""")
|
||||
gr.Markdown("""
|
||||
### 🟧 Speed settings and voice cloning
|
||||
F5-TTS appears to generate audio a little faster than the audio sample. As such, in AllTalk, the speed setting for generation is set to 0.9 (see the F5-TTS `Default Settings` tab). Certainly the better the punctuation you use, the better the end result, both in the audio samples reference file and the text you send to be generated as TTS. If you wish to globally adjust this, you can make the change on the Default Settings tab.
|
||||
|
||||
### 🟧 Cloned audio and punctuation.
|
||||
When F5-TTS reproduces audio, punctuation appears to matter greatly. As such `Im` and `I'm` or `I am` will all sound a little different. Additionally it appears to want to spell out text in CAPS. You may want to look at the F5-TTS developers page for more information on this.
|
||||
|
||||
### 🟧 Difference between F5-TTS and E2-TTS models.
|
||||
F5-TTS and E2-TTS represent two different approaches to zero-shot text-to-speech:
|
||||
|
||||
- F5-TTS is optimized for voice fidelity and natural speech patterns. It excels at capturing the nuances and characteristics of the reference voice, producing highly natural and faithful speech output. The tradeoff is slightly longer generation times and higher computational requirements.<br>
|
||||
- E2-TTS prioritizes efficiency and ease of use. It offers faster generation speeds and better memory efficiency, making it ideal for longer texts or resource-constrained environments. While its voice reproduction may be slightly less precise than F5-TTS, it still produces high-quality output with good speaker similarity.
|
||||
|
||||
Choose F5-TTS when voice fidelity is paramount, or E2-TTS when generation speed and efficiency are the priority.
|
||||
""")
|
||||
gr.Markdown(AllTalkHelpContent.HELP_PAGE, elem_classes="custom-markdown")
|
||||
with gr.Row():
|
||||
gr.Markdown(AllTalkHelpContent.HELP_PAGE1, elem_classes="custom-markdown")
|
||||
gr.Markdown(AllTalkHelpContent.HELP_PAGE2, elem_classes="custom-markdown")
|
||||
|
||||
return app
|
||||
|
||||
|
||||
@@ -0,0 +1,546 @@
|
||||
# help_content.py
|
||||
# pylint: disable=no-member
|
||||
|
||||
class AllTalkHelpContent:
|
||||
"""CSS and help content for help_content.py"""
|
||||
custom_css = """
|
||||
/* Add this to your existing CSS */
|
||||
.gradio-container .prose {
|
||||
max-width: none !important;
|
||||
padding: 0.5rem !important; /* Reduced padding */
|
||||
margin: 0 !important;
|
||||
}
|
||||
|
||||
.custom-markdown div {
|
||||
border: none !important; /* Remove the inner border */
|
||||
margin-top: 0 !important; /* Remove top margin */
|
||||
margin-bottom: 0 !important; /* Remove bottom margin */
|
||||
padding-top: 0 !important; /* Remove top padding */
|
||||
padding-bottom: 0 !important; /* Remove bottom padding */
|
||||
}
|
||||
|
||||
/* Update the existing custom-markdown class */
|
||||
.custom-markdown {
|
||||
font-size: 15px !important;
|
||||
line-height: 1.6 !important;
|
||||
color: var(--body-text-color) !important;
|
||||
background-color: var(--background-fill-primary) !important;
|
||||
border: 1px solid var(--border-color-primary) !important;
|
||||
border-radius: 8px !important;
|
||||
padding: 0.5rem !important;
|
||||
margin: 0 !important; /* Changed from 1rem 0 to 0 */
|
||||
max-width: 100% !important;
|
||||
box-sizing: border-box !important;
|
||||
/* Default text color for all content (grey) */
|
||||
color: rgba(156, 163, 175, 1) !important; /* Adjust this grey value to match your interface */
|
||||
}
|
||||
|
||||
/* Make headings white */
|
||||
.custom-markdown h1,
|
||||
.custom-markdown h2,
|
||||
.custom-markdown h3,
|
||||
.custom-markdown h4,
|
||||
.custom-markdown h5,
|
||||
.custom-markdown h6 {
|
||||
color: var(--heading-text-color, var(--body-text-color)) !important;
|
||||
font-weight: 600 !important;
|
||||
}
|
||||
|
||||
/* Keep all other elements in the grey color */
|
||||
.custom-markdown p,
|
||||
.custom-markdown li,
|
||||
.custom-markdown ul,
|
||||
.custom-markdown ol {
|
||||
color: rgba(156, 163, 175, 1) !important; /* Same grey as the base text */
|
||||
}
|
||||
|
||||
/* Additional targeting for any wrapping elements */
|
||||
.gradio-container .prose > * {
|
||||
margin: 0 !important;
|
||||
padding: 0 !important;
|
||||
}
|
||||
|
||||
/* Update the list item spacing in your existing CSS */
|
||||
.custom-markdown li {
|
||||
font-size: 0.95rem !important;
|
||||
margin-bottom: 0.2rem !important; /* Reduced from 0.5rem to 0.3rem */
|
||||
}
|
||||
|
||||
/* Add specific styling for definition-style lists (like your Default, Recommendation, Tip items) */
|
||||
.custom-markdown li p {
|
||||
margin: 0 !important; /* Remove paragraph margins within list items */
|
||||
}
|
||||
|
||||
/* If you need even tighter spacing for specific types of lists */
|
||||
.custom-markdown li + li {
|
||||
margin-top: 0.2rem !important; /* Space between consecutive list items */
|
||||
}
|
||||
|
||||
/* Ensure nested lists maintain proper spacing */
|
||||
.custom-markdown li > ul,
|
||||
.custom-markdown li > ol {
|
||||
margin: 0.2rem 0 0.2rem 1rem !important; /* Reduced from 0.5rem */
|
||||
}
|
||||
|
||||
/* Consistent heading styles */
|
||||
.custom-markdown h2 {
|
||||
font-size: 1.2rem !important; /* Fixed size relative to root */
|
||||
font-weight: 600 !important;
|
||||
margin: 1.5rem 0 1rem !important;
|
||||
color: var(--heading-text-color, var(--body-text-color)) !important;
|
||||
border-bottom: 1px solid var(--border-color-primary) !important;
|
||||
padding-bottom: 0.5rem !important;
|
||||
}
|
||||
|
||||
/* First paragraph styling */
|
||||
.custom-markdown p:first-of-type {
|
||||
font-size: 0.95rem !important; /* Match base size */
|
||||
font-weight: 400 !important;
|
||||
margin-bottom: 1rem !important;
|
||||
}
|
||||
|
||||
/* Regular paragraphs */
|
||||
.custom-markdown p {
|
||||
font-size: 0.95rem !important;
|
||||
margin: 0.8rem 0 !important;
|
||||
}
|
||||
|
||||
/* List styling */
|
||||
.custom-markdown ul,
|
||||
.custom-markdown ol {
|
||||
margin: 0.8rem 0 !important;
|
||||
padding-left: 1.5rem !important;
|
||||
}
|
||||
|
||||
/* Code styling */
|
||||
.custom-markdown code {
|
||||
font-family: ui-monospace, monospace !important;
|
||||
background-color: var(--background-fill-secondary) !important;
|
||||
padding: 0.2rem 0.4rem !important;
|
||||
border-radius: 4px !important;
|
||||
font-size: 0.8rem !important; /* Slightly smaller than regular text */
|
||||
color: var(--body-text-color) !important;
|
||||
}
|
||||
|
||||
/* Add styles for bold and emphasis */
|
||||
.custom-markdown strong {
|
||||
font-weight: 600 !important;
|
||||
color: var(--body-text-color) !important;
|
||||
}
|
||||
|
||||
.custom-markdown em {
|
||||
font-style: italic !important;
|
||||
}
|
||||
|
||||
/* Ensure both columns take equal width */
|
||||
.gradio-row > div {
|
||||
flex: 1 1 50% !important;
|
||||
min-width: 0 !important; /* Prevents flex items from overflowing */
|
||||
}
|
||||
"""
|
||||
|
||||
ENGINE_INFORMATION = """
|
||||
## 🔊 TTS Engine Capabilities Help
|
||||
|
||||
This guide explains the various capabilities that **may** be available in different TTS engines and models. Each capability affects how the TTS engine processes and generates speech output.
|
||||
"""
|
||||
|
||||
ENGINE_INFORMATION1 = """
|
||||
## 🚀 Performance Features
|
||||
|
||||
- **DeepSpeed Capable**: Enables GPU acceleration using the DeepSpeed optimization library.
|
||||
- **Requires**: NVIDIA GPU with CUDA support
|
||||
- **Benefit**: Significantly faster text-to-speech generation
|
||||
- **Note**: Model must specifically support DeepSpeed inference
|
||||
|
||||
- **Low VRAM Capable**: Optimized for systems with limited GPU memory.
|
||||
- **Benefit**: Efficient memory management between CPU and GPU
|
||||
- **Use Case**: Ideal when running alongside other GPU-intensive applications like LLMs
|
||||
- **Note**: May trade speed for memory efficiency
|
||||
|
||||
- **Streaming Capable**: Enables real-time speech generation.
|
||||
- **Benefit**: Immediate playback without generating entire audio first
|
||||
- **Use Case**: Interactive applications and real-time responses
|
||||
- **Note**: Not all output formats support streaming
|
||||
|
||||
## 🎵 Voice Control Features
|
||||
|
||||
- **Pitch Capable**: Allows adjustment of voice pitch.
|
||||
- **Benefit**: Creates more expressive and varied speech output
|
||||
- **Use Case**: Customizing voice characteristics
|
||||
- **Note**: Adjustment range varies by model
|
||||
|
||||
- **Generation Speed Capable**: Controls speech rate.
|
||||
- **Benefit**: Adjustable playback speed during generation
|
||||
- **Use Case**: Creating faster or slower speech output
|
||||
- **Note**: May affect audio quality at extreme settings
|
||||
|
||||
- **Temperature Capable**: Controls output randomness.
|
||||
- **Benefit**: Adjustable speech variation and creativity
|
||||
- **Use Case**: Balancing consistency vs. naturality
|
||||
- **Note**: Higher values increase variation but may reduce quality
|
||||
"""
|
||||
|
||||
ENGINE_INFORMATION2 = """
|
||||
## 🎯 Quality Enhancement Features
|
||||
|
||||
- **Repetition Penalty Capable**: Prevents unnatural speech patterns.
|
||||
- **Benefit**: Reduces repeated sounds and phrases
|
||||
- **Use Case**: Improving natural flow of longer texts
|
||||
- **Note**: Strength of penalty may be adjustable
|
||||
|
||||
## 🌐 Multi-Feature Support
|
||||
|
||||
- **Multi-Languages Capable Models**: Each model Supports multiple languages.
|
||||
- **Benefit**: Generate speech in different languages
|
||||
- **Note**: Quality may vary between languages
|
||||
- **Tip**: Check model-specific language support
|
||||
|
||||
- **Multi-Voice Capable**: Supports multiple speaking voices.
|
||||
- **Benefit**: Different voices or speaking styles
|
||||
- **Types**: Pre-trained voices or voice cloning
|
||||
- **Note**: Voice quality may vary by model
|
||||
|
||||
- **Multi-Model Capable Engine**: Supports multiple TTS models.
|
||||
- **Benefit**: Flexibility in model selection
|
||||
- **Use Case**: Switching between models for different needs
|
||||
- **Note**: Each model may have different capabilities
|
||||
|
||||
## 📁 Technical Features
|
||||
|
||||
- **Default Audio Output Format**: Specifies output file format.
|
||||
- **Common Formats**: WAV, MP3, FLAC, Opus, AAC, PCM
|
||||
- **Note**: Transcoding to different formats adds processing time
|
||||
- **Warning**: Not all formats support streaming
|
||||
|
||||
- **Platform Support**: Operating system compatibility.
|
||||
- **Platforms**: Windows, Linux, macOS
|
||||
- **Note**: Additional setup may be required
|
||||
- **Warning**: Support level may vary by platform
|
||||
"""
|
||||
|
||||
DEFAULT_SETTINGS = """
|
||||
## 🎯 TTS Engine Settings Help
|
||||
|
||||
This guide explains the settings and configuration options available for individual Text-to-Speech engines within AllTalk.
|
||||
"""
|
||||
|
||||
DEFAULT_SETTINGS1 = """
|
||||
## 🎚️ Engine Capabilities & Controls
|
||||
|
||||
- **Low VRAM Mode**
|
||||
- Optimizes memory usage for systems with limited GPU memory
|
||||
- Efficiently manages resources by moving data between CPU and GPU
|
||||
- Recommended for systems with less than 4GB VRAM or when running alongside other GPU-intensive applications
|
||||
|
||||
- **DeepSpeed Capability**
|
||||
- Accelerates TTS generation using optimized inference
|
||||
- Only available for engines and models that support DeepSpeed
|
||||
- Requires NVIDIA GPU with CUDA support
|
||||
|
||||
- **Temperature Control**
|
||||
- Adjusts the variability in speech generation
|
||||
- **Range**: 0.0 to 1.0
|
||||
- **Lower values** (0.1-0.5): More consistent, stable output
|
||||
- **Higher values** (0.6-1.0): More variable, potentially more natural-sounding output
|
||||
|
||||
- **Repetition Penalty**
|
||||
- Helps prevent repetitive speech patterns
|
||||
- **Range**: 1.0 to 15.0
|
||||
- Higher values more strongly discourage repetition
|
||||
- Typically most effective between 1.0-3.0
|
||||
|
||||
- **Pitch Adjustment**
|
||||
- Modifies the voice pitch when supported
|
||||
- **Range**: -20 to +20
|
||||
- Use subtle adjustments for most natural results
|
||||
|
||||
- **Generation Speed**
|
||||
- Controls the pace of generated speech
|
||||
- **Range**: 0.5 to 2.0
|
||||
- 1.0 represents normal speed
|
||||
"""
|
||||
|
||||
DEFAULT_SETTINGS2 = """
|
||||
|
||||
## 🗣️ Voice Configuration
|
||||
|
||||
### OpenAI Voice Mappings
|
||||
- Only relevant when using the OpenAI-compatible API endpoint
|
||||
- Maps OpenAI's six standard voices to equivalent voices in the current engine:
|
||||
- `alloy`
|
||||
- `echo`
|
||||
- `fable`
|
||||
- `nova`
|
||||
- `onyx`
|
||||
- `shimmer`
|
||||
- Essential for maintaining compatibility with OpenAI API calls
|
||||
- Each mapping can be customized to any available voice in the current engine
|
||||
|
||||
Information on the OpenAI Endpoint is available in the [Github Wiki](https://github.com/erew123/alltalk_tts/wiki)
|
||||
|
||||
### Default Voices
|
||||
- **Default/Character Voice**: Used when no specific voice is specified in API calls
|
||||
- **Narrator Voice**: Separate default for narrator-specific text
|
||||
- These defaults are engine-specific and won't affect other TTS engines
|
||||
- Can be overridden by explicitly specifying voices in API calls
|
||||
|
||||
## ⚙️ Important Notes
|
||||
|
||||
- Settings availability is determined by engine capabilities
|
||||
- Grayed-out options indicate features not supported by the current engine
|
||||
- Changes only affect the currently selected TTS engine
|
||||
- Settings here act as defaults but can be overridden via API parameters
|
||||
- All changes require clicking "Update Settings" to take effect
|
||||
- Some settings require an engine reload to take effect
|
||||
"""
|
||||
|
||||
HELP_PAGE = """
|
||||
## 🎯 F5-TTS Voice Cloning Engine Help
|
||||
|
||||
F5-TTS is a zero-shot voice cloning system that specializes in high-fidelity voice reproduction with precise reference text matching.
|
||||
"""
|
||||
|
||||
HELP_PAGE1 = """
|
||||
## 🎚️ Model Variants
|
||||
|
||||
### F5-TTS (High Fidelity)
|
||||
- Optimized for voice accuracy and naturalness
|
||||
- Superior voice characteristic capture
|
||||
- Higher computational requirements
|
||||
- Best for quality-focused applications
|
||||
- Longer generation times
|
||||
|
||||
### E2-TTS (Efficient)
|
||||
- Focused on speed and efficiency
|
||||
- Lower resource requirements
|
||||
- Faster generation times
|
||||
- Good for longer texts
|
||||
- Suitable for resource-constrained systems
|
||||
|
||||
## 🗣️ Voice Cloning System
|
||||
|
||||
### Reference Text Requirements
|
||||
- Each voice sample needs a matching `.reference.txt` file
|
||||
- Text must exactly match spoken audio
|
||||
- Punctuation significantly affects output quality
|
||||
- Use the Reference Text/Sample Manager for setup
|
||||
- Supports English and Chinese languages only
|
||||
|
||||
### Audio Sample Guidelines
|
||||
- Format: WAV/MP3/Flac files
|
||||
- Length: Maximum 15 seconds recommended
|
||||
- Quality: Clear audio, minimal background noise
|
||||
- Location: `/alltalk_tts/voices/` directory
|
||||
- Names: Should match reference text filename
|
||||
|
||||
### Punctuation Impact
|
||||
- Precise punctuation affects voice reproduction
|
||||
- Examples of differences:
|
||||
- `Im` vs `I'm` vs `I am`
|
||||
- Commas affect pacing
|
||||
- Periods affect sentence flow
|
||||
- Capital letters may be spelled out
|
||||
- Use appropriate punctuation marks:
|
||||
- Periods (.)
|
||||
- Commas (,)
|
||||
- Semi-colons (;)
|
||||
- Apostrophes (')
|
||||
|
||||
## ⚙️ Performance Settings
|
||||
|
||||
### Speed Adjustment
|
||||
- Default speed setting: 0.9
|
||||
- 1.0 seems faster than reference audio
|
||||
- Compensates for faster audio generation
|
||||
- Adjustable in Default Settings tab
|
||||
- Affected by:
|
||||
- Sample length
|
||||
- Text punctuation
|
||||
- Reference text accuracy
|
||||
"""
|
||||
|
||||
HELP_PAGE2 = """
|
||||
### Best Practices
|
||||
1. **Voice Samples**
|
||||
- Keep under 15 seconds
|
||||
- Use clear recordings
|
||||
- Ensure consistent audio quality
|
||||
- Avoid background noise
|
||||
|
||||
2. **Reference Text**
|
||||
- Match spoken content exactly
|
||||
- Include proper punctuation
|
||||
- Verify text accuracy
|
||||
- Consider natural speech patterns
|
||||
|
||||
3. **Model Selection**
|
||||
- F5-TTS: When quality is priority
|
||||
- E2-TTS: When speed is priority
|
||||
- Consider system resources
|
||||
- Test both for optimal results
|
||||
|
||||
## 📁 File Management
|
||||
|
||||
- **Models**: `/alltalk_tts/models/f5tts/`
|
||||
- **Voice Samples**: `/alltalk_tts/voices/`
|
||||
- **Reference Texts**: `.reference.txt` files alongside WAVs
|
||||
- **Outputs**: `/alltalk_tts/outputs/`
|
||||
- Automatic cleanup available
|
||||
- Configurable retention period
|
||||
- Set to 'Disabled' to keep all files
|
||||
|
||||
## 🔄 Reference Text Management
|
||||
|
||||
### Using the Manager
|
||||
- Access via Reference Text/Sample Manager tab
|
||||
- Color-coded file status:
|
||||
- 🔴 Red: Needs reference text
|
||||
- 🟢 Green: Has reference text
|
||||
- Built-in audio playback
|
||||
- Whisper transcription available
|
||||
|
||||
### Whisper Transcription Options
|
||||
- **base** (200MB download): Fast, basic quality
|
||||
- **medium** (1.5GB download): Better quality
|
||||
- **large-v3** (3GB download): Best quality
|
||||
- Automatic model download
|
||||
- Helps create initial reference text
|
||||
|
||||
## 🔧 System Integration
|
||||
|
||||
- Click "Refresh Server Settings" after adding new voices
|
||||
- Monitor system resources for optimal performance
|
||||
- Consider storage space for models and samples
|
||||
- Regular maintenance of output files recommended
|
||||
|
||||
## ⚠️ Important Notes
|
||||
|
||||
- Language Support: English and Chinese only
|
||||
- Reference text accuracy is crucial
|
||||
- Punctuation affects voice reproduction
|
||||
- Sample length impacts playback speed
|
||||
- Model selection based on use case
|
||||
- System resources affect performance
|
||||
- Regular updates may improve functionality
|
||||
"""
|
||||
REFERENCE_MANAGER = """
|
||||
## 🎯 Reference Text/Sample Manager Help
|
||||
|
||||
The Reference Text/Sample Manager is a crucial tool for F5-TTS voice cloning, helping you manage and create accurate reference text files for your voice samples.
|
||||
"""
|
||||
REFERENCE_MANAGER1 = """
|
||||
## 📝 Core Functionality
|
||||
|
||||
### File Status Indicators
|
||||
- 🔴 Red: Files needing a reference text file
|
||||
- 🟢 Green: Files with existing reference text file
|
||||
- Visual system helps track incomplete samples
|
||||
|
||||
### Basic Operations
|
||||
- **Preview Voice Sample**: Listen to selected audio
|
||||
- **Refresh List**: Update file listing
|
||||
- **Save Reference Text**: Create/update reference file
|
||||
- **Delete Reference Text**: Remove existing reference
|
||||
- **Auto-Transcribe**: Use Whisper for automatic transcription
|
||||
|
||||
## 📒 Creating Reference Text Files
|
||||
|
||||
### Manual Process
|
||||
1. Select voice file from dropdown
|
||||
2. Play audio using Preview button
|
||||
3. Type exact spoken text in editor
|
||||
4. Add appropriate punctuation
|
||||
5. Save reference text
|
||||
6. Click "Refresh Server Settings" on main page
|
||||
|
||||
### Punctuation Guidelines
|
||||
- **Period (.)**: End of sentences
|
||||
- **Comma (,)**: Natural pauses
|
||||
- **Semi-colon (;)**: Longer pauses
|
||||
- **Apostrophe (')**: Contractions like:
|
||||
- "I'm"
|
||||
- "don't"
|
||||
- "can't"
|
||||
- "we're"
|
||||
- Where necessary use phonetics
|
||||
- This is a test of TTS (vs)
|
||||
- This is a test of tea tea ess
|
||||
|
||||
## 🎤 Voice Sample Requirements
|
||||
|
||||
### Audio Guidelines
|
||||
- Maximum length: 15 seconds
|
||||
- Format: WAV files
|
||||
- Quality: Clear, minimal noise
|
||||
- Location: `/alltalk_tts/voices/`
|
||||
|
||||
### Important Notes
|
||||
- Longer samples may affect playback speed
|
||||
- Only English and Chinese languages supported
|
||||
- Exact text matching is crucial
|
||||
- Include natural speech punctuation
|
||||
"""
|
||||
|
||||
REFERENCE_MANAGER2 = """
|
||||
## 🤖 Whisper Transcription
|
||||
|
||||
### Available Models
|
||||
1. **base (1GB VRAM)**
|
||||
- Fast processing
|
||||
- Basic quality
|
||||
- Good for most uses
|
||||
- Smallest disk space
|
||||
|
||||
2. **medium (4GB VRAM)**
|
||||
- Better quality
|
||||
- Slower processing
|
||||
- Moderate disk space
|
||||
|
||||
3. **large-v3 (10GB VRAM)**
|
||||
- Best quality
|
||||
- Slowest processing
|
||||
- Largest disk space
|
||||
|
||||
### Using Whisper
|
||||
- Select desired model from dropdown
|
||||
- Click "Auto-Transcribe Missing Files"
|
||||
- Review and edit transcriptions
|
||||
- Add punctuation as needed
|
||||
- Save corrected text
|
||||
|
||||
### Storage Notes
|
||||
- Models download automatically
|
||||
- Verify available disk space
|
||||
- One-time download per model
|
||||
- Models persist between sessions
|
||||
|
||||
## 💡 Best Practices
|
||||
|
||||
1. **Text Accuracy**
|
||||
- Listen to audio multiple times
|
||||
- Match text exactly
|
||||
- Include all spoken words
|
||||
- Maintain speech patterns
|
||||
|
||||
2. **Punctuation Usage**
|
||||
- Mark natural pauses
|
||||
- Use appropriate marks
|
||||
- Consider speech flow
|
||||
- Be consistent
|
||||
|
||||
3. **Workflow Tips**
|
||||
- Process files in batches
|
||||
- Verify saved references
|
||||
- Use Whisper for initial draft
|
||||
- Double-check automated transcriptions
|
||||
|
||||
## ⚠️ Important Reminders
|
||||
|
||||
- Always refresh server settings after changes
|
||||
- Keep voice samples under 15 seconds
|
||||
- Back up reference text files
|
||||
- Review automated transcriptions
|
||||
- Consider system storage for Whisper models
|
||||
- Language support limited to English and Chinese
|
||||
"""
|
||||
Reference in new issue
Block a user