forked from phuocng/1loc
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
105 additions
and
0 deletions.
There are no files selected for viewing
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,105 @@ | ||
{ | ||
"nbformat": 4, | ||
"nbformat_minor": 0, | ||
"metadata": { | ||
"colab": { | ||
"provenance": [], | ||
"gpuType": "T4" | ||
}, | ||
"kernelspec": { | ||
"name": "python3", | ||
"display_name": "Python 3" | ||
}, | ||
"language_info": { | ||
"name": "python" | ||
}, | ||
"accelerator": "GPU" | ||
}, | ||
"cells": [ | ||
{ | ||
"cell_type": "code", | ||
"source": [ | ||
"!python3 -m pip install -U git+https://github.com/facebookresearch/audiocraft#egg=audiocraft\n", | ||
"# !python3 -m pip install -U audiocraft" | ||
], | ||
"metadata": { | ||
"id": "ku0ui5lKwpF7" | ||
}, | ||
"execution_count": null, | ||
"outputs": [] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"source": [ | ||
"from audiocraft.models import musicgen\n", | ||
"from audiocraft.utils.notebook import display_audio\n", | ||
"import torch" | ||
], | ||
"metadata": { | ||
"id": "YVgeUMjoZaJH" | ||
}, | ||
"execution_count": null, | ||
"outputs": [] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"source": [ | ||
"model = musicgen.MusicGen.get_pretrained('medium', device='cuda')\n", | ||
"model.set_generation_params(duration=8)" | ||
], | ||
"metadata": { | ||
"id": "yc_FYhbWZufi" | ||
}, | ||
"execution_count": null, | ||
"outputs": [] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"source": [ | ||
"res = model.generate([\n", | ||
" 'crazy EDM, heavy bang',\n", | ||
" 'classic reggae track with an electronic guitar solo',\n", | ||
" 'lofi slow bpm electro chill with organic samples',\n", | ||
" 'rock with saturated guitars, a heavy bass line and crazy drum break and fills.',\n", | ||
" 'earthy tones, environmentally conscious, ukulele-infused, harmonic, breezy, easygoing, organic instrumentation, gentle grooves',\n", | ||
"],\n", | ||
" progress=True)\n", | ||
"display_audio(res, 32000)" | ||
], | ||
"metadata": { | ||
"id": "32g-tH7IZz5N" | ||
}, | ||
"execution_count": null, | ||
"outputs": [] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"source": [ | ||
"See our repo https://github.com/facebookresearch/audiocraft for more details on how to use this model!\n", | ||
"\n", | ||
"See also [MusicGen Gradio Demo](https://colab.research.google.com/drive/1-Xe9NCdIs2sCUbiSmwHXozK6AAhMm7_i?usp=sharing) for a Colab using the Gradio app instead!\n" | ||
], | ||
"metadata": { | ||
"id": "yP3FfELNw6_k" | ||
} | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"source": [], | ||
"metadata": { | ||
"id": "LMEhDDBWo-BS" | ||
}, | ||
"execution_count": null, | ||
"outputs": [] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"source": [], | ||
"metadata": { | ||
"id": "rojR90c5xFMY" | ||
}, | ||
"execution_count": null, | ||
"outputs": [] | ||
} | ||
] | ||
} |