Spaces:
Running
on
T4
Running
on
T4
Install updates
Browse files- MANIFEST.in +3 -0
- README.md +1 -1
- app.py +15 -16
- pre-requirements.txt +1 -1
- requirements.txt +1 -2
- setup.py +3 -3
MANIFEST.in
CHANGED
@@ -8,3 +8,6 @@ include audiocraft/py.typed
|
|
8 |
include assets/*.mp3
|
9 |
include assets/*.ico
|
10 |
include assets/*.png
|
|
|
|
|
|
|
|
8 |
include assets/*.mp3
|
9 |
include assets/*.ico
|
10 |
include assets/*.png
|
11 |
+
include assets/*.ttf
|
12 |
+
include assets/*.svg
|
13 |
+
include assets/*.gif
|
README.md
CHANGED
@@ -5,7 +5,7 @@ colorFrom: gray
|
|
5 |
colorTo: red
|
6 |
sdk: gradio
|
7 |
sdk_version: 5.23.3
|
8 |
-
python_version: 3.
|
9 |
app_file: app.py
|
10 |
pinned: true
|
11 |
license: creativeml-openrail-m
|
|
|
5 |
colorTo: red
|
6 |
sdk: gradio
|
7 |
sdk_version: 5.23.3
|
8 |
+
python_version: 3.10.13
|
9 |
app_file: app.py
|
10 |
pinned: true
|
11 |
license: creativeml-openrail-m
|
app.py
CHANGED
@@ -43,10 +43,10 @@ MAX_PROMPT_INDEX = 0
|
|
43 |
git = os.environ.get('GIT', "git")
|
44 |
#s.environ["CUDA_LAUNCH_BLOCKING"] = "1"
|
45 |
os.environ["PYTORCH_CUDA_ALLOC_CONF"] = "max_split_size_mb:128,expandable_segments:True"
|
46 |
-
os.environ['TF_ENABLE_ONEDNN_OPTS'] = '0'
|
47 |
-
os.environ['CUDA_MODULE_LOADING']='LAZY'
|
48 |
-
os.environ['USE_FLASH_ATTENTION'] = '1'
|
49 |
-
os.environ['XFORMERS_FORCE_DISABLE_TRITON']= '1'
|
50 |
|
51 |
def interrupt_callback():
|
52 |
return INTERRUPTED
|
@@ -137,7 +137,7 @@ def load_melody_filepath(melody_filepath, title):
|
|
137 |
#$Union[str, os.PathLike]
|
138 |
symbols = ['_', '.', '-']
|
139 |
if (melody_filepath is None) or (melody_filepath == ""):
|
140 |
-
return title, gr.update(maximum=0, value=0) , gr.update(value="melody-large", interactive=True)
|
141 |
|
142 |
if (title is None) or ("MusicGen" in title) or (title == ""):
|
143 |
melody_name, melody_extension = get_filename_from_filepath(melody_filepath)
|
@@ -157,7 +157,7 @@ def load_melody_filepath(melody_filepath, title):
|
|
157 |
print(f"Melody length: {len(melody_data)}, Melody segments: {total_melodys}\n")
|
158 |
MAX_PROMPT_INDEX = total_melodys
|
159 |
|
160 |
-
return gr.update(value=melody_name), gr.update(maximum=MAX_PROMPT_INDEX, value=0), gr.update(value="melody", interactive=True)
|
161 |
|
162 |
def predict(model, text, melody_filepath, duration, dimension, topk, topp, temperature, cfg_coef, background, title, settings_font, settings_font_color, seed, overlap=1, prompt_index = 0, include_title = True, include_settings = True, harmony_only = False):
|
163 |
global MODEL, INTERRUPTED, INTERRUPTING, MOVE_TO_CPU
|
@@ -244,7 +244,7 @@ def predict(model, text, melody_filepath, duration, dimension, topk, topp, tempe
|
|
244 |
descriptions=[text],
|
245 |
melody_wavs=melody,
|
246 |
melody_sample_rate=sr,
|
247 |
-
progress=
|
248 |
)
|
249 |
# All output_segments are populated, so we can break the loop or set duration to 0
|
250 |
break
|
@@ -410,9 +410,9 @@ def predict(model, text, melody_filepath, duration, dimension, topk, topp, tempe
|
|
410 |
torch.cuda.ipc_collect()
|
411 |
return waveform_video_path, file.name, seed
|
412 |
|
413 |
-
gr.set_static_paths(paths=["fonts/","assets/"])
|
414 |
def ui(**kwargs):
|
415 |
-
with gr.Blocks(title="UnlimitedMusicGen",css_paths="style_20250331.css", theme='Surn/beeuty') as
|
416 |
with gr.Tab("UnlimitedMusicGen"):
|
417 |
gr.Markdown(
|
418 |
"""
|
@@ -441,7 +441,7 @@ def ui(**kwargs):
|
|
441 |
text = gr.Text(label="Describe your music", interactive=True, value="4/4 100bpm 320kbps 48khz, Industrial/Electronic Soundtrack, Dark, Intense, Sci-Fi")
|
442 |
with gr.Column():
|
443 |
duration = gr.Slider(minimum=1, maximum=720, value=10, label="Duration (s)", interactive=True)
|
444 |
-
model = gr.Radio(["melody", "medium", "small", "large", "melody-large", "stereo-small", "stereo-medium", "stereo-large", "stereo-melody", "stereo-melody-large"], label="AI Model", value="
|
445 |
with gr.Row():
|
446 |
submit = gr.Button("Generate", elem_id="btn-generate")
|
447 |
# Adapted from https://github.com/rkfg/audiocraft/blob/long/app.py, MIT license.
|
@@ -482,22 +482,21 @@ def ui(**kwargs):
|
|
482 |
seed_used = gr.Number(label='Seed used', value=-1, interactive=False)
|
483 |
|
484 |
radio.change(toggle_audio_src, radio, [melody_filepath], queue=False, show_progress=False)
|
485 |
-
melody_filepath.
|
486 |
reuse_seed.click(fn=lambda x: x, inputs=[seed_used], outputs=[seed], queue=False, api_name="reuse_seed")
|
487 |
submit.click(predict, inputs=[model, text,melody_filepath, duration, dimension, topk, topp, temperature, cfg_coef, background, title, settings_font, settings_font_color, seed, overlap, prompt_index, include_title, include_settings, harmony_only], outputs=[output, wave_file, seed_used], api_name="submit")
|
488 |
gr.Examples(
|
489 |
-
fn=predict,
|
490 |
examples=[
|
491 |
[
|
492 |
"4/4 120bpm 320kbps 48khz, An 80s driving pop song with heavy drums and synth pads in the background",
|
493 |
"./assets/bach.mp3",
|
494 |
-
"
|
495 |
"80s Pop Synth"
|
496 |
],
|
497 |
[
|
498 |
"4/4 120bpm 320kbps 48khz, A cheerful country song with acoustic guitars",
|
499 |
"./assets/bolero_ravel.mp3",
|
500 |
-
"melody",
|
501 |
"Country Guitar"
|
502 |
],
|
503 |
[
|
@@ -542,7 +541,7 @@ def ui(**kwargs):
|
|
542 |
|
543 |
|
544 |
|
545 |
-
|
546 |
|
547 |
if __name__ == "__main__":
|
548 |
parser = argparse.ArgumentParser()
|
@@ -596,7 +595,7 @@ if __name__ == "__main__":
|
|
596 |
launch_kwargs['inbrowser'] = args.inbrowser
|
597 |
if args.share:
|
598 |
launch_kwargs['share'] = args.share
|
599 |
-
launch_kwargs['favicon_path']= "./assets/favicon.ico"
|
600 |
|
601 |
|
602 |
UNLOAD_MODEL = args.unload_model
|
|
|
43 |
git = os.environ.get('GIT', "git")
|
44 |
#s.environ["CUDA_LAUNCH_BLOCKING"] = "1"
|
45 |
os.environ["PYTORCH_CUDA_ALLOC_CONF"] = "max_split_size_mb:128,expandable_segments:True"
|
46 |
+
# os.environ['TF_ENABLE_ONEDNN_OPTS'] = '0'
|
47 |
+
# os.environ['CUDA_MODULE_LOADING']='LAZY'
|
48 |
+
# os.environ['USE_FLASH_ATTENTION'] = '1'
|
49 |
+
# os.environ['XFORMERS_FORCE_DISABLE_TRITON']= '1'
|
50 |
|
51 |
def interrupt_callback():
|
52 |
return INTERRUPTED
|
|
|
137 |
#$Union[str, os.PathLike]
|
138 |
symbols = ['_', '.', '-']
|
139 |
if (melody_filepath is None) or (melody_filepath == ""):
|
140 |
+
return title, gr.update(maximum=0, value=0) , gr.update(value="melody-large", interactive=True)
|
141 |
|
142 |
if (title is None) or ("MusicGen" in title) or (title == ""):
|
143 |
melody_name, melody_extension = get_filename_from_filepath(melody_filepath)
|
|
|
157 |
print(f"Melody length: {len(melody_data)}, Melody segments: {total_melodys}\n")
|
158 |
MAX_PROMPT_INDEX = total_melodys
|
159 |
|
160 |
+
return gr.update(value=melody_name), gr.update(maximum=MAX_PROMPT_INDEX, value=0), gr.update(value="melody-large", interactive=True)
|
161 |
|
162 |
def predict(model, text, melody_filepath, duration, dimension, topk, topp, temperature, cfg_coef, background, title, settings_font, settings_font_color, seed, overlap=1, prompt_index = 0, include_title = True, include_settings = True, harmony_only = False):
|
163 |
global MODEL, INTERRUPTED, INTERRUPTING, MOVE_TO_CPU
|
|
|
244 |
descriptions=[text],
|
245 |
melody_wavs=melody,
|
246 |
melody_sample_rate=sr,
|
247 |
+
progress=False
|
248 |
)
|
249 |
# All output_segments are populated, so we can break the loop or set duration to 0
|
250 |
break
|
|
|
410 |
torch.cuda.ipc_collect()
|
411 |
return waveform_video_path, file.name, seed
|
412 |
|
413 |
+
gr.set_static_paths(paths=["fonts/","assets/","images/"])
|
414 |
def ui(**kwargs):
|
415 |
+
with gr.Blocks(title="UnlimitedMusicGen",css_paths="style_20250331.css", theme='Surn/beeuty') as demo:
|
416 |
with gr.Tab("UnlimitedMusicGen"):
|
417 |
gr.Markdown(
|
418 |
"""
|
|
|
441 |
text = gr.Text(label="Describe your music", interactive=True, value="4/4 100bpm 320kbps 48khz, Industrial/Electronic Soundtrack, Dark, Intense, Sci-Fi")
|
442 |
with gr.Column():
|
443 |
duration = gr.Slider(minimum=1, maximum=720, value=10, label="Duration (s)", interactive=True)
|
444 |
+
model = gr.Radio(["melody", "medium", "small", "large", "melody-large", "stereo-small", "stereo-medium", "stereo-large", "stereo-melody", "stereo-melody-large"], label="AI Model", value="medium", interactive=True)
|
445 |
with gr.Row():
|
446 |
submit = gr.Button("Generate", elem_id="btn-generate")
|
447 |
# Adapted from https://github.com/rkfg/audiocraft/blob/long/app.py, MIT license.
|
|
|
482 |
seed_used = gr.Number(label='Seed used', value=-1, interactive=False)
|
483 |
|
484 |
radio.change(toggle_audio_src, radio, [melody_filepath], queue=False, show_progress=False)
|
485 |
+
melody_filepath.input(load_melody_filepath, inputs=[melody_filepath, title], outputs=[title, prompt_index , model], api_name="melody_filepath_input", queue=False)
|
486 |
reuse_seed.click(fn=lambda x: x, inputs=[seed_used], outputs=[seed], queue=False, api_name="reuse_seed")
|
487 |
submit.click(predict, inputs=[model, text,melody_filepath, duration, dimension, topk, topp, temperature, cfg_coef, background, title, settings_font, settings_font_color, seed, overlap, prompt_index, include_title, include_settings, harmony_only], outputs=[output, wave_file, seed_used], api_name="submit")
|
488 |
gr.Examples(
|
|
|
489 |
examples=[
|
490 |
[
|
491 |
"4/4 120bpm 320kbps 48khz, An 80s driving pop song with heavy drums and synth pads in the background",
|
492 |
"./assets/bach.mp3",
|
493 |
+
"melody",
|
494 |
"80s Pop Synth"
|
495 |
],
|
496 |
[
|
497 |
"4/4 120bpm 320kbps 48khz, A cheerful country song with acoustic guitars",
|
498 |
"./assets/bolero_ravel.mp3",
|
499 |
+
"stereo-melody-large",
|
500 |
"Country Guitar"
|
501 |
],
|
502 |
[
|
|
|
541 |
|
542 |
|
543 |
|
544 |
+
demo.queue(max_size=10, api_open=False).launch(**launch_kwargs)
|
545 |
|
546 |
if __name__ == "__main__":
|
547 |
parser = argparse.ArgumentParser()
|
|
|
595 |
launch_kwargs['inbrowser'] = args.inbrowser
|
596 |
if args.share:
|
597 |
launch_kwargs['share'] = args.share
|
598 |
+
launch_kwargs['favicon_path']= "./assets/favicon.ico"
|
599 |
|
600 |
|
601 |
UNLOAD_MODEL = args.unload_model
|
pre-requirements.txt
CHANGED
@@ -1 +1 @@
|
|
1 |
-
pip>=
|
|
|
1 |
+
pip>=25.0.1
|
requirements.txt
CHANGED
@@ -12,9 +12,8 @@ tqdm
|
|
12 |
transformers>=4.48.0 # need Encodec there.
|
13 |
xformers>=0.0.23 --index-url https://download.pytorch.org/whl/cu124
|
14 |
demucs
|
15 |
-
librosa
|
16 |
soundfile
|
17 |
-
gradio==5.23.3
|
18 |
gradio[oauth]
|
19 |
pillow
|
20 |
torchmetrics
|
|
|
12 |
transformers>=4.48.0 # need Encodec there.
|
13 |
xformers>=0.0.23 --index-url https://download.pytorch.org/whl/cu124
|
14 |
demucs
|
15 |
+
librosa==0.11.0
|
16 |
soundfile
|
|
|
17 |
gradio[oauth]
|
18 |
pillow
|
19 |
torchmetrics
|
setup.py
CHANGED
@@ -13,11 +13,11 @@ from setuptools import setup, find_packages
|
|
13 |
|
14 |
|
15 |
NAME = 'audiocraft'
|
16 |
-
DESCRIPTION = 'Audio research library for PyTorch'
|
17 |
|
18 |
-
URL = 'https://github.com/
|
19 |
AUTHOR = 'FAIR Speech & Audio'
|
20 |
-
EMAIL = '[email protected]'
|
21 |
REQUIRES_PYTHON = '>=3.8.0'
|
22 |
|
23 |
for line in open('audiocraft/__init__.py'):
|
|
|
13 |
|
14 |
|
15 |
NAME = 'audiocraft'
|
16 |
+
DESCRIPTION = 'Audio generation research library for PyTorch'
|
17 |
|
18 |
+
URL = 'https://github.com/facebookresearch/audiocraft'
|
19 |
AUTHOR = 'FAIR Speech & Audio'
|
20 |
+
EMAIL = '[email protected], [email protected]'
|
21 |
REQUIRES_PYTHON = '>=3.8.0'
|
22 |
|
23 |
for line in open('audiocraft/__init__.py'):
|