Skip to content

Commit

Permalink
add magnet model, stereo musicgen
Browse files Browse the repository at this point in the history
* upgrade audiocraft and include stereo models

* add magnet to gradio

* magnet for react ui
  • Loading branch information
rsxdalv authored Jan 16, 2024
1 parent c7e8678 commit 2aaf8f9
Show file tree
Hide file tree
Showing 20 changed files with 1,512 additions and 100 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ config.json
/voices-tortoise/

# Ignore model checkpoints
/data
/data/models

# Ignore temporary files
temp/
Expand Down
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,11 @@ https://rsxdalv.github.io/bark-speaker-directory/
## Info about managing models, caches and system space for AI projects
https://github.com/rsxdalv/tts-generation-webui/discussions/186#discussioncomment-7291274

## Changelo
## Changelog
Jan 16:
* Upgrade MusicGen, adding support for stereo and large melody models
* Add MAGNeT

Jan 15:
* Upgraded Gradio to 3.48.0
* Several visual bugs have appeared, if they are critical, please report them or downgrade gradio.
Expand Down
Empty file added data/models/magnet/.gitkeep
Empty file.
2 changes: 1 addition & 1 deletion react-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev",
"dev": "next dev -p 3001",
"build": "next build",
"start": "next start",
"lint": "next lint",
Expand Down
6 changes: 5 additions & 1 deletion react-ui/src/components/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,11 @@ const routes: Route[] = [
},
{
href: "/musicgen",
text: "Musicgen",
text: "MusicGen",
},
{
href: "/magnet",
text: "MAGNeT",
},
{
href: "/demucs",
Expand Down
94 changes: 89 additions & 5 deletions react-ui/src/pages/api/gradio/[name].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ async function reload_old_generation_dropdown() {
];
};

return result?.data[0].choices;
return result?.data[0].choices.map(x => x[0]);
}

async function bark_favorite({ history_bundle_name_data }) {
Expand Down Expand Up @@ -315,7 +315,7 @@ async function tortoise_refresh_models() {
];
};

return result?.data[0].choices;
return result?.data[0].choices.map(x => x[0])
}

async function tortoise_refresh_voices() {
Expand All @@ -330,7 +330,7 @@ async function tortoise_refresh_voices() {
];
};

return result?.data[0].choices;
return result?.data[0].choices.map(x => x[0])
}

async function tortoise_open_models() {
Expand Down Expand Up @@ -440,7 +440,7 @@ async function rvc_model_reload() {
];
};

return result?.data[0].choices;
return result?.data[0].choices.map(x => x[0]);
}

async function rvc_index_reload() {
Expand All @@ -455,7 +455,7 @@ async function rvc_index_reload() {
];
};

return result?.data[0].choices;
return result?.data[0].choices.map(x => x[0]);
}

// rvc_model_open
Expand Down Expand Up @@ -607,9 +607,91 @@ async function get_config_bark() {
};
}

async function magnet({
model,
text,
seed,
use_sampling,
top_k,
top_p,
temperature,
max_cfg_coef,
min_cfg_coef,
decoding_steps_1,
decoding_steps_2,
decoding_steps_3,
decoding_steps_4,
span_arrangement,
}) {
const app = await getClient();

const result = (await app.predict("/magnet", [
model,
text,
seed,
use_sampling,
top_k,
top_p,
temperature,
max_cfg_coef,
min_cfg_coef,
decoding_steps_1,
decoding_steps_2,
decoding_steps_3,
decoding_steps_4,
span_arrangement,
])) as {
data: [
GradioFile, // output
string, // history_bundle_name_data
string, // image
null, // seed_cache
Object // result_json
];
};

const [audio, history_bundle_name_data, , , json] = result?.data;
return {
audio,
history_bundle_name_data,
json,
};
}

// magnet_get_models

async function magnet_get_models() {
const app = await getClient();

const result = (await app.predict("/magnet_get_models")) as {
data: [
{
choices: string[];
__type__: "update";
}
];
};

return result?.data[0].choices.map(x => x[0]);
}

// magnet_open_model_dir

async function magnet_open_model_dir() {
const app = await getClient();

const result = (await app.predict("/magnet_open_model_dir")) as {};

return result;
}

const endpoints = {
demucs,
musicgen,
magnet,
magnet_get_models,
magnet_open_model_dir,

vocos_wav,
vocos_npz,
encodec_decode,
Expand All @@ -619,12 +701,14 @@ const endpoints = {
reload_old_generation_dropdown,
bark_favorite,
delete_generation,

tortoise,
tortoise_refresh_models,
tortoise_refresh_voices,
tortoise_open_models,
tortoise_open_voices,
tortoise_apply_model_settings,

rvc,
rvc_model_reload,
rvc_index_reload,
Expand Down
Loading

0 comments on commit 2aaf8f9

Please sign in to comment.