144 lines
4.1 KiB
Plaintext
144 lines
4.1 KiB
Plaintext
|
{
|
||
|
"cells": [
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"id": "9b6a0c92",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"### Only do the below if you are using docker"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": null,
|
||
|
"id": "270aa2cc",
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"# install OS deps\n",
|
||
|
"!sudo apt-get update && sudo apt-get install -y \\\n",
|
||
|
" git-core \\\n",
|
||
|
" ffmpeg \\\n",
|
||
|
" espeak-ng"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": null,
|
||
|
"id": "8ba5f452",
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"# Update and setup Conda voicecraft environment\n",
|
||
|
"!conda update -y -n base -c conda-forge conda\n",
|
||
|
"!conda create -y -n voicecraft python=3.9.16 && \\\n",
|
||
|
" conda init bash"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": null,
|
||
|
"id": "4ef2935c",
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"# install conda and pip stuff in the activated conda above context\n",
|
||
|
"!echo -e \"Grab a cup a coffee and a slice of pizza...\\n\\n\"\n",
|
||
|
"\n",
|
||
|
"# make sure $HOME and $USER are setup so this will source the conda environment\n",
|
||
|
"!source ~/.bashrc && \\\n",
|
||
|
" conda activate voicecraft && \\\n",
|
||
|
" conda install -y -c conda-forge montreal-forced-aligner=2.2.17 openfst=1.8.2 kaldi=5.5.1068 && \\\n",
|
||
|
" pip install torch==2.0.1 && \\\n",
|
||
|
" pip install tensorboard==2.16.2 && \\\n",
|
||
|
" pip install phonemizer==3.2.1 && \\\n",
|
||
|
" pip install torchaudio==2.0.2 && \\\n",
|
||
|
" pip install datasets==2.16.0 && \\\n",
|
||
|
" pip install torchmetrics==0.11.1\n",
|
||
|
"\n",
|
||
|
"# do this one last otherwise you'll get an error about torch compiler missing due to xformer mismatch\n",
|
||
|
"!source ~/.bashrc && \\\n",
|
||
|
" conda activate voicecraft && \\\n",
|
||
|
" pip install -e git+https://github.com/facebookresearch/audiocraft.git@c5157b5bf14bf83449c17ea1eeb66c19fb4bc7f0#egg=audiocraft"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": null,
|
||
|
"id": "2fca57eb",
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"# okay setup the conda environment such that jupyter notebook can find the kernel\n",
|
||
|
"!source ~/.bashrc && \\\n",
|
||
|
" conda activate voicecraft && \\\n",
|
||
|
" conda install -y -n voicecraft ipykernel --update-deps --force-reinstall\n",
|
||
|
"\n",
|
||
|
"# installs the Jupyter kernel into /home/myusername/.local/share/jupyter/kernels/voicecraft\n",
|
||
|
"!source ~/.bashrc && \\\n",
|
||
|
" conda activate voicecraft && \\\n",
|
||
|
" python3 -m ipykernel install --user --name=voicecraft"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": null,
|
||
|
"id": "961faa43",
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"!source ~/.bashrc && \\\n",
|
||
|
" conda activate voicecraft && \\\n",
|
||
|
" pip install -r gradio_requirements.txt"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"id": "8b9c4436",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"# STOP\n",
|
||
|
"You have to do this part manually using the mouse/keyboard and the tabs at the top.\n",
|
||
|
"\n",
|
||
|
"* Refresh your browser to make sure it picks up the new kernel.\n",
|
||
|
"* Kernel -> Change Kernel -> Select Kernel -> voicecraft\n",
|
||
|
"* Kernel -> Restart Kernel -> Yes\n",
|
||
|
"\n",
|
||
|
"Now you can run the rest of the notebook and get an audio sample output. It will automatically download more models and such. The next time you use this container, you can just start below here as the dependencies will remain available until you delete the docker container."
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": null,
|
||
|
"id": "f089aa96",
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"from gradio_app import app\n",
|
||
|
"app.launch()"
|
||
|
]
|
||
|
}
|
||
|
],
|
||
|
"metadata": {
|
||
|
"kernelspec": {
|
||
|
"display_name": "voicecraft",
|
||
|
"language": "python",
|
||
|
"name": "voicecraft"
|
||
|
},
|
||
|
"language_info": {
|
||
|
"codemirror_mode": {
|
||
|
"name": "ipython",
|
||
|
"version": 3
|
||
|
},
|
||
|
"file_extension": ".py",
|
||
|
"mimetype": "text/x-python",
|
||
|
"name": "python",
|
||
|
"nbconvert_exporter": "python",
|
||
|
"pygments_lexer": "ipython3",
|
||
|
"version": "3.9.19"
|
||
|
}
|
||
|
},
|
||
|
"nbformat": 4,
|
||
|
"nbformat_minor": 5
|
||
|
}
|