diff --git a/diagnostics.py b/diagnostics.py new file mode 100644 index 0000000..2381509 --- /dev/null +++ b/diagnostics.py @@ -0,0 +1,108 @@ +try: + import platform + import subprocess + import logging + from importlib_metadata import distribution, distributions + import torch + import os # Import the os module +except ImportError as e: + print(f"\033[91mError importing module: {e}\033[0m\n") + print("\033[94mPlease ensure you started the Text-generation-webUI Python environment with either\033[0m") + print("\033[92mcmd_linux.sh\033[0m, \033[92mcmd_windows.bat\033[0m, \033[92mcmd_macos.sh\033[0m, or \033[92mcmd_wsl.bat\033[0m") + print("\033[94mand then try running the diagnostics again.\033[0m") + exit(1) + +try: + import psutil +except ImportError: + print("psutil not found. Installing...") + subprocess.run(['pip', 'install', 'psutil']) + import psutil + +# Additional import for torch +import torch + +# Function to get GPU information using subprocess +def get_gpu_info(): + try: + result = subprocess.run(['nvidia-smi'], stdout=subprocess.PIPE, text=True) + return result.stdout + except FileNotFoundError: + return "NVIDIA GPU information not available" + +# Function to check if a port is in use +def is_port_in_use(port): + for conn in psutil.net_connections(): + if conn.laddr.port == port: + return True + return False + +# Function to log and print system information +def log_system_info(): + # System information + os_version = platform.system() + " " + platform.version() + + # Get CUDA_HOME environment variable + cuda_home = os.environ.get('CUDA_HOME', 'N/A') + + gpu_info = get_gpu_info() + + # Python environment information + python_version = platform.python_version() + + # Torch version + torch_version = torch.__version__ + + # System RAM using psutil + try: + virtual_memory = psutil.virtual_memory() + total_ram = f"{virtual_memory.total / (1024 ** 3):.2f} GB" + available_ram = f"{virtual_memory.available / (1024 ** 3):.2f} GB" + system_ram = f"{available_ram} available out of {total_ram} total" + except NameError: + print("psutil is not installed. Unable to check system RAM.") + system_ram = "N/A" + + # Port check (if psutil is available) + port_status = "N/A" + if 'psutil' in globals(): + port_to_check = 7851 + if is_port_in_use(port_to_check): + port_status = f"Port {port_to_check} is in use." + else: + port_status = f"Port {port_to_check} is available." + + # Package versions using importlib_metadata + package_versions = {d.metadata['Name']: d.version for d in distributions()} + + # Log and print information + logging.info(f"OS Version: {os_version}") + logging.info(f"Note: Windows 11 does call itself 10") + logging.info(f"Python Version: {python_version}") + logging.info(f"Torch Version: {torch_version}") + logging.info(f"System RAM: {system_ram}") + logging.info(f"Total System RAM: {total_ram}") + logging.info(f"Available System RAM: {available_ram}") + logging.info(f"CUDA_HOME: {cuda_home}") + logging.info(f"\nPort Status: {port_status}") + logging.info(f"GPU Information:\n{gpu_info}") + logging.info("Package Versions:") + for package, version in package_versions.items(): + logging.info(f"{package}>= {version}") + + # Print to screen + print(f"\033[94mOS Version:\033[0m \033[92m{os_version}\033[0m") + print(f"\033[94mNote:\033[0m \033[92mWindows 11 does call itself 10\033[0m") + print(f"\033[94mPython Version:\033[0m \033[92m{python_version}\033[0m") + print(f"\033[94mTorch Version:\033[0m \033[92m{torch_version}\033[0m") + print(f"\033[94mSystem RAM:\033[0m \033[92m{system_ram}\033[0m") + print(f"\033[94mTotal System RAM:\033[0m \033[92m{total_ram}\033[0m") + print(f"\033[94mAvailable System RAM:\033[0m \033[92m{available_ram}\033[0m") + print(f"\033[94mCUDA_HOME:\033[0m \033[92m{cuda_home}\033[0m") + print(f"\033[94mPort Status:\033[0m \033[92m{port_status}\033[0m") + print("") + print(f"GPU Information:{gpu_info}") + print(f"\033[94mDiagnostic log created:\033[0m \033[92mdiagnostics.log\033[0m") + +if __name__ == "__main__": + log_system_info() diff --git a/templates/lowvrammode.png b/templates/lowvrammode.png index 865f91f..4fef834 100644 Binary files a/templates/lowvrammode.png and b/templates/lowvrammode.png differ diff --git a/tts_server.py b/tts_server.py index 858a275..5559ecd 100644 --- a/tts_server.py +++ b/tts_server.py @@ -641,27 +641,25 @@ simple_webpage = """ box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); } - h1, h2, h3, h4, h5 { - color: #333; + h1, h2 { + color: black; + text-decoration: underline; } - h1, h2, h3 { - text-decoration: underline; - } - - p, span { - color: #555; - font-size: 16px; /* Increased font size for better readability */ - line-height: 1.5; /* Adjusted line-height for better spacing */ - } + p, span { + color: #555; + font-size: 16px; /* Increased font size for better readability */ + margin-top: 0; /* Remove top margin for paragraphs */ + } code { background-color: #f8f8f8; - border: 1px solid #ddd; + border: 2px solid #ddd; border-radius: 4px; - padding: 2px 2px; - font-size: 14px; /* Adjusted font size for better visibility */ - margin-bottom: 0px; + padding: 0px 0px; + font-size: 14px; + margin-bottom: 20px; + color: #3366ff; } pre { @@ -671,13 +669,11 @@ simple_webpage = """ padding: 10px; overflow-x: auto; font-size: 14px; /* Adjusted font size for better visibility */ - line-height: 1.5; /* Adjusted line-height for better spacing */ } ul { color: #555; list-style-type: square; /* Set the bullet style */ - line-height: 1.5; /* Adjusted line-height for better spacing */ margin-left: 2px; /* Adjust the left margin to create an indent */ } @@ -778,265 +774,82 @@ simple_webpage = """ display: none; } + + table { + border-collapse: collapse; + width: 100%; + margin-bottom: 20px; + } + + th, td { + border: 1px solid #ddd; + padding: 8px; + text-align: left; + } + + /* Style for the first table */ + #configuration-details table { + font-size: 16px; + } + + /* Style for the nested table */ + #modeldownload-table table { + font-size: 16px; + } + + #modeldownload-table table td { + padding: 4px; /* Adjust padding as needed for the nested table */ + } + + + + -

