Skip to content

Commit c1b4414

Browse files
authored
feat: experimental deepspeed on windows (#419)
* add experimental deepspeed wheel for win * add japanese and italian for bark voice * fix stable audio layout * create React UI proxy base * update README
1 parent 136e6e2 commit c1b4414

File tree

5 files changed

+45
-44
lines changed

5 files changed

+45
-44
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,10 @@
7474

7575
## Changelog
7676

77+
Nov 14:
78+
* Add experimental Windows deepspeed wheel.
79+
* Add more languages to Bark voice clone.
80+
7781
Nov 11:
7882
* Switch to a fixed fairseq version for windows reducing installation conflicts and speeding up updates.
7983

react-ui/src/pages/api/gradio/[name].tsx

Lines changed: 37 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,12 @@ import { Client } from "@gradio/client";
22
import type { NextApiRequest, NextApiResponse } from "next";
33
import { getFile } from "../../../backend-utils/getFile";
44
import { GradioFile } from "../../../types/GradioFile";
5-
import { PayloadMessage, PredictFunction } from "@gradio/client/dist/types";
5+
import {
6+
GradioEvent,
7+
PayloadMessage,
8+
PredictFunction,
9+
SubmitIterable,
10+
} from "@gradio/client/dist/types";
611

712
type Data = { data: any };
813

@@ -53,11 +58,40 @@ const extractChoicesTuple = ({ choices }: GradioChoices) =>
5358
const getChoices = (result: { data: GradioChoices[] }) =>
5459
extractChoices(result?.data[0]);
5560

61+
const proxyGradioFile = (data: any) =>
62+
// typeof data === "object" && data.__type__ === "file"
63+
// // ? new GradioFile(data.url, data.name)
64+
// : data;
65+
data
66+
67+
const proxyGradioFiles = (data: any[]) =>
68+
Array.isArray(data)
69+
? data.map(proxyGradioFile)
70+
: // : typeof data === "object"
71+
// ? Object.fromEntries(
72+
// Object.entries(data).map(([key, value]) => [
73+
// key,
74+
// proxyGradioFiles(value),
75+
// ])
76+
// )
77+
data;
78+
5679
const gradioPredict = <T extends any[]>(...args: Parameters<PredictFunction>) =>
57-
getClient().then((app) => app.predict(...args)) as Promise<{ data: T }>;
80+
// getClient().then((app) => app.predict(...args)) as Promise<{ data: T }>;
81+
getClient()
82+
.then((app) => app.predict(...args) as Promise<{ data: T }>)
83+
.then((result: { data: T }) => ({
84+
...result,
85+
data: proxyGradioFiles(result?.data) as T,
86+
}));
5887

5988
const gradioSubmit = <T extends any[]>(...args: Parameters<PredictFunction>) =>
60-
getClient().then((app) => app.submit(...args));
89+
getClient().then(
90+
(app) =>
91+
app.submit(...args) as SubmitIterable<
92+
({ data: T } & PayloadMessage) | GradioEvent
93+
>
94+
);
6195

6296
async function musicgen({ melody, model, ...params }) {
6397
const melodyBlob = await getFile(melody);
@@ -155,11 +189,6 @@ async function bark({
155189
};
156190
}
157191

158-
const reload_old_generation_dropdown = () =>
159-
gradioPredict<[GradioChoices]>("/reload_old_generation_dropdown").then(
160-
getChoices
161-
);
162-
163192
const bark_favorite = async ({ folder_root }) =>
164193
gradioPredict<[Object]>("/bark_favorite", [folder_root]).then(
165194
(result) => result?.data
@@ -237,15 +266,6 @@ async function tortoise({
237266
return results.slice(0, -1);
238267
}
239268

240-
const tortoise_refresh_models = () =>
241-
gradioPredict<[GradioChoices]>("/tortoise_refresh_models").then(getChoices);
242-
243-
const tortoise_refresh_voices = () =>
244-
gradioPredict<[GradioChoices]>("/tortoise_refresh_voices").then(getChoices);
245-
246-
const tortoise_open_models = () => gradioPredict<[]>("/tortoise_open_models");
247-
const tortoise_open_voices = () => gradioPredict<[]>("/tortoise_open_voices");
248-
249269
async function tortoise_apply_model_settings({
250270
model, // string (Option from: ['Default']) in 'parameter_2488' Dropdown component
251271
kv_cache, // boolean in 'parameter_2493' Checkbox component
@@ -308,32 +328,6 @@ async function rvc({
308328
const delete_generation = ({ folder_root }) =>
309329
gradioPredict<[]>("/delete_generation", [folder_root]);
310330

311-
const save_to_voices = ({ history_npz }) =>
312-
gradioPredict<[Object]>("/save_to_voices", [history_npz]);
313-
314-
const save_config_bark = ({
315-
text_use_gpu,
316-
text_use_small,
317-
coarse_use_gpu,
318-
coarse_use_small,
319-
fine_use_gpu,
320-
fine_use_small,
321-
codec_use_gpu,
322-
load_models_on_startup,
323-
}) =>
324-
gradioPredict<[string]>("/save_config_bark", [
325-
text_use_gpu, // boolean in 'Use GPU' Checkbox component
326-
text_use_small, // boolean in 'Use small model' Checkbox component
327-
coarse_use_gpu, // boolean in 'Use GPU' Checkbox component
328-
coarse_use_small, // boolean in 'Use small model' Checkbox component
329-
fine_use_gpu, // boolean in 'Use GPU' Checkbox component
330-
fine_use_small, // boolean in 'Use small model' Checkbox component
331-
codec_use_gpu, // boolean in 'Use GPU for codec' Checkbox component
332-
load_models_on_startup, // boolean in 'Load Bark models on startup' Checkbox component
333-
]).then((result) => result?.data[0]);
334-
335-
// get_config_bark
336-
337331
async function get_config_bark() {
338332
const result = await gradioPredict<
339333
[

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,4 @@ beartype>=0.16.1 # workaround for a bug
1111
# no longer required directly # transformers==4.36.1 # cross-compatibility
1212
iso639-lang==2.2.3
1313
pillow==10.3.0 # for gradio, conda fix
14+
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

tts_webui/bark/clone/tab_voice_clone.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,8 @@ def tab_voice_clone():
184184
"es_tokenizer.pth @ Lancer1408/bark-es-tokenizer",
185185
"portuguese-HuBERT-quantizer_24_epoch.pth @ MadVoyager/bark-voice-cloning-portuguese-HuBERT-quantizer",
186186
"turkish_model_epoch_14.pth @ egeadam/bark-voice-cloning-turkish-HuBERT-quantizer",
187+
"japanese-HuBERT-quantizer_24_epoch.pth @ junwchina/bark-voice-cloning-japanese-HuBERT-quantizer",
188+
"it_tokenizer.pth @ gpwr/bark-it-tokenizer",
187189
],
188190
value="quantifier_hubert_base_ls960_14.pth @ GitMylo/bark-voice-cloning",
189191
allow_custom_value=True,

tts_webui/stable_audio/stable_audio_tab.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ def model_select_ui():
222222
outputs=[model_select],
223223
api_name="stable_audio_refresh_models",
224224
)
225-
load_model_button = gr.Button(value="Load model")
225+
load_model_button = gr.Button(value="Load model")
226226

227227
with gr.Column():
228228
gr.Markdown(

0 commit comments

Comments
 (0)