Skip to content

Commit

Permalink
Created using Colaboratory
Browse files Browse the repository at this point in the history
  • Loading branch information
adriancbo committed Dec 7, 2023
1 parent dcf8537 commit a6acaa0
Showing 1 changed file with 105 additions and 0 deletions.
105 changes: 105 additions & 0 deletions MusicGen_Demo.ipynb
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": []
}
]
}

0 comments on commit a6acaa0

Please sign in to comment.