AllTalk TTS for Text generation webUI

-

Text generation webUI webpage here and documentation here

-

AllTalk Github here +

AllTalk TTS for Text generation webUI

+ +

Table of Contents

+ - - -

Table of Contents

- +

Getting Started

+

AllTalk is a web interface, based around the Coqui TTS voice cloning/speech generation system. To generate TTS, you can use the provided gradio interface or interact with the server using JSON/CURL commands. 

+

Note: When loading up a new character in Text generation webUI it may look like nothing is happening for 20-30 seconds. Its actually processing the introduction section (greeting message) of the text and once that is completed, it will appear. You can see the activity occuring in the console window. Refreshing the page multiple times will try force the TTS engine to keep re-generating the text, so please just wait and check the console if needed.

+

Note: Ensure that your RP character card has asterisks around anything for the narration and double quotes around anything spoken. There is a complication ONLY with the greeting card so, ensuring it has the correct use of quotes and asterisks will help make sure that the greeting card sounds correct. I will aim to address this issue in a future update. In Text-generation-webUI parameters menu > character tab > greeting make sure that anything in there that is the narrator is in asterisks and anything spoken is in double quotes, then hit the save (💾) button.

+

AllTalk
Github link here
Update instructions link here
Help and issues link here

Text generation webUI
Web interface link here
Documentation link here

+

Back to top of page

+

Server Information

+ +

Back to top of page

+

Demo/Test TTS

