Notebook improvements from @xxNessuxX

pull/88/head
Mateo Cedillo 1 year ago
parent ec2abfaa0c
commit 5404e8cf73

@ -5,7 +5,6 @@
"colab": {
"provenance": [],
"gpuType": "T4",
"authorship_tag": "ABX9TyN5orawFZNYEhhbtJPe+1fd",
"include_colab_link": true
},
"kernelspec": {
@ -32,10 +31,13 @@
{
"cell_type": "markdown",
"source": [
"# [Piper](https://github.com/rhasspy/piper) training notebook\n",
"## ![Piper](https://contribute.rhasspy.org/img/logo.png)\n",
"# <font color=\"pink\"> **[Piper](https://github.com/rhasspy/piper) training notebook.**\n",
"## ![Piper logo](https://contribute.rhasspy.org/img/logo.png)\n",
"\n",
"Notebook made by [rmcpantoja](http://github.com/rmcpantoja)"
"---\n",
"\n",
"- Notebook made by [rmcpantoja](http://github.com/rmcpantoja)\n",
"- Collaborator: [Xx_Nessu_xX](https://fakeyou.com/profile/Xx_Nessu_xX)"
],
"metadata": {
"id": "eK3nmYDB6C1a"
@ -44,7 +46,7 @@
{
"cell_type": "markdown",
"source": [
"# First steps"
"# <font color=\"pink\">🔧 ***First steps.*** 🔧"
],
"metadata": {
"id": "AICh6p5OJybj"
@ -53,7 +55,7 @@
{
"cell_type": "code",
"source": [
"#@markdown ## <font color=\"pink\"> **Google Colab Anti-Disconnect.**\n",
"#@markdown ## <font color=\"pink\"> **Google Colab Anti-Disconnect.** 🔌\n",
"#@markdown ---\n",
"#@markdown #### Avoid automatic disconnection. Still, it will disconnect after <font color=\"orange\">**6 to 12 hours**</font>.\n",
"\n",
@ -77,7 +79,7 @@
{
"cell_type": "code",
"source": [
"#@markdown ## Check GPU type\n",
"#@markdown ## <font color=\"pink\"> **Check GPU type.** 👁️\n",
"#@markdown ---\n",
"#@markdown #### A higher capable GPU can lead to faster training speeds. By default, you will have a <font color=\"orange\">**Tesla T4**</font>.\n",
"!nvidia-smi"
@ -98,7 +100,7 @@
},
"outputs": [],
"source": [
"#@markdown ## mount Google Drive\n",
"#@markdown # <font color=\"pink\"> **Mount Google Drive.** 📂\n",
"from google.colab import drive\n",
"drive.mount('/content/drive', force_remount=True)"
]
@ -106,10 +108,10 @@
{
"cell_type": "code",
"source": [
"#@markdown ## Install software\n",
"#@markdown In this cell the synthesizer and its necessary dependencies to execute the training will be installed. (this may take a while)\n",
"#@markdown # <font color=\"pink\"> **Install software.** 📦\n",
"#@markdown ####In this cell the synthesizer and its necessary dependencies to execute the training will be installed. (this may take a while)\n",
"\n",
"#@markdown **Note: Please restart the runtime environment when the cell execution is finished. Then you can continue with the training section.**\n",
"#@markdown <font color=\"orange\">**Note: Please restart the runtime environment when the cell execution is finished. Then you can continue with the training section.**\n",
"\n",
"# clone:\n",
"!git clone https://github.com/rmcpantoja/piper\n",
@ -133,7 +135,7 @@
{
"cell_type": "markdown",
"source": [
"# Training"
"# <font color=\"pink\"> 🤖 ***Training.*** 🤖"
],
"metadata": {
"id": "A3bMzEE0V5Ma"
@ -142,8 +144,8 @@
{
"cell_type": "code",
"source": [
"#@markdown ## 1. Extract dataset\n",
"#@markdown <font color=\"orange\">**Important: the audios must be in wav format, (16000 or 22050hz, 16-bits, mono), and, for convenience, numbered. Example:**\n",
"#@markdown # <font color=\"pink\"> **1. Extract dataset.** 📥\n",
"#@markdown ####Important: the audios must be in <font color=\"orange\">**wav format, (16000 or 22050hz, 16-bits, mono), and, for convenience, numbered. Example:**\n",
"\n",
"#@markdown * <font color=\"orange\">**1.wav**</font>\n",
"#@markdown * <font color=\"orange\">**2.wav**</font>\n",
@ -171,14 +173,15 @@
{
"cell_type": "code",
"source": [
"#@markdown ## 2. Upload the transcript file\n",
"#@markdown Important: the transcription means writing what the character says in each of the audios, and it must have the following structure:\n",
"#@markdown # <font color=\"pink\"> **2. Upload the transcript file.** 📝\n",
"#@markdown ---\n",
"#@markdown ####Important: the transcription means writing what the character says in each of the audios, and it must have the following structure:\n",
"\n",
"#@markdown * wavs/1.wav|This is what my character says in audio 1.\n",
"#@markdown * wavs/2.wav|This, the text that the character says in audio 2.\n",
"#@markdown * ...............\n",
"#@markdown * ...\n",
"\n",
"#@markdown And so on. In addition, the transcript must be in a .csv format (UTF8 without bom)\n",
"#@markdown And so on. In addition, the transcript must be in a .csv format. (UTF-8 without BOM)\n",
"\n",
"%cd /content/dataset\n",
"from google.colab import files\n",
@ -198,7 +201,7 @@
{
"cell_type": "code",
"source": [
"#@markdown ## 3. Preprocess dataset\n",
"#@markdown # <font color=\"pink\"> **3. Preprocess dataset.** 🔄\n",
"\n",
"import os\n",
"#@markdown ### First of all, select the language of your dataset.\n",
@ -238,7 +241,7 @@
"model_name = \"Test\" #@param {type:\"string\"}\n",
"#@markdown ---\n",
"# output:\n",
"#@markdown ### Choose the working folder. (recommended to save to Drive)\n",
"#@markdown ### Choose the working folder: (recommended to save to Drive)\n",
"\n",
"#@markdown The working folder will be used in preprocessing, but also in training the model.\n",
"output_path = \"/content/drive/MyDrive/colab/piper\" #@param {type:\"string\"}\n",
@ -246,7 +249,7 @@
"if not os.path.exists(output_dir):\n",
" os.makedirs(output_dir)\n",
"#@markdown ---\n",
"#@markdown ### Choose dataset format\n",
"#@markdown ### Choose dataset format:\n",
"dataset_format = \"ljspeech\" #@param [\"ljspeech\", \"mycroft\"]\n",
"#@markdown ---\n",
"#@markdown ### Is this a single speaker dataset? Otherwise, uncheck:\n",
@ -256,7 +259,7 @@
"else:\n",
" force_sp = \"\"\n",
"#@markdown ---\n",
"#@markdown ### Select the sample rate of the dataset\n",
"#@markdown ### Select the sample rate of the dataset:\n",
"sample_rate = \"16000\" #@param [\"16000\", \"22050\"]\n",
"#@markdown ---\n",
"%cd /content/piper/src/python\n",
@ -278,7 +281,7 @@
{
"cell_type": "code",
"source": [
"#@markdown ## 4. Settings\n",
"#@markdown # <font color=\"pink\"> **4. Settings.** 🧰\n",
"import json\n",
"import ipywidgets as widgets\n",
"from IPython.display import display\n",
@ -309,10 +312,10 @@
" raise Exception(\"The pretrained_models.json file was not found.\")\n",
"else:\n",
" ft_command = \"\"\n",
"#@markdown ### Choose batch size based on this dataset\n",
"#@markdown ### Choose batch size based on this dataset:\n",
"batch_size = 16 #@param {type:\"integer\"}\n",
"#@markdown ---\n",
"#@markdown ### Validation split\n",
"#@markdown ### Validation split:\n",
"validation_split = 0.03 #@param {type:\"number\"}\n",
"#@markdown ---\n",
"#@markdown ### Choose the quality for this model:\n",
@ -326,10 +329,10 @@
"#@markdown ### For how many epochs to save training checkpoints?\n",
"checkpoint_epochs = 25 #@param {type:\"integer\"}\n",
"#@markdown ---\n",
"#@markdown ### Step interval to generate model samples\n",
"#@markdown ### Step interval to generate model samples:\n",
"log_every_n_steps = 250 #@param {type:\"integer\"}\n",
"#@markdown ---\n",
"#@markdown ### training epochs\n",
"#@markdown ### Training epochs:\n",
"max_epochs = 10000 #@param {type:\"integer\"}\n",
"#@markdown ---"
],
@ -343,9 +346,9 @@
{
"cell_type": "code",
"source": [
"#@markdown ## 5. Run the tensorboard extension\n",
"#@markdown # <font color=\"pink\"> **5. Run the TensorBoard extension.** 📈\n",
"\n",
"#@markdown The tensorboard is used to visualize the results of the model while it is being trained.\n",
"#@markdown The TensorBoard is used to visualize the results of the model while it is being trained.\n",
"%load_ext tensorboard\n",
"%tensorboard --logdir {output_dir}"
],
@ -359,9 +362,9 @@
{
"cell_type": "code",
"source": [
"#@markdown ## 6. Train\n",
"#@markdown # <font color=\"pink\"> **6. Train.** 🏋️‍♂️\n",
"\n",
"#@markdown **Note: Remember to empty the trash of your Drive from time to time to avoid a lot of space consumption when saving the models.**\n",
"#@markdown <font color=\"orange\">**Note: Remember to empty the trash of your Drive from time to time to avoid a lot of space consumption when saving the models.**\n",
"!python -m piper_train \\\n",
" --dataset-dir \"{output_dir}\" \\\n",
" --accelerator 'gpu' \\\n",
@ -371,8 +374,7 @@
" --num-test-examples 2 \\\n",
" --quality {quality} \\\n",
" --checkpoint-epochs {checkpoint_epochs} \\\n",
" --check_val_every_n_epoch 25 \\\n",
" --num_sanity_val_steps 1000 \\\n",
" --check_val_every_n_epoch {checkpoint_epochs} \\\n",
" --log_every_n_steps {log_every_n_steps} \\\n",
" --max_epochs {max_epochs} \\\n",
" {ft_command}\\\n",
@ -384,6 +386,17 @@
},
"execution_count": null,
"outputs": []
},
{
"cell_type": "markdown",
"source": [
"# Have you finished training and want to test the model?\n",
"\n",
"Export your model using the [model exporter notebook](https://colab.research.google.com/github/rmcpantoja/piper/blob/master/notebooks/piper_model_exporter.ipynb)!"
],
"metadata": {
"id": "6ISG085SYn85"
}
}
]
}
Loading…
Cancel
Save