CodingBillionaire commited on
Commit
4ba2448
·
1 Parent(s): dce1c7d

Upload 10 files

Browse files
.gitignore ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Ignore Python bytecode
2
+ __pycache__
3
+
4
+ # Ignore settings
5
+ config.json
6
+ .env
7
+
8
+ # Ignore generated files
9
+ outputs/
10
+ favorites/
11
+ voices/
12
+ collections/
13
+ outputs-rvc/
14
+ voices-tortoise/
15
+
16
+ # Ignore model checkpoints
17
+ data/
18
+
19
+ # Ignore temporary files
20
+ temp/
21
+
22
+ # Ignore node modules
23
+ node_modules/
24
+
25
+ # Editors
26
+ .vscode/
27
+ .idea/
28
+ .sourcery.yaml
29
+
30
+ # Ignore temporary Jupiter notebooks
31
+ *.temp.ipynb
Dockerfile ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Python 3.10 w/ Nvidia Cuda
2
+ FROM nvidia/cuda:11.8.0-devel-ubuntu22.04 AS env_base
3
+
4
+ # Install Pre-reqs
5
+ RUN apt-get update && apt-get install --no-install-recommends -y \
6
+ git vim nano build-essential python3-dev python3-venv python3-pip gcc g++ ffmpeg
7
+
8
+ # Setup venv
9
+ RUN pip3 install virtualenv
10
+ RUN virtualenv /venv
11
+ ENV VIRTUAL_ENV=/venv
12
+ RUN python3 -m venv $VIRTUAL_ENV
13
+ ENV PATH="$VIRTUAL_ENV/bin:$PATH"
14
+ RUN pip3 install --upgrade pip setuptools && \
15
+ pip3 install torch torchvision torchaudio
16
+
17
+ # Set working directory
18
+ WORKDIR /app
19
+
20
+ # Clone the repo
21
+ RUN git clone https://github.com/rsxdalv/tts-generation-webui.git
22
+
23
+ # Set working directory to the cloned repo
24
+ WORKDIR /app/tts-generation-webui
25
+
26
+ # Install all requirements
27
+ RUN pip3 install -r requirements.txt
28
+ RUN pip3 install -r requirements_audiocraft.txt
29
+ RUN pip3 install -r requirements_bark_hubert_quantizer.txt
30
+ RUN pip3 install -r requirements_rvc.txt
31
+
32
+ # Run the server
33
+ CMD python server.py
LICENSE ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ MIT License
2
+
3
+ Copyright (c) 2023 Roberts Slisans
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
app.py ADDED
@@ -0,0 +1,160 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import src.utils.setup_or_recover as setup_or_recover
3
+ import src.utils.dotenv_init as dotenv_init
4
+ import gradio as gr
5
+
6
+ from src.config.load_config import default_config
7
+ from src.config.config import config
8
+
9
+ from src.css.css import full_css
10
+ from src.Joutai import Joutai
11
+ from src.history_tab.collections_directories_atom import collections_directories_atom
12
+
13
+ setup_or_recover.dummy()
14
+ dotenv_init.init()
15
+
16
+
17
+ def reload_config_and_restart_ui():
18
+ os._exit(0)
19
+ # print("Reloading config and restarting UI...")
20
+ # config = load_config()
21
+ # gradio_interface_options = config["gradio_interface_options"] if "gradio_interface_options" in config else {}
22
+ # demo.close()
23
+ # time.sleep(1)
24
+ # demo.launch(**gradio_interface_options)
25
+
26
+
27
+ gradio_interface_options = (
28
+ config["gradio_interface_options"]
29
+ if "gradio_interface_options" in config
30
+ else default_config
31
+ )
32
+
33
+ with gr.Blocks(
34
+ css=full_css,
35
+ title="TTS Generation WebUI",
36
+ analytics_enabled=False, # it broke too many times
37
+ ) as demo:
38
+ gr.Markdown("# TTS Generation WebUI (Bark, MusicGen + AudioGen, Tortoise, RVC)")
39
+ with Joutai.singleton.tabs:
40
+ from src.tortoise.generation_tab_tortoise import generation_tab_tortoise
41
+ from src.settings_tab_gradio import settings_tab_gradio
42
+ from src.bark.generation_tab_bark import generation_tab_bark
43
+ from src.history_tab.main import history_tab
44
+ from src.bark.settings_tab_bark import settings_tab_bark
45
+ from src.history_tab.voices_tab import voices_tab
46
+ from src.vocos.vocos_tabs import vocos_tabs
47
+ from src.studio.studio_tab import simple_remixer_tab
48
+
49
+ register_use_as_history_button = generation_tab_bark()
50
+
51
+ try:
52
+ from src.bark.clone.tab_voice_clone import tab_voice_clone
53
+
54
+ tab_voice_clone(register_use_as_history_button)
55
+ except Exception as e:
56
+ from src.bark.clone.tab_voice_clone_error import tab_voice_clone_error
57
+
58
+ tab_voice_clone_error(e)
59
+ print("Failed to load voice clone demo")
60
+ print(e)
61
+
62
+ try:
63
+ from src.musicgen.musicgen_tab import generation_tab_musicgen
64
+
65
+ generation_tab_musicgen()
66
+ except Exception as e:
67
+ from src.musicgen.musicgen_tab_error import musicgen_tab_error
68
+
69
+ musicgen_tab_error(e)
70
+ print("Failed to load musicgen demo")
71
+ print(e)
72
+
73
+ try:
74
+ from src.rvc_tab.rvc_tab import rvc_conversion_tab
75
+
76
+ rvc_conversion_tab()
77
+ except Exception as e:
78
+ from src.rvc_tab.rvc_tab_error import rvc_tab_error
79
+
80
+ rvc_tab_error(e)
81
+ print("Failed to load rvc demo")
82
+ print(e)
83
+
84
+ try:
85
+ from src.demucs.demucs_tab import demucs_tab
86
+
87
+ demucs_tab()
88
+ except Exception as e:
89
+ from src.demucs.demucs_tab_error import demucs_tab_error
90
+
91
+ demucs_tab_error(e)
92
+ print("Failed to load demucs demo")
93
+ print(e)
94
+
95
+ vocos_tabs()
96
+ generation_tab_tortoise()
97
+
98
+ collections_directories_atom.render()
99
+ history_tab(register_use_as_history_button)
100
+ history_tab(register_use_as_history_button, directory="favorites")
101
+ history_tab(
102
+ register_use_as_history_button, directory="outputs", show_collections=True
103
+ )
104
+ voices_tab(register_use_as_history_button)
105
+
106
+ with gr.Tab("Settings"):
107
+ from src.settings_tab_gradio import settings_tab_gradio
108
+
109
+ settings_tab_gradio(reload_config_and_restart_ui, gradio_interface_options)
110
+
111
+ from src.bark.settings_tab_bark import settings_tab_bark
112
+
113
+ settings_tab_bark()
114
+ from src.utils.model_location_settings_tab import (
115
+ model_location_settings_tab,
116
+ )
117
+
118
+ model_location_settings_tab()
119
+
120
+ remixer_input = simple_remixer_tab()
121
+ Joutai.singleton.tabs.render()
122
+
123
+
124
+ def print_pretty_options(options):
125
+ print("Gradio interface options:")
126
+ max_key_length = max(len(key) for key in options.keys())
127
+ for key, value in options.items():
128
+ if key == "auth" and value is not None:
129
+ print(f" {key}:{' ' * (max_key_length - len(key))} {value[0]}:******")
130
+ else:
131
+ print(f" {key}:{' ' * (max_key_length - len(key))} {value}")
132
+
133
+
134
+ # detect if --share is passed
135
+ if "--share" in os.sys.argv:
136
+ print("Gradio share mode enabled")
137
+ gradio_interface_options["share"] = True
138
+
139
+
140
+ print("Starting Gradio server...")
141
+ if not gradio_interface_options["enable_queue"]:
142
+ print("Warning: Gradio server queue is disabled. Automatically enabling")
143
+ gradio_interface_options["enable_queue"] = True
144
+ if gradio_interface_options["auth"] is not None:
145
+ # split username:password into (username, password)
146
+ gradio_interface_options["auth"] = tuple(
147
+ gradio_interface_options["auth"].split(":")
148
+ )
149
+ print("Gradio server authentication enabled")
150
+ print_pretty_options(gradio_interface_options)
151
+
152
+
153
+ def start_server():
154
+ demo.queue(
155
+ concurrency_count=gradio_interface_options.get("concurrency_count", 5),
156
+ ).launch(**gradio_interface_options)
157
+
158
+
159
+ if __name__ == "__main__":
160
+ start_server()
docker-compose.yml ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ version: '3'
2
+ services:
3
+ tts-generation-webui:
4
+ image: rsxdalv/tts-generation-webui
5
+ restart: unless-stopped
6
+ ports:
7
+ - "7860:7860"
8
+ container_name: tts-generation-webui
9
+ deploy:
10
+ resources:
11
+ reservations:
12
+ devices:
13
+ - driver: nvidia
14
+ device_ids: ['0']
15
+ capabilities: [gpu]
requirements.txt ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ safetensors==0.3.1 # Until they fix it
2
+ torch==2.0.0 # BSD 3-Clause - ensures torch is not reinstalled
3
+ ffmpeg-python # Apache 2.0
4
+ gradio==3.35.2
5
+ python-dotenv==1.0.0
6
+ soundfile==0.12.1; sys_platform == 'win32' # torchaudio
7
+ # sox # torchaudio for linux
8
+ suno-bark @ git+https://github.com/suno-ai/bark@56b0ba13f7c281cbffa07ea9abf7b30273a60b6a#egg=suno-bark # MIT License
9
+ vocos==0.0.2 # MIT License
10
+ tortoise @ git+https://github.com/rsxdalv/tortoise-tts@72eccabcb7d4c7a9d943a2c9b63211e4286cf385#egg=tortoise # Apache 2.0
requirements_audiocraft.txt ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ torch==2.0.0 # BSD 3-Clause - ensures torch is not reinstalled
2
+ # audiocraft==0.0.1 # MIT License
3
+ xformers==0.0.19 # For torch==2.0.0 project plane
4
+ audiocraft @ git+https://[email protected]/facebookresearch/audiocraft@e96018613ac82b1afe0f0cce7861dfe08ba2b3bf#egg=audiocraft # MIT License
requirements_bark_hubert_quantizer.txt ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ torch==2.0.0 # BSD 3-Clause - ensures torch is not reinstalled
2
+ # pre-install fairseq for bark_hubert_quantizer
3
+ fairseq @ https://github.com/Sharrnah/fairseq/releases/download/v0.12.4/fairseq-0.12.4-cp310-cp310-win_amd64.whl ; sys_platform == 'win32' # MIT License
4
+ bark_hubert_quantizer @ git+https://github.com/rsxdalv/bark-voice-cloning-HuBERT-quantizer@bark_hubert_quantizer#egg=bark_hubert_quantizer # MIT License
requirements_rvc.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ torch==2.0.0 # BSD 3-Clause - ensures torch is not reinstalled
2
+ torchcrepe @ git+https://github.com/rsxdalv/torchcrepe@patch-1 # MIT License
3
+ rvc-beta @ git+https://github.com/rsxdalv/Retrieval-based-Voice-Conversion-WebUI@package # MIT License
update.py ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import subprocess
2
+
3
+
4
+ def do(cmd): # https://stackoverflow.com/a/62986640
5
+ try:
6
+ run = subprocess.run(cmd, shell=True)
7
+ run.check_returncode()
8
+ return run
9
+ except subprocess.CalledProcessError as e:
10
+ print(e.stderr.decode().strip())
11
+ raise e
12
+
13
+
14
+ def try_install(requirements, name=None):
15
+ try:
16
+ print(f"Installing {name or requirements} dependencies...")
17
+ do(f"pip install -r {requirements}")
18
+ print(f"Successfully installed {name or requirements} dependencies")
19
+ except Exception:
20
+ print(f"Failed to install {name or requirements} dependencies")
21
+
22
+
23
+ def main():
24
+ print("Updating dependencies...")
25
+ try_install("requirements_audiocraft.txt", "musicgen, audiocraft")
26
+ try_install("requirements_bark_hubert_quantizer.txt", "Bark Voice Clone, bark-hubert-quantizer")
27
+ try_install("requirements_rvc.txt", "RVC")
28
+ # hydracore fix because of fairseq
29
+ do("pip install hydra-core==1.3.2")
30
+
31
+
32
+ if __name__ == "__main__":
33
+ main()