@@ -1102,141 +915,398 @@ simple_webpage = """ audioPlayer.play(); // Play the audio; }); -

Back to top of page

+

Back to top of page

-

Custom TTS Models and Model path

+

Using Voice Samples

+

Where are the sample voices stored?

+

Voice samples are stored in /alltalk_tts/voices/ and should be named using the following format name.wav

+

Where are the outputs stored & Automatic output wav file deletion.

+

Voice outputs are stored in /alltalk_tts/outputs/

+

You can configure automatic maintenence deletion of old wav files by setting Del WAV's older than in the settings above.

+

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.

+

Where are the models stored?

+

This extension will download the 2.0.2 model to /alltalk_tts/models/

+

This TTS engine will also download the latest available model and store it wherever your OS normally stores it (Windows/Linux/Mac).

+

How do I create a new voice sample?

+

To create a new voice sample you need to make a wav file that is 22050Hz, Mono, 16 bit and between 6 to 30 seconds long, though 8 to 10 seconds is usually good enough. The model can handle up to a 30 second samples, however Ive not noticed any improvement in voice output from a much longer clips.

+

You want to find a nice clear selection of audio, so lets say you wanted to clone your favourite celebrity. You may go looking for an interview where they are talking. Pay close attention to the audio you are listening to and trying to sample. Are there noises in the backgroud, hiss on the soundtrack, a low humm, some quiet music playing or something? The better quality the audio the better the final TTS result. Dont forget, the AI that processes the sounds can hear everything in your sample and it will use them in the voice its trying to recreate.

+

Try make your clip one of nice flowing speech, like the included example files. No big pauses, gaps or other sounds. Preferably a sample that the person you are trying to copy will show a little vocal range and emotion in their voice. Also, try to avoid a clip starting or ending with breathy sounds (breathing in/out etc).

+

Editing your sample!

+

So youve downloaded your favoutie celebrity interview off Youtube, from here you need to chop it down to 6 to 30 seconds in length and resample it.

+

If you need to clean it up, do audio processing, volume level changes etc, do this before downsampling.

Using the latest version of Audacity select/highlight your 6 to 30 second clip and:

                  Tracks > Resample to 22050Hz then
                  Tracks > Mix > Stereo to Mono then
                  File > Export Audio saving it as a WAV of 22050Hz.

+

Save your generated wav file in the /alltalk_tts/voices/ folder.

+

Its worth mentioning that using AI generated audio clips may introduce unwanted sounds as its already a copy/simulation of a voice.

+

Why doesnt it sound like XXX Person?

+

The reasons can be that you:

+ +

Some samples just never seem to work correctly, so maybe try a different sample. Always remember though, this is an AI model attempting to re-create a voice, so you will never get a 100% match.

+

Back to top of page

-

Its possible to set a custom model for the API Local and XTTSv2 Local methods, or indeed point it at the same model that API TTS uses (wherever it is stored on your OS of choice). Many people did not like the sound quality of the Coqui 2.0.3 model, and as such the AllTalk tts extension downloads the 2.0.2 model seperately to the 2.0.3 model that TTS service downloads and manages. Typically the 2.0.2 model is stored in your /extensions/alltalk_tts/models folder and it is always downloaded on first start-up of the AllTalk_tts extension. However, you may either want to use a custom model version of your choosing, or point it to a different path on your system, or even point it so that API Local and XTTSv2 both use the same model that API TTS is using.

-

If you do choose to change the location there are a couple of things to note. 

-

- The folder you place the model in, cannot be called "models". This name is reserved solely for the system to identify you are or are not using a custom model.

-

- On each startup, the AllTalk tts extension will check the custom location and if it does not exist, it will create it and download the files it needs. It will also re download any missing files in that location that are needed for the model to function.

-

- There will be extra output at the console to inform you that you are using a custom model and each time you load up the AllTalk_tts extension or switch between models.

-

To change the model path, there are at minimum 2x settings you need to alter in the modeldownload.json file, base_path and model_path. These two settings are further detailed in the section below called Explanation of the modeldownload.json file

-

You would edit the settings in the modeldownload.json file as follows (make a backup of your current file in case): 

-

Windows example: c:\mystuff\mydownloads\myTTSmodel\{files in here}

- +

Text Not inside

+

This only affects the Narrator function. Most AI models should be using asterisks or double quotes to differentiate between the Narrator or the Character, however, many models sometimes switch between using asterisks and double quotes or sometimes nothing at all for the text it outputs.

This leaves a bit of a mess because sometimes un-marked text is narration and sometimes its the character talking, leaving no clear way to know where to split sentences and what voice to use. Whilst there is no 100% solution at the moment many models lean more one way or the other as to what that unmarked text will be (character or narrator).

+

As such, the "Text not inside" function at least gives you the choice to set how you want the TTS engine to handle situations of un-marked text.

+
When the AI doesnt use an asterisk or a quote
+

Back to top of page

-

Note: On Windows systems, you have to specify a double backslash \\ for each folder level in the path (as above).

-

Linux example: /home/myaccount/myTTSmodel/{files in here}

- +

Low VRAM

+

The Low VRAM option is a crucial feature designed to enhance performance under constrained (VRAM) conditions, as the TTS models require 2GB-3GB of VRAM to run effectively. This feature strategically manages the relocation of the Text-to-Speech (TTS) model between your system's Random Access Memory (RAM) and VRAM, moving it between the two on the fly. Obviously, this is very useful for people who have smaller graphics cards and will use all their VRAM to load in their LLM.

+

When you dont have enough VRAM free after loading your LLM model into your VRAM (Normal Mode example below), you can see that with so little working space, your GPU will have to swap in and out bits of the TTS model, which causes horrible slowdown.

+

Note: An Nvidia Graphics card is required for the LowVRAM option to work, as you will just be using system RAM otherwise. 

+

How It Works:

+

The Low VRAM mode intelligently orchestrates the relocation of the entire TTS model and stores the TTS model in your system RAM. When the TTS engine requires VRAM for processing, the entire model seamlessly moves into VRAM, causing your LLM to unload/displace some layers, ensuring optimal performance of the TTS engine.

+

Post-TTS processing, the model moves back to system RAM, freeing up VRAM space for your Language Model (LLM) to load back in the missing layers. This adds about 1-2 seconds to both text generation by the LLM and the TTS engine.

+

By transferring the entire model between RAM and VRAM, the Low VRAM option avoids fragmentation, ensuring the TTS model remains cohesive and has all the working space it needs in your GPU, without having to just work on small bits of the TTS model at a time (which causes terrible slow down).

+

This creates a TTS generation performance Boost for Low VRAM Users and is particularly beneficial for users with less than 2GB of free VRAM after loading their LLM, delivering a substantial 5-10x improvement in TTS generation speed.

+
How Low VRAM Works
+

Back to top of page

-

Once you restart the AllTalk_tts extension, it will check this path for the files and output any details at the console.

-

When you are happy it's' working correctly, you are welcome to go delete the models folder stored at /extensions/alltalk_tts/models.

-

If you wish to change the files that the modeldownloader is pulling at startup, you can futher edit the modeldownload.json and change the http addresses within this files files_to_download section  e.g.

-

    "files_to_download": {
-         "LICENSE.txt": "https://huggingface.co/coqui/XTTS-v2/resolve/v2.0.2/LICENSE.txt?download=true",
-         "README.md": "https://huggingface.co/coqui/XTTS-v2/resolve/v2.0.2/README.md?download=true",
-         "config.json": "https://huggingface.co/coqui/XTTS-v2/resolve/v2.0.2/config.json?download=true",
-         "model.pth": "https://huggingface.co/coqui/XTTS-v2/resolve/v2.0.2/model.pth?download=true",
-         "vocab.json": "https://huggingface.co/coqui/XTTS-v2/resolve/v2.0.2/vocab.json?download=true"
-     }

-

Back to top of page

-

Configuration Details

-

Explanation of the confignew.json file:

+

DeepSpeed

+

DeepSpeed provides a 2x-3x speed boost for Text-to-Speech and AI tasks. It's all about making AI and TTS happen faster and more efficiently.

+ +
DeepSpeed on vs off
+

DeepSpeed only works with the XTTSv2 Local model and will deactivate when other models are selected, even if the checkbox still shows as being selected.

+

Note: DeepSpeed/AllTalk may warn if the Nvidia Cuda Toolkit and CUDA_HOME environment variable isnt set correctly. On Linux you need CUDA_HOME configured correctly; on Windows, if you use the pre-built wheel its ok without.

+

Note: You do not need to set Text-generation-webUi's --deepspeed setting for AllTalk to be able to use DeepSpeed.

+

Back to top of page

- "activate:" true, Used within the code, do not change.
- "autoplay:" true, Controls whether the TTS audio plays automatically within Text generation webUI.
- "branding:" "AllTalk ", Used to change the default name shown on the command line. The name needs a space after it e.g. "Mybrand ".
- "deepspeed_activate:" false, Controls whether the DeepSpeed option is activated or disabled in the Gradio interface.
- "delete_output_wavs:" ""Disabled"", If set this will delete your old output wav files, older than the date set, when the system starts up.
- "ip_address:" "127.0.0.1", Specifies the default IP address for the web server.
- "language:" "English", Specifies the default language to use for TTS.
- "low_vram:" false, Controls whether the Low VRAM option is enabled or disabled.
- "local_temperature:" "0.70", Sets the temperature to use with the API Local and XTTSv2 Local methods.
- "local_repetition_penalty:" "10.0", Sets the repetition penalty to use with the API Local and XTTSv2 Local methods.
- "tts_model_loaded:" true, Used within the code, do not change.
- "tts_model_name:" "tts_models/multilingual/multi-dataset/xtts_v2", Specifies the model that the "API TTS" method will use for TTS generation.
- "narrator_enabled:" "female_02.wav", Specifies the default narrator voice to use for TTS.
- "narrator_voice:" "false", Enables and disables the narrator function.
- "port_number:" "7851", Specifies the default port number for the web server.
- "output_folder_wav:" "extensions/alltalk_tts/outputs/", Sets the output folder to send files to on generating TTS.
- "remove_trailing_dots:" false, Controls whether trailing dots are removed from text segments before generation.
- "show_text:" true, Controls whether message text is shown under the audio player.
- "tts_method_api_local:" false, Controls whether the "API Local" model/method is turned on or off.
- "tts_method_api_tts:" false, Controls whether the "API TTS" model/method is turned on or off.
- "tts_method_xtts_local:" true, Controls whether the "XTTSv2 Local" model/method is turned on or off.
- "voice:" "female_01.wav" Specifies the default voice to use for TTS.
-

Back to top of page

-

Explanation of the modeldownload.json file:

+

DeepSpeed Setup - Linux

+

➡️DeepSpeed requires an Nvidia Graphics card!⬅️

+
    +
  1. Preferably use your built in package manager to install the CUDA toolkit. Alternatively download and install the Nvidia Cuda Toolkit for Linux Nvidia Cuda Toolkit 11.8 or 12.1
  2. +
  3. Open a terminal console.
  4. +
  5. Install libaio-dev (however your Linux version installs things) e.g. sudo apt install libaio-dev
  6. +
  7. Move into your Text generation webUI folder e.g. cd text-generation-webui
  8. +
  9. Start the Text generation webUI Python environment ./cmd_linux.sh
  10. +
  11. Text generation webUI overwrites the CUDA_HOME environment variable each time you ./cmd_linux.sh or ./start_linux.sh so you will need to either permanently change within the python environment OR set CUDA_HOME it each time you ./cmd_linux.sh. Details to change it each time are on the next step. Below is a link to Conda's manual and changing environment variables permanently though its possible changing it permanently could affect other extensions, you would have to test. Conda manual - Environment variables
  12. +
  13. You can temporarily set the CUDA_HOME environment with (Standard Ubuntu path below, but it could vary on other Linux flavours):

    export CUDA_HOME=/etc/alternatives/cuda every time you run ./cmd_linux.sh

    If you try to start DeepSpeed with the CUDA_HOME path set incorrectly, expect an error similar to:

             [Errno 2] No such file or directory: /home/yourname/text-generation-webui/installer_files/env/bin/nvcc

  14. +
  15. Now install deepspeed with pip install deepspeed
  16. +
  17. You can now start Text generation webUI python server.py ensuring to activate your extensions.

    Just to reiterate, starting Text-generation-webUI with ./start_linux.sh will overwrite the CUDA_HOME variable unless you have permanently changed it, hence always starting it with ./cmd_linux.sh then setting the environment variable manually export CUDA_HOME=/etc/alternatives/cuda and then python server.py which is how you would need to run it each time, unless you permanently set the environment variable for CUDA_HOME within Text-generation-webUI's standard Python environment.

    Removal - If it became necessary to uninstall DeepSpeed, you can do so with ./cmd_linux.sh and then pip uninstall deepspeed
  18. +
+

Back to top of page

- "base_path:" "models", Specifies the base directory for the TTS models. If this is changed from the word "models" then the new custom path will be used e.g. C:\\mymodels
-

(Please note the use of a double backslash \\ between folders on Windows systems. Linux systems will use "/mymodels" style)

- "model_path:" "xttsv2_2.0.2", Specifies the directory path for the XTTSv2 model underneath the base_path.
-

So if base_path is C:\\mymodels and model_path is xttsv2_2.0.2, then your path would become c:\\mymodels\\xttsv2_2.0.2

- "files_to_download:" Dictionary containing files to download with their respective URLs.
- "LICENSE.txt": "https://huggingface.co/coqui/XTTS-v2/resolve/v2.0.2/LICENSE.txt?download=true", License file URL.
- "README.md": "https://huggingface.co/coqui/XTTS-v2/resolve/v2.0.2/README.md?download=true", README file URL.
- "config.json": "https://huggingface.co/coqui/XTTS-v2/resolve/v2.0.2/config.json?download=true", Config file URL.
- "model.pth": "https://huggingface.co/coqui/XTTS-v2/resolve/v2.0.2/model.pth?download=true", Model file URL.
- "vocab.json": "https://huggingface.co/coqui/XTTS-v2/resolve/v2.0.2/vocab.json?download=true", Vocabulary file URL.
-

If you wish to set your own path

-

CURL Commands

-

Generating TTS - Linux

- curl -X POST -H "Content-Type: application/json" -d '{"text": "This is text to generate as TTS","voice": "female_01.wav", "language": "en", "output_file": "outputfile.wav"}' "http://127.0.0.1:7851/api/generate" -

Generating TTS - Windows

- curl -X POST -H "Content-Type: application/json" -d "{\"text\": \"This is text to generate as TTS\", \"voice\": \"female_01.wav\", \"language\": \"en\", \"output_file\": \"outputfile.wav\"}" http://127.0.0.1:7851/api/generate -

Generating TTS - Notes

-

Replace This is text to generate as TTS with whatever you want it to say. female_01.wav with the voice sample you want to use. output_file.wav with the file name you want it to create.

-

JSON return {"status":"generate-success","data":{"audio_path":"outputfile.wav"}}

- -

Switch Model

- curl -X POST "http://127.0.0.1:7851/api/reload?tts_method=API%20Local"
- curl -X POST "http://127.0.0.1:7851/api/reload?tts_method=API%20TTS"
- curl -X POST "http://127.0.0.1:7851/api/reload?tts_method=XTTSv2%20Local" -

Switch between the 3 models respectively.

-

JSON return {"status": "model-success"}

+

DeepSpeed Setup - Windows

+

➡️DeepSpeed requires an Nvidia Graphics card!⬅️

+

DeepSpeed v11.2 will work on the current default text-generation-webui Python 3.11 environment! You have 2x options for how to setup DeepSpeed on Windows. A quick way Option 1 and a long way Option 2.

+

Thanks to @S95Sedan They managed to get DeepSpeed 11.2 working on Windows via making some edits to the original Microsoft DeepSpeed v11.2 installation. The original post is here.

+

OPTION 1 - Pre-Compiled Wheel Deepspeed v11.2 (Python 3.11 and 3.10)

+
    +
  1. Download the correct wheel version for your Python/Cuda from here and save the file it inside your text-generation-webui folder.
  2. +
  3. Open a command prompt window, move into your text-generation-webui folder you can now start the Python environment for text-generation-webui cmd_windows.bat
  4. +
  5. With the file that you saved in the text-generation-webui folder you now type the following, replacing your-version with the name of the file you have:

    pip install "deepspeed-0.11.2+your-version-win_amd64.whl"

  6. +
  7. This should install through cleanly and you should now have DeepSpeed v11.2 installed within the Python 3.11/3.10 environment of text-generation-webui.
  8. +
  9. When you start up text-generation-webui, and AllTalk starts, you should see:

                [AllTalk Startup] DeepSpeed Detected

  10. +
  11. Within AllTalk, you will now have a checkbox for Activate DeepSpeed though remember you can only change 1x setting every 15 or so seconds, so dont try to activate DeepSpeed and LowVRAM simultaneously. When you are happy it works, you can set the default start-up settings in the settings page.

    Removal - If it became necessary to uninstall DeepSpeed, you can do so with cmd_windows.bat and then pip uninstall deepspeed


    OPTION 2 - Manual build of DeepSpeed v11.2 (Python 3.11 and 3.10)

    Due to the complexity of this, and the complicated formatting, instructions can be found on this link
  12. +
+

Back to top of page

-

Switch DeepSpeed on/off

- curl -X POST -H "Content-Type: application/json" "http://127.0.0.1:7851/api/deepspeed?new_deepspeed_value=True" -

Replace True with False to disable DeepSpeed mode.

-

JSON return {"status": "deepspeed-success"}

-

Note: Enabling DeepSpeed on systems that dont have DeepSpeed installed, may cause errors.

-

Switch Low VRAM on/off

- curl -X POST -H "Content-Type: application/json" "http://127.0.0.1:7851/api/lowvramsetting?new_low_vram_value=True" -

Replace True with False to disable Low VRAM mode.

-

JSON return {"status": "lowvram-success"}

-

Back to top of page

-

Debugging and TTS Generation Information:

-

Command line outputs are more verbose to assist in understanding backend processes and debugging.

-

Its possible during startup you can get a warning message such as [AllTalk Startup] Warning TTS Subprocess has NOT started up yet, Will keep trying for 60 seconds maximum This is normal behavior if the subprocess is taking a while to start, however, if there is an issue starting the subprocess, you may see multiples of this message and an it will time out after 60 seconds, resulting in the TTS engine not starting. Its likely that you are not in the correct python environment or one that has a TTS engine inside, if this happens, though the system will output a warning about that ahead of this message

-

Typically the command line console will output any warning or error messages. If you need to reset your default configuation, the settings are all listed above in the configuration details.

-

Back to top of page

+

TTS Models/Methods

+

It's worth noting that all models and methods can and do sound different from one another. Many people complained about the quality of audio produced by the 2.0.3 model, so this extension will download the 2.0.2 model to your models folder and give you the choice to use 2.0.2 (API Local and XTTSv2 Local) or use the most current model 2.0.3 (API TTS). As/When a new model is released by Coqui it will be downloaded by the TTS service on startup and stored wherever the TTS service keeps new models for your operating system.

+ +

Back to top of page

-

Thanks & References

-

Coqui TTS Engine

- -

Extension coded by

- -

Thanks to & Text generation webUI

- -

Thanks to

- -

Back to top of page

+ +

Model Temperature and Repetition Settings

+

It is recommended not to modify these settings unless you fully comprehend their effects. A general overview is provided below for reference.

+

Changes to these settings won't take effect until you restart AllTalk/Text generation webUI.

+

These settings only affect API Local and XTTSv2 Local methods.

+

Repetition Penalty:

+

In the context of text-to-speech (TTS), the Repetition Penalty influences how the model handles the repetition of sounds, phonemes, or intonation patterns. Here's how it works:

+ +

The factory setting for repetition penalty is 10.0

+

Temperature:

+

Temperature influences the randomness of the generated speech. Here's how it affects the output:

+ +

The factory setting for temperature is 0.70

+ + +

Temperature and Repetition Settings Examples:

+ +

Factory settings should be fine for most people, however if you choose to experiment, setting extremely high or low values, especially without a good understanding of their effects, may lead to flat-sounding output or very strange-sounding output. It's advisable to experiment with adjustments incrementally and observe the impact on the generated speech to find a balance that suits your desired outcome.

+

Back to top of page

+ + +

Start-up Checks

+

AllTalk performs a variety of checks on startup and will warn out messages at the console should you need to do something such as update your TTS version. 

+

A basic environment check to ensure everything should work e.g. is the model already downloaded, are the configuration files set correctly etc.

+

AllTalk will download the Xtts model (version 2.0.2) into your models folder. Many people didnt like the quality of the 2.0.3 model, however the latest model will be accessable on the API TTS setting (2.0.3 at the time of writing) so you have the best of both worlds.

+

Back to top of page

+ +

Custom TTS Models and Model path

+

Its possible to set a custom model for the API Local and XTTSv2 Local methods, or indeed point it at the same model that API TTS uses (wherever it is stored on your OS of choice).

+

Many people did not like the sound quality of the Coqui 2.0.3 model, and as such the AllTalk downloads the 2.0.2 model seperately from the 2.0.3 model that TTS service downloads and manages.

+

Typically the 2.0.2 model is stored in your /alltalk_tts/models folder and it is downloaded on first start-up of the AllTalk_tts extension. However, you may either want to use a custom model version of your choosing, or re-point AllTalk to a different path on your system, or even point it so that API Local and XTTSv2 Local both use the same model that API TTS is using.

+

If you do choose to change the location there are a couple of things to note. 

+ +

To change the model path, there are at minimum 2x settings you need to alter in the modeldownload.json file, base_path and model_path.

+

You would edit the settings in the modeldownload.json file as follows (make a backup of your current file in case):

        Windows path example: c:\\mystuff\\mydownloads\\myTTSmodel\\{files in here}
        base_path would be "c:\\mystuff\\mydownloads"
        model_path would be: "myTTSmodel"

+

Note: On Windows systems, you have to specify a double backslash \\ for each folder level in the path (as above)

+

        Linux path example: /home/myaccount/myTTSmodel/{files in here}
        base_path would be "/home/myaccount"
        model_path would be: "TTSmodel"

Once you restart Alltalk, it will check this path for the files and output any details at the console.

+

When you are happy it's' working correctly, you are welcome to go delete the models folder stored at /alltalk_tts/models.

+

If you wish to change the files that the modeldownloader is pulling at startup, you can futher edit the modeldownload.json and change the https addresses within this files files_to_download section  e.g.

+

"files_to_download": {
        "LICENSE.txt": "https://huggingface.co/coqui/XTTS-v2/resolve/v2.0.2/LICENSE.txt?download=true",
        "README.md": "https://huggingface.co/coqui/XTTS-v2/resolve/v2.0.2/README.md?download=true",
        "config.json": "https://huggingface.co/coqui/XTTS-v2/resolve/v2.0.2/config.json?download=true",
        "model.pth": "https://huggingface.co/coqui/XTTS-v2/resolve/v2.0.2/model.pth?download=true",
        "vocab.json": "https://huggingface.co/coqui/XTTS-v2/resolve/v2.0.2/vocab.json?download=true"
 }

+

Back to top of page

+ +

Configuration file settings

+

confignew.json file:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
KeyDefault ValueExplanation
"activate"trueSets activation state within Text-generation-webUI.
"autoplay"trueSets autoplay within Text generation webUI.
"branding""AllTalk"Used to change the default name. Requires a space e.g. "Mybrand ".
"deepspeed_activate"falseSets DeepSpeed activation on startup.
"delete_output_wavs""Disabled"Sets duration of outputs to delete.
"ip_address""127.0.0.1"Sets default IP address.
"language""English"Sets default language for Text-generation-webUI TTS.
"low_vram"falseSets default setting for LowVRAM mode.
"local_temperature""0.70"Sets default model temp for API Local and XTTSv2 Local.
"local_repetition_penalty""10.0"Sets default model repetition for API Local and XTTSv2 Local.
"tts_model_loaded"trueAllTalk internal use only. Do not change.
"tts_model_name""tts_models/multilingual/multi-dataset/xtts_v2"Sets default model that API TTS is looking for through the TTS service (separate to API Local and XTTSv2 Local).
"narrator_enabled"trueSets default narrator on/off in Text-generation-webUI TTS.
"narrator_voice""female_02.wav"Sets default wav to use for narrator in Text-generation-webUI TTS.
"port_number""7851"Sets default port number for AllTalk.
"output_folder_wav""extensions/alltalk_tts/outputs/"Sets default output path Text-generation-webUI should use for finding outputs.
"output_folder_wav_standalone""outputs/"Sets default output path in standalone mode.
"remove_trailing_dots"falseSets trailing dot removal pre-generating TTS.
"show_text"trueSets if text should be displayed below audio in Text-generation-webUI.
"tts_method_api_local"falseSets API Local as the default model/method for TTS.
"tts_method_api_tts"falseSets API TTS as the default model/method for TTS.
"tts_method_xtts_local"trueSets XTTSv2 Local as the default model/method for TTS.
"voice""female_01.wav"Sets default voice for TTS.
+ +

modeldownload.json file:

+ + + + + + + + + + + + + + + + + + + + + +
KeyValueDescription
"base_path""models"Sets local model base path for API Local and XTTSv2 Local.
"model_path""xttsv2_2.0.2"Sets local model folder for API Local and XTTSv2 Local below the base path.
"files_to_download" + + + + + + + + + + + + + + + + + + + + + + + + + +
FileDownload URL
"LICENSE.txt"https://huggingface.co/coqui/XTTS-v2/resolve/v2.0.2/LICENSE.txt?download=true
"README.md"https://huggingface.co/coqui/XTTS-v2/resolve/v2.0.2/README.md?download=true
"config.json"https://huggingface.co/coqui/XTTS-v2/resolve/v2.0.2/config.json?download=true
"model.pth"https://huggingface.co/coqui/XTTS-v2/resolve/v2.0.2/model.pth?download=true
"vocab.json"https://huggingface.co/coqui/XTTS-v2/resolve/v2.0.2/vocab.json?download=true
+
Sets the model files required to be downloaded into \base_path\model_path\ and where to download them from.
+ +

JSON calls & CURL Commands

+

Generating TTS - Linux

+

curl -X POST -H "Content-Type: application/json" -d '{"text": "This is text to generate as TTS","voice": "female_01.wav", "language": "en", "output_file": "outputfile.wav"}' "http://127.0.0.1:7851/api/generate"

+

Generating TTS - Windows

+

curl -X POST -H "Content-Type: application/json" -d "{\"text\": \"This is text to generate as TTS\", \"voice\": \"female_01.wav\", \"language\": \"en\", \"output_file\": \"outputfile.wav\"}" http://127.0.0.1:7851/api/generate

+

Generating TTS - Notes

+

Replace This is text to generate as TTS with whatever you want it to say. female_01.wav with the voice sample you want to use. output_file.wav with the file name you want it to create.

+

JSON return {"status":"generate-success","data":{"audio_path":"outputfile.wav"}}

+ +

Switching Model

+

curl -X POST "http://127.0.0.1:7851/api/reload?tts_method=API%20Local"
curl -X POST "http://127.0.0.1:7851/api/reload?tts_method=API%20TTS"
curl -X POST "http://127.0.0.1:7851/api/reload?tts_method=XTTSv2%20Local"

+

Switch between the 3 models respectively.

+

JSON return {"status": "model-success"}

+

Switch DeepSpeed

+

curl -X POST -H "Content-Type: application/json" "http://127.0.0.1:7851/api/deepspeed?new_deepspeed_value=True"

+

Replace True with False to disable DeepSpeed mode.

+

JSON return {"status": "deepspeed-success"}

+

Switching Low VRAM

+

curl -X POST -H "Content-Type: application/json" "http://127.0.0.1:7851/api/lowvramsetting?new_low_vram_value=True"

+

Replace True with False to disable Low VRAM mode.

+

JSON return {"status": "lowvram-success"}

+

Back to top of page

+ +

Debugging and TTS Generation Information

+

Command line outputs are more verbose to assist in understanding backend processes and debugging.

+

Its possible during startup you can get a warning message such as:

            [AllTalk Startup] Warning TTS Subprocess has NOT started up yet, Will keep trying for 60 seconds maximum

This is normal behavior if the subprocess is taking a while to start, however, if there is an issue starting the subprocess, you may see multiples of this message and an it will time out after 60 seconds, resulting in the TTS engine not starting. Its likely that you are not in the correct python environment or one that has a TTS engine inside, if this happens, though the system will output a warning about that ahead of this message

+

Typically the command line console will output any warning or error messages. If you need to reset your default configuation, the settings are all listed above in the configuration details.

+

Back to top of page

+

Thanks & References

+

Coqui TTS Engine

+ +

Extension coded by

+ +

Thanks to & Text generation webUI

+ +

Thanks to

+ +

Back to top of page