-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
example: add musicgen example (#2899)
- Loading branch information
1 parent
ce807f3
commit 3d271c4
Showing
12 changed files
with
142 additions
and
50 deletions.
There are no files selected for viewing
Empty file.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
Text To Music | ||
====== | ||
|
||
Examples for text-to-music offline batch evaluations and online demo. | ||
|
||
Models | ||
------ | ||
|
||
- [musicGen](https://musicgen.com/): a powerful single Language Model (LM) redefining the boundaries of conditional music generation, with the ability to create high-quality music by taking cues from text descriptions or melodies. | ||
|
||
Datasets | ||
------ | ||
|
||
MusicGen samples from <https://ai.honu.io/papers/musicgen/> website. | ||
|
||
What we learn from these examples? | ||
------ | ||
|
||
- Build Starwhale Model for the text-to-music models. | ||
- Log audio artifact in the evaluation phase. | ||
- Write evaluation results summary by Starwhale Report. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
Datasets for text-to-music | ||
====== | ||
|
||
MusicGen mini | ||
------ | ||
|
||
Run command to build dataset: | ||
|
||
```bash | ||
python musicgen-mini.py | ||
``` | ||
|
||
Run swcli command to show built dataset: | ||
|
||
```bash | ||
swcli dataset info musicgen-mini | ||
``` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
MusicGen Example Guides | ||
====== | ||
|
||
[MusicGen](https://ai.honu.io/papers/musicgen/) a single Language Model (LM) that operates over several streams of compressed discrete music representation. | ||
|
||
- 🏔️ Homepage: ️<https://ai.honu.io/papers/musicgen/> | ||
- 🌋 Github: <https://github.com/facebookresearch/audiocraft>️ | ||
- 🏕️ Size: small(300M), melody(1.5B), medium(1.5B), large(3.3B) | ||
|
||
Login Starwhale Cloud | ||
------ | ||
|
||
```bash | ||
swcli instance login --token "${TOKEN}" --alias cloud-cn https://cloud.starwhale.cn/ | ||
``` | ||
|
||
Build Starwhale Runtime | ||
------ | ||
|
||
```bash | ||
swcli -vvv runtime build | ||
swcli runtime cp musicgen https://cloud.starwhale.cn/project/starwhale:llm_text_to_audio | ||
``` | ||
|
||
Build Starwhale Model | ||
------ | ||
|
||
Model name choices: `melody`, `medium`, `small` and `large`. | ||
|
||
```bash | ||
python3 build.py ${model_name} | ||
|
||
swcli runtime activate musicgen | ||
python3 build.py small | ||
swcli model cp musicgen-small https://cloud.starwhale.cn/project/starwhale:llm_text_to_audio | ||
``` | ||
|
||
Run Starwhale Model | ||
------ | ||
|
||
```bash | ||
# use model src dir | ||
swcli model run --workdir . --runtime musicgen --dataset musicgen-mini -m evaluation | ||
|
||
# use model package | ||
swcli model run --uri musicgen-small --runtime musicgen --dataset musicgen-mini | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
torch==2.0.1 | ||
transformers==4.31.0 | ||
huggingface-hub # download hf models | ||
audiocraft==1.0.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
name: musicgen | ||
mode: venv | ||
environment: | ||
arch: noarch | ||
os: ubuntu:20.04 | ||
cuda: 11.7 | ||
python: 3.9 | ||
starwhale_version: 0.6.1 # Starwhale >= 0.6.0 supports log artifacts in the evaluation phase. | ||
dependencies: | ||
- requirements.txt |
File renamed without changes.