Spaces:
Running
Running
update demos
Browse files- app.py +16 -2
- app_batched.py +14 -3
- hf_loading.py +1 -4
app.py
CHANGED
@@ -66,6 +66,16 @@ with gr.Blocks() as demo:
|
|
66 |
1. Melody -- a music generation model capable of generating music condition on text and melody inputs. **Note**, you can also use text only.
|
67 |
2. Small -- a 300M transformer decoder conditioned on text only.
|
68 |
3. Medium -- a 1.5B transformer decoder conditioned on text only.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
69 |
|
70 |
See [github.com/facebookresearch/audiocraft](https://github.com/facebookresearch/audiocraft)
|
71 |
for more details.
|
@@ -79,7 +89,7 @@ with gr.Blocks() as demo:
|
|
79 |
with gr.Row():
|
80 |
submit = gr.Button("Submit")
|
81 |
with gr.Row():
|
82 |
-
model = gr.Radio(["melody", "medium", "small"], label="Model", value="melody", interactive=True)
|
83 |
with gr.Row():
|
84 |
duration = gr.Slider(minimum=1, maximum=30, value=10, label="Duration", interactive=True)
|
85 |
with gr.Row():
|
@@ -107,7 +117,11 @@ with gr.Blocks() as demo:
|
|
107 |
"a light and cheerly EDM track, with syncopated drums, aery pads, and strong emotions",
|
108 |
"./assets/bach.mp3",
|
109 |
"melody"
|
110 |
-
]
|
|
|
|
|
|
|
|
|
111 |
],
|
112 |
inputs=[text, melody, model],
|
113 |
outputs=[output]
|
|
|
66 |
1. Melody -- a music generation model capable of generating music condition on text and melody inputs. **Note**, you can also use text only.
|
67 |
2. Small -- a 300M transformer decoder conditioned on text only.
|
68 |
3. Medium -- a 1.5B transformer decoder conditioned on text only.
|
69 |
+
4. Large -- a 3.3B transformer decoder conditioned on text only (might OOM for the longest sequences.)
|
70 |
+
|
71 |
+
When the optional melody conditioning wav is provided, the model will extract
|
72 |
+
a broad melody and try to follow it in the generated samples.
|
73 |
+
|
74 |
+
For skipping queue, you can duplicate this space, and upgrade to GPU in the settings.
|
75 |
+
<br/>
|
76 |
+
<a href="https://huggingface.co/spaces/musicgen/MusicGen?duplicate=true">
|
77 |
+
<img style="margin-top: 0em; margin-bottom: 0em" src="https://bit.ly/3gLdBN6" alt="Duplicate Space"></a>
|
78 |
+
</p>
|
79 |
|
80 |
See [github.com/facebookresearch/audiocraft](https://github.com/facebookresearch/audiocraft)
|
81 |
for more details.
|
|
|
89 |
with gr.Row():
|
90 |
submit = gr.Button("Submit")
|
91 |
with gr.Row():
|
92 |
+
model = gr.Radio(["melody", "medium", "small", "large"], label="Model", value="melody", interactive=True)
|
93 |
with gr.Row():
|
94 |
duration = gr.Slider(minimum=1, maximum=30, value=10, label="Duration", interactive=True)
|
95 |
with gr.Row():
|
|
|
117 |
"a light and cheerly EDM track, with syncopated drums, aery pads, and strong emotions",
|
118 |
"./assets/bach.mp3",
|
119 |
"melody"
|
120 |
+
],
|
121 |
+
[
|
122 |
+
"lofi slow bpm electro chill with organic samples",
|
123 |
+
"medium",
|
124 |
+
],
|
125 |
],
|
126 |
inputs=[text, melody, model],
|
127 |
outputs=[output]
|
app_batched.py
CHANGED
@@ -71,8 +71,15 @@ with gr.Blocks() as demo:
|
|
71 |
presented at: "Simple and Controllable Music Generation".
|
72 |
|
73 |
Enter the description of the music you want and an optional audio used for melody conditioning.
|
74 |
-
|
75 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
76 |
|
77 |
See [github.com/facebookresearch/audiocraft](https://github.com/facebookresearch/audiocraft)
|
78 |
for more details.
|
@@ -100,9 +107,13 @@ with gr.Blocks() as demo:
|
|
100 |
None,
|
101 |
],
|
102 |
[
|
103 |
-
"a light and cheerly EDM track, with syncopated drums, aery pads, and strong emotions",
|
104 |
"./assets/bach.mp3",
|
105 |
]
|
|
|
|
|
|
|
|
|
106 |
],
|
107 |
inputs=[text, melody],
|
108 |
outputs=[output]
|
|
|
71 |
presented at: "Simple and Controllable Music Generation".
|
72 |
|
73 |
Enter the description of the music you want and an optional audio used for melody conditioning.
|
74 |
+
The model will extract the broad melody from the uploaded wav if provided.
|
75 |
+
This will generate a 12s extract with the `melody` model.
|
76 |
+
|
77 |
+
For generating longer sequences (up to 30 seconds) and skipping queue, you can duplicate
|
78 |
+
to full demo space, which contains more control and upgrade to GPU in the settings.
|
79 |
+
<br/>
|
80 |
+
<a href="https://huggingface.co/spaces/musicgen/MusicGen?duplicate=true">
|
81 |
+
<img style="margin-top: 0em; margin-bottom: 0em" src="https://bit.ly/3gLdBN6" alt="Duplicate Space"></a>
|
82 |
+
</p>
|
83 |
|
84 |
See [github.com/facebookresearch/audiocraft](https://github.com/facebookresearch/audiocraft)
|
85 |
for more details.
|
|
|
107 |
None,
|
108 |
],
|
109 |
[
|
110 |
+
"a light and cheerly EDM track, with syncopated drums, aery pads, and strong emotions bpm: 130",
|
111 |
"./assets/bach.mp3",
|
112 |
]
|
113 |
+
[
|
114 |
+
"lofi slow bpm electro chill with organic samples",
|
115 |
+
None,
|
116 |
+
],
|
117 |
],
|
118 |
inputs=[text, melody],
|
119 |
outputs=[output]
|
hf_loading.py
CHANGED
@@ -1,10 +1,9 @@
|
|
1 |
"""Utility for loading the models from HF."""
|
2 |
-
import os
|
3 |
from pathlib import Path
|
4 |
import typing as tp
|
5 |
|
6 |
from omegaconf import OmegaConf
|
7 |
-
from huggingface_hub import hf_hub_download
|
8 |
import torch
|
9 |
|
10 |
from audiocraft.models import builders, MusicGen
|
@@ -16,8 +15,6 @@ MODEL_CHECKPOINTS_MAP = {
|
|
16 |
"melody": "facebook/musicgen-melody",
|
17 |
}
|
18 |
|
19 |
-
login(os.environ['ACCESS_TOKEN'])
|
20 |
-
|
21 |
|
22 |
def _get_state_dict(file_or_url: tp.Union[Path, str],
|
23 |
filename="state_dict.bin", device='cpu'):
|
|
|
1 |
"""Utility for loading the models from HF."""
|
|
|
2 |
from pathlib import Path
|
3 |
import typing as tp
|
4 |
|
5 |
from omegaconf import OmegaConf
|
6 |
+
from huggingface_hub import hf_hub_download
|
7 |
import torch
|
8 |
|
9 |
from audiocraft.models import builders, MusicGen
|
|
|
15 |
"melody": "facebook/musicgen-melody",
|
16 |
}
|
17 |
|
|
|
|
|
18 |
|
19 |
def _get_state_dict(file_or_url: tp.Union[Path, str],
|
20 |
filename="state_dict.bin", device='cpu'):
|