Last active
May 29, 2025 11:43
-
-
Save hathibelagal-dev/9aca4ecc759282756d894cf67f281d16 to your computer and use it in GitHub Desktop.
ChatterBox.ipynb
This file contains hidden or 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
{ | |
"nbformat": 4, | |
"nbformat_minor": 0, | |
"metadata": { | |
"colab": { | |
"provenance": [], | |
"gpuType": "T4", | |
"authorship_tag": "ABX9TyPboaFJDtVsDzpj2JXYak5N", | |
"include_colab_link": true | |
}, | |
"kernelspec": { | |
"name": "python3", | |
"display_name": "Python 3" | |
}, | |
"language_info": { | |
"name": "python" | |
}, | |
"accelerator": "GPU" | |
}, | |
"cells": [ | |
{ | |
"cell_type": "markdown", | |
"metadata": { | |
"id": "view-in-github", | |
"colab_type": "text" | |
}, | |
"source": [ | |
"<a href=\"https://colab.research.google.com/gist/hathibelagal-dev/9aca4ecc759282756d894cf67f281d16/chatterbox.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"source": [ | |
"!pip install chatterbox-tts" | |
], | |
"metadata": { | |
"id": "sVKIh-JWvtiz" | |
}, | |
"execution_count": null, | |
"outputs": [] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": null, | |
"metadata": { | |
"id": "AcJX1QYwvHta" | |
}, | |
"outputs": [], | |
"source": [ | |
"import torchaudio as ta\n", | |
"from chatterbox.tts import ChatterboxTTS\n", | |
"\n", | |
"model = ChatterboxTTS.from_pretrained(device=\"cuda\")" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"source": [ | |
"prompt = \"\"\"\n", | |
"His plan’s mostly channeled through SpaceX, his rocket company. Space is hard, y’know?\n", | |
"\"\"\"" | |
], | |
"metadata": { | |
"id": "To13tESSvJFv" | |
}, | |
"execution_count": null, | |
"outputs": [] | |
}, | |
{ | |
"cell_type": "code", | |
"source": [ | |
"wav = model.generate(\n", | |
" prompt,\n", | |
" exaggeration=0.6,\n", | |
")\n", | |
"ta.save(\"output.wav\", wav, model.sr)" | |
], | |
"metadata": { | |
"id": "0Cwl4FSyvgGb" | |
}, | |
"execution_count": null, | |
"outputs": [] | |
}, | |
{ | |
"cell_type": "code", | |
"source": [ | |
"from IPython.display import display, Audio\n", | |
"display(Audio(\"output.wav\"))" | |
], | |
"metadata": { | |
"id": "Gk_UjQHNxTMz" | |
}, | |
"execution_count": null, | |
"outputs": [] | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment