Spaces:
Runtime error
Runtime error
ZeroGPU
Browse files- demos/musicgen_app.py +6 -2
demos/musicgen_app.py
CHANGED
|
@@ -18,6 +18,7 @@ from tempfile import NamedTemporaryFile
|
|
| 18 |
import time
|
| 19 |
import typing as tp
|
| 20 |
import warnings
|
|
|
|
| 21 |
|
| 22 |
from einops import rearrange
|
| 23 |
import torch
|
|
@@ -170,6 +171,7 @@ def _do_predictions(texts, melodies, duration, progress=False, gradio_progress=N
|
|
| 170 |
return out_videos, out_wavs
|
| 171 |
|
| 172 |
|
|
|
|
| 173 |
def predict_batched(texts, melodies):
|
| 174 |
max_text_length = 512
|
| 175 |
texts = [text[:max_text_length] for text in texts]
|
|
@@ -187,6 +189,7 @@ def check(model, model_path, decoder, text, melody, duration, topk, topp, temper
|
|
| 187 |
raise gr.Error("Topp must not be negative.")
|
| 188 |
|
| 189 |
|
|
|
|
| 190 |
def predict_full(model, model_path, decoder, text, melody, duration, topk, topp, temperature, cfg_coef, output_hint, progress=gr.Progress()):
|
| 191 |
global INTERRUPTING
|
| 192 |
global USE_DIFFUSION
|
|
@@ -267,8 +270,9 @@ def ui_full(launch_kwargs):
|
|
| 267 |
The generated tracks tend to be very monotone so I advise you to add an original track to force the AI to make variations.
|
| 268 |
<br/>
|
| 269 |
<br/>
|
| 270 |
-
π Slow process... ~6 hours for 2 minutes of music.
|
| 271 |
-
|
|
|
|
| 272 |
<a href="https://huggingface.co/spaces/Fabrice-TIERCELIN/Text-to-Music?duplicate=true"><img src="https://img.shields.io/badge/-Duplicate%20Space-blue?labelColor=white&style=flat&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAP5JREFUOE+lk7FqAkEURY+ltunEgFXS2sZGIbXfEPdLlnxJyDdYB62sbbUKpLbVNhyYFzbrrA74YJlh9r079973psed0cvUD4A+4HoCjsA85X0Dfn/RBLBgBDxnQPfAEJgBY+A9gALA4tcbamSzS4xq4FOQAJgCDwV2CPKV8tZAJcAjMMkUe1vX+U+SMhfAJEHasQIWmXNN3abzDwHUrgcRGmYcgKe0bxrblHEB4E/pndMazNpSZGcsZdBlYJcEL9Afo75molJyM2FxmPgmgPqlWNLGfwZGG6UiyEvLzHYDmoPkDDiNm9JR9uboiONcBXrpY1qmgs21x1QwyZcpvxt9NS09PlsPAAAAAElFTkSuQmCC&logoWidth=14"></a>
|
| 273 |
<br/>
|
| 274 |
βοΈ If you use the standard models, you can use, modify and share the generated musics but not for commercial uses.
|
|
|
|
| 18 |
import time
|
| 19 |
import typing as tp
|
| 20 |
import warnings
|
| 21 |
+
import spaces
|
| 22 |
|
| 23 |
from einops import rearrange
|
| 24 |
import torch
|
|
|
|
| 171 |
return out_videos, out_wavs
|
| 172 |
|
| 173 |
|
| 174 |
+
@spaces.GPU(duration=420)
|
| 175 |
def predict_batched(texts, melodies):
|
| 176 |
max_text_length = 512
|
| 177 |
texts = [text[:max_text_length] for text in texts]
|
|
|
|
| 189 |
raise gr.Error("Topp must not be negative.")
|
| 190 |
|
| 191 |
|
| 192 |
+
@spaces.GPU(duration=420)
|
| 193 |
def predict_full(model, model_path, decoder, text, melody, duration, topk, topp, temperature, cfg_coef, output_hint, progress=gr.Progress()):
|
| 194 |
global INTERRUPTING
|
| 195 |
global USE_DIFFUSION
|
|
|
|
| 270 |
The generated tracks tend to be very monotone so I advise you to add an original track to force the AI to make variations.
|
| 271 |
<br/>
|
| 272 |
<br/>
|
| 273 |
+
""" + ("πββοΈ Estimated time: few minutes." if torch.cuda.is_available() else "π Slow process... ~6 hours for 2 minutes of music.") + """
|
| 274 |
+
Your computer must <b><u>not</u></b> enter into standby mode.
|
| 275 |
+
You can duplicate this space on a free account, it's designed to work on CPU, GPU and ZeroGPU.
|
| 276 |
<a href="https://huggingface.co/spaces/Fabrice-TIERCELIN/Text-to-Music?duplicate=true"><img src="https://img.shields.io/badge/-Duplicate%20Space-blue?labelColor=white&style=flat&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAP5JREFUOE+lk7FqAkEURY+ltunEgFXS2sZGIbXfEPdLlnxJyDdYB62sbbUKpLbVNhyYFzbrrA74YJlh9r079973psed0cvUD4A+4HoCjsA85X0Dfn/RBLBgBDxnQPfAEJgBY+A9gALA4tcbamSzS4xq4FOQAJgCDwV2CPKV8tZAJcAjMMkUe1vX+U+SMhfAJEHasQIWmXNN3abzDwHUrgcRGmYcgKe0bxrblHEB4E/pndMazNpSZGcsZdBlYJcEL9Afo75molJyM2FxmPgmgPqlWNLGfwZGG6UiyEvLzHYDmoPkDDiNm9JR9uboiONcBXrpY1qmgs21x1QwyZcpvxt9NS09PlsPAAAAAElFTkSuQmCC&logoWidth=14"></a>
|
| 277 |
<br/>
|
| 278 |
βοΈ If you use the standard models, you can use, modify and share the generated musics but not for commercial uses.
|