Skip to content

Commit fe2e77e

Browse files
authored
Fix deepspeed (#504)
* * Fix deepspeed for Windows. Thank you for the reports! * Improve decorator extensions for future API. * Improve Kokoro TTS API for OpenAI compatibility, now usable with SillyTavern. * Add setup.py for future pip installs. Sync versions.json with setup.py and package.json. * add information about integrations and extensions
1 parent 60f01a9 commit fe2e77e

File tree

10 files changed

+507
-432
lines changed

10 files changed

+507
-432
lines changed

README.md

Lines changed: 418 additions & 381 deletions
Large diffs are not rendered by default.
84.5 KB
Loading
50.8 KB
Loading
98.9 KB
Loading

installer_scripts/versions.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"version": "0.3.0",
3-
"pip_packages": 16,
3+
"pip_packages": 17,
44
"npm_packages": 4,
55
"react_ui": 4
66
}

react-ui/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "tts-generation-webui-react",
3-
"version": "0.1.0",
3+
"version": "0.4.0",
44
"private": true,
55
"scripts": {
66
"dev": "next dev -p 3001",

react-ui/src/pages/api/gradio-file-proxy/[...path].tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,14 @@ export default async function handler(
1919
// Construct the full URL to the Gradio backend
2020
let gradioUrl: string;
2121

22+
// handle auth
23+
// const auth = process.env.GRADIO_AUTH;
24+
// if (auth) {
25+
// const [username, password] = auth.split(":");
26+
// const authHeader = `Basic ${Buffer.from(`${username}:${password}`).toString('base64')}`;
27+
// req.headers.authorization = authHeader;
28+
// }
29+
2230
// Handle the special case for gradio_api/file= format
2331
if (originalPath.startsWith("gradio_api/file=")) {
2432
// For URLs like: gradio_api/file=C:/Users/rob/AppData/Local/Temp/gradio/...

requirements.txt

Lines changed: 29 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,29 @@
1-
safetensors
2-
python-dotenv==1.0.0
3-
4-
ffmpeg-python # Apache 2.0
5-
gradio==5.5.0 # MIT License
6-
pydantic==2.10.6 # for gradio 5.5.0 fix
7-
pillow==10.3.0 # for gradio, conda fix
8-
beartype>=0.16.1 # workaround for a bug
9-
soundfile==0.12.1; sys_platform == 'win32' # torchaudio
10-
# sox # torchaudio for linux
11-
# no longer required directly # transformers==4.36.1 # cross-compatibility
12-
deepspeed @ https://github.com/rsxdalv/DeepSpeed/releases/download/v0.15.5-test/deepspeed-0.15.5+unknown-cp310-cp310-win_amd64.whl ; sys_platform == 'win32' # Apache 2.0
13-
fairseq @ https://github.com/rsxdalv/fairseq/releases/download/v0.12.3/fairseq-0.12.13-cp310-cp310-win_amd64.whl ; sys_platform == 'win32' # MIT License
14-
fairseq @ https://github.com/rsxdalv/fairseq/releases/download/v0.12.3/fairseq-0.12.13-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl ; sys_platform == 'linux' # MIT License
15-
fairseq @ https://github.com/rsxdalv/fairseq/releases/download/v0.12.3/fairseq-0.12.13-cp310-cp310-macosx_11_0_universal2.whl ; sys_platform == 'darwin' # MIT License
16-
accelerate>=0.33.0
17-
# optimum-quanto==0.2.6
18-
19-
# experimental
20-
# triton>=3.2.0 ; sys_platform == 'linux',
21-
# triton-windows>=3.2.0.post18 ; sys_platform == 'win32',
22-
# flash-attn @ https://github.com/kingbri1/flash-attention/releases/download/v2.7.4.post1/flash_attn-2.7.4.post1+cu124torch2.6.0cxx11abiFALSE-cp310-cp310-win_amd64.whl ; sys_platform == 'win32'
23-
# flash-attn @ https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.4.post1/flash_attn-2.7.4.post1+cu12torch2.6cxx11abiFALSE-cp310-cp310-linux_x86_64.whl ; sys_platform == 'linux'
24-
25-
26-
extension_bark @ git+https://github.com/rsxdalv/extension_bark@main
27-
extension_tortoise @ git+https://github.com/rsxdalv/extension_tortoise@main
28-
extension_demucs @ git+https://github.com/rsxdalv/extension_demucs@main
29-
extension_mms @ git+https://github.com/rsxdalv/extension_mms@main
30-
extension_seamless_m4t @ git+https://github.com/rsxdalv/extension_seamless_m4t@main
31-
extension_vocos @ git+https://github.com/rsxdalv/extension_vocos@main
1+
safetensors
2+
python-dotenv==1.0.0
3+
4+
ffmpeg-python # Apache 2.0
5+
gradio==5.5.0 # MIT License
6+
pydantic==2.10.6 # for gradio 5.5.0 fix
7+
pillow==10.3.0 # for gradio, conda fix
8+
beartype>=0.16.1 # workaround for a bug
9+
soundfile==0.12.1; sys_platform == 'win32' # torchaudio
10+
deepspeed==0.16.5; sys_platform == 'win32' # Apache 2.0
11+
fairseq @ https://github.com/rsxdalv/fairseq/releases/download/v0.12.3/fairseq-0.12.13-cp310-cp310-win_amd64.whl ; sys_platform == 'win32' # MIT License
12+
fairseq @ https://github.com/rsxdalv/fairseq/releases/download/v0.12.3/fairseq-0.12.13-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl ; sys_platform == 'linux' # MIT License
13+
fairseq @ https://github.com/rsxdalv/fairseq/releases/download/v0.12.3/fairseq-0.12.13-cp310-cp310-macosx_11_0_universal2.whl ; sys_platform == 'darwin' # MIT License
14+
accelerate>=0.33.0
15+
# optimum-quanto==0.2.6
16+
17+
# experimental
18+
# triton>=3.2.0 ; sys_platform == 'linux',
19+
# triton-windows>=3.2.0.post18 ; sys_platform == 'win32',
20+
# flash-attn @ https://github.com/kingbri1/flash-attention/releases/download/v2.7.4.post1/flash_attn-2.7.4.post1+cu124torch2.6.0cxx11abiFALSE-cp310-cp310-win_amd64.whl ; sys_platform == 'win32'
21+
# flash-attn @ https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.4.post1/flash_attn-2.7.4.post1+cu12torch2.6cxx11abiFALSE-cp310-cp310-linux_x86_64.whl ; sys_platform == 'linux'
22+
23+
24+
extension_bark @ git+https://github.com/rsxdalv/extension_bark@main
25+
extension_tortoise @ git+https://github.com/rsxdalv/extension_tortoise@main
26+
extension_demucs @ git+https://github.com/rsxdalv/extension_demucs@main
27+
extension_mms @ git+https://github.com/rsxdalv/extension_mms@main
28+
extension_seamless_m4t @ git+https://github.com/rsxdalv/extension_seamless_m4t@main
29+
extension_vocos @ git+https://github.com/rsxdalv/extension_vocos@main

setup.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import setuptools
2+
3+
# get requirements from requirements.txt
4+
with open("requirements.txt") as f:
5+
requirements = f.read().splitlines()
6+
7+
setuptools.setup(
8+
name="tts_webui",
9+
packages=setuptools.find_namespace_packages(),
10+
version="0.0.17",
11+
author="rsxdalv",
12+
description="TTS Generation WebUI / Harmonica",
13+
url="https://github.com/rsxdalv/tts-generation-webui",
14+
project_urls={},
15+
scripts=[],
16+
# install_requires=[
17+
# "extension_kokoro @ git+https://github.com/rsxdalv/extension_kokoro@main",
18+
# "extension_rvc @ git+https://github.com/rsxdalv/extension_rvc@main",
19+
# "openai",
20+
# ],
21+
install_requires=requirements,
22+
include_package_data=True,
23+
package_data={"": ["*.json"]},
24+
classifiers=[
25+
"Programming Language :: Python :: 3",
26+
"License :: OSI Approved :: MIT License",
27+
"Operating System :: OS Independent",
28+
],
29+
)

tts_webui/extensions_loader/decorator_extensions.py

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,16 @@
44
import time
55
from types import ModuleType
66
from typing import Literal
7+
import functools
78

89
import gradio as gr
910

1011
from tts_webui.utils.pip_install import pip_install_wrapper, pip_uninstall_wrapper
1112
from tts_webui.utils.generic_error_tab_advanced import generic_error_tab_advanced
12-
from tts_webui.extensions_loader.extensions_data_loader import get_decorator_extensions, get_decorator_extensions_by_class
13+
from tts_webui.extensions_loader.extensions_data_loader import (
14+
get_decorator_extensions,
15+
get_decorator_extensions_by_class,
16+
)
1317

1418

1519
def check_if_package_installed(package_name):
@@ -149,35 +153,34 @@ def _load(x: dict):
149153
elapsed_time = time.time() - start_time
150154
print(f" Done in {elapsed_time:.2f} seconds. ({x['name']})\n")
151155

156+
wrappers.reverse()
157+
gen_wrappers.reverse()
152158
return wrappers, gen_wrappers
153159

154160

155161
OUTER_WRAPPERS, OUTER_WRAPPERS_GEN = _load_decorators("outer")
156162
INNER_WRAPPERS, INNER_WRAPPERS_GEN = _load_decorators("inner")
157163

158164

159-
def decorator_extension_outer(fn0):
160-
return _decorator_extension(OUTER_WRAPPERS, fn0)
161-
162-
163-
def decorator_extension_inner(fn0):
164-
return _decorator_extension(INNER_WRAPPERS, fn0)
165+
def _create_decorator(wrappers_list):
166+
def decorator(fn0):
167+
for wrapper in wrappers_list:
168+
fn0 = wrapper(fn0)
165169

170+
@functools.wraps(fn0)
171+
def wrapped(*args, **kwargs):
172+
return fn0(*args, **kwargs)
166173

167-
def decorator_extension_outer_generator(fn0):
168-
return _decorator_extension(OUTER_WRAPPERS_GEN, fn0)
174+
return wrapped
169175

176+
return decorator
170177

171-
def decorator_extension_inner_generator(fn0):
172-
return _decorator_extension(INNER_WRAPPERS_GEN, fn0)
173-
174-
175-
def _decorator_extension(wrappers, fn0):
176-
wrappers.reverse()
177-
for wrapper in wrappers:
178-
fn0 = wrapper(fn0)
179-
return fn0
180178

179+
# Define the four decorators using the helper function
180+
decorator_extension_outer = _create_decorator(OUTER_WRAPPERS)
181+
decorator_extension_inner = _create_decorator(INNER_WRAPPERS)
182+
decorator_extension_outer_generator = _create_decorator(OUTER_WRAPPERS_GEN)
183+
decorator_extension_inner_generator = _create_decorator(INNER_WRAPPERS_GEN)
181184

182185
if __name__ == "__main__":
183186
pass

0 commit comments

Comments
 (0)