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 */ + } + + + +
-Text generation webUI webpage here and documentation here
-AllTalk Github here +
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
AllTalk is a web interface, based around the Coqui TTS speech generation system. To generate TTS, you can use the provided interface or interact with the server using CURL commands. Below are some details and examples:
-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 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.
-IMPORTANT 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.
-Details on how to edit your greeting card, and where I'm at with solving this, can be found here erew123's Github and you can look here at an example of how text should be formatted with quotes and asterisks Text Not inside function
- -AllTalk Updating instructions here -
AllTalk Help and issues here - -
http://{{ params["ip_address"] }}:{{ params["port_number"] }}http://{{ params["ip_address"] }}:{{ params["port_number"] }}/readyVoice samples are stored in /extensions/alltalk_tts/voices/ and should be named using the following format name.wav
-Voice samples are stored in /extensions/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 startup.
-This extension will download the 2.0.2 model to /extensions/alltalk_tts/models/
-This TTS engine will also download the latest available model and store it wherever it normally stores it for your OS (Windows/Linux/Mac).
-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 sample, however Ive not noticed any improvemnt in voice output from a much shorter clip.
-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 result. Dont forget, the AI that processes the sounds can hear everything, all those liitle noises, 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 one 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).
-So youve downloaded your favoutie celebrity interview off Youtube or wherever. From here you need to chop it down to 6 to 12 seconds in length and resample it. If you need to clean it up, do audio processing, volume level changes etc, do it before the steps I am about to describe.
-Using the latest version of Audacity, select your clip and Tracks > Resample to 22050Hz, then Tracks > Mix > Stereo to Mono. and then File > Export Audio, saving it as a WAV of 22050Hz.
-Save your generated wav file in /extensions/alltalk_tts/voices/
-Note: Using AI generated audio clips may introduce unwanted sounds as its already a copy/simulation of a voice.
-The reasons can be that you:
-When using 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 nothing at all. This leaves a bit of a mess because sometimes that text is narration and sometimes its the character talking and there's no clear way to know where to split sentences. There is no 100% solution at the moment.
-Most models usually lean more way than the other as to it is narration or the character talking when it does this. So you can use the "Text NOT inside of * or " is" function to decide what the TTS engine should do in situations like this. It's an either/or situation. It will either use the Character voice or the narrator voice when text is not inside asterisks or double quotes.
- -
- Caution: It is recommended not to modify these settings unless you fully comprehend their effects. A general overview is provided below for reference.
-Note: Any changes to these two settings won't take effect until you restart AllTalk/Text generation webUI.
- -These settings only affect API Local and XTTSv2 Local methods.
- -In the context of text-to-speech (TTS), the Repetition Penalty (e.g., "local_repetition_penalty") influences how the model handles the repetition of sounds, phonemes, or intonation patterns. Here's how it works:
-In the context of text-to-speech (TTS), the Temperature (e.g., "local_temperature") influences the randomness of the generated speech. Here's how it affects the output:
-In the XTTSv2 version 2.0.2 model, the default factory values are:
- -The temperature has been set at 0.70 here though, as it often produces a slightly better result (in my estimation).
- -The default settings for any model are usually provided in the confignew.json file that comes wtih the model and this file can be found within the folder where the model is stored.
-These default values are carefully chosen to offer a reasonable starting point for users, and adjustments can be made based on individual preferences and use cases. However, it's important to note that changing these settings or setting them to extremes may result in unexpected outcomes. 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.
- - -The Low VRAM option is a crucial feature designed to enhance performance under constrained Video Random Access Memory (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.
-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 LowVRAM, as you will be using system memory for the models otherwise.
- -The Low VRAM mode intelligently orchestrates the relocation of the entire TTS model. 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.
-The TTS model is fully loaded into VRAM, facilitating uninterrupted and efficient TTS generation, creating contiguous space for the TTS model and significantly accelerating TTS processing, especially for long paragraphs. Post-TTS processing, the model promptly moves back to 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 accessible.
-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.
- -
- DeepSpeed, developed by Microsoft, is like a speed boost for Text-to-Speech (TTS) tasks. It's all about making TTS happen faster and more efficiently.
-Note: An Nvidia Graphics card is required for DeepSpeed
- -
- Note: DeepSpeed only works with the XTTSv2 Local model.
-Note: Requires Nvidia Cuda Toolkit installation and correct CUDA_HOME path configuration.
- -In AllTalkTTS, the DeepSpeed checkbox will only be available if DeepSpeed is detected on your system. Check the checkbox, wait 10 to 30 seconds and off you go!
- - -Note: DeepSpeed/AllTalk may warn if the Nvidia Cuda Toolkit and CUDA_HOME environment variables arent set. On Linux I believe you need these installed, on Windows, if you use the pre-built wheel it seems ok without.
- -sudo apt install libaio-devcd text-generation-webui./start_linux.sh./start_linux.shexport CUDA_HOME=/usr/local/cuda or export CUDA_HOME=/etc/alternatives/cuda. On some systems only one of those two commands may be the correct command, so you may need to try one, see if it works, if not try the other. IF you do not set it, expect a big messy output to the log when you try to activate DeepSpeed.pip install deepspeedNote: You can run ds_report when you have installed DeepSpeed on your system to see if it is working correctly
python server.py ensuring to activate your extensions.Currently/Officially only DeepSpeed v8.3 is installing on Windows, due to the broken installation routine by Microsoft, however, between myself and S95Sedan its now possible to install DeepSpeed v11.1 or v11.2 on Windows.
- -This is to use the pre built DeepSpeed v11.2 wheel file. This is quite a quick process and should work for 99% of people.
- -Note: In my tests, with this method you will not need to install the Nvidia CUDA toolkit to make this work, but AllTalk may warn you when starting DeepSpeed that it doesn't see the CUDA Toolkit; however, it works fine for TTS purposes.
- -cmd_windows.batpip install "deepspeed-0.11.2+yourversionhere-win_amd64.whl"Due to the complexity of this, Im not keeping the instructions within this document as it would be too complex to format.
-As such, the instuctions can be found on this link - -
- -Ensures a minimum TTS version (0.21.3) is installed and provides an error/instructions if not.
-Performs a basic environment check to ensure everything should work e.g. is the model already downloaded, are the configuration files set correctly etc.
-Downloads the Xtts model (version 2.0.2) to improve generation speech quality as the 2.0.3 model sounded terrible. The API TTS version uses the latest model (2.0.3 at the time of writing) so you have the best of both worlds.
- - -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 AllTalk it will be downloaded by the TTS service on startup and stored wherever the TTS service keeps new models on your operating system of choice.
-