From 6405bd1758cf8d985d0bb53b20f6f32f5783ab35 Mon Sep 17 00:00:00 2001 From: Josh Meyer Date: Wed, 15 Sep 2021 09:08:12 -0400 Subject: [PATCH] Add CI tests for notebooks --- ci_scripts/notebook-tests.sh | 14 ++++++++++++++ notebooks/train_with_common_voice.ipynb | 19 ++++++++++--------- 2 files changed, 24 insertions(+), 9 deletions(-) create mode 100755 ci_scripts/notebook-tests.sh diff --git a/ci_scripts/notebook-tests.sh b/ci_scripts/notebook-tests.sh new file mode 100755 index 00000000..3872b14c --- /dev/null +++ b/ci_scripts/notebook-tests.sh @@ -0,0 +1,14 @@ +#!/bin/bash +set -xe + +source $(dirname "$0")/all-vars.sh +source $(dirname "$0")/all-utils.sh + +set -o pipefail +pip install --upgrade pip setuptools wheel | cat +pip install --upgrade . | cat +set +o pipefail + +for python_notebook in ./notebooks/*.ipynb; do + time jupyter nbconvert --to notebook --execute $python_notebook +done diff --git a/notebooks/train_with_common_voice.ipynb b/notebooks/train_with_common_voice.ipynb index 7bb845b7..b492f4f2 100644 --- a/notebooks/train_with_common_voice.ipynb +++ b/notebooks/train_with_common_voice.ipynb @@ -99,11 +99,11 @@ "from coqui_stt_training.util.downloader import maybe_download\n", "\n", "def download_preformatted_data():\n", - " if not os.path.exists(\"sr-data\"):\n", - " maybe_download(\"sr-data.tar\", \".\", \"https://coqui-ai-public-data.s3.amazonaws.com/cv/7.0/sr-data.tar\")\n", + " if not os.path.exists(\"serbian/sr-data\"):\n", + " maybe_download(\"sr-data.tar\", \"serbian/\", \"https://coqui-ai-public-data.s3.amazonaws.com/cv/7.0/sr-data.tar\")\n", " print('\\nExtracting data...')\n", - " tar = tarfile.open(\"sr-data.tar\", mode=\"r:\")\n", - " tar.extractall(\".\")\n", + " tar = tarfile.open(\"serbian/sr-data.tar\", mode=\"r:\")\n", + " tar.extractall(\"serbian/\")\n", " tar.close()\n", " print('\\nFinished extracting data...')\n", " else:\n", @@ -129,8 +129,8 @@ "id": "fa2aec77" }, "source": [ - "! ls sr-data\n", - "! wc -l sr-data/*.csv" + "! ls serbian/sr-data\n", + "! wc -l serbian/sr-data/*.csv" ], "id": "fa2aec77", "execution_count": null, @@ -161,9 +161,10 @@ "from coqui_stt_training.util.config import initialize_globals_from_args\n", "\n", "initialize_globals_from_args(\n", - " train_files=[\"sr-data/train.csv\"],\n", - " dev_files=[\"sr-data/dev.csv\"],\n", - " test_files=[\"sr-data/test.csv\"],\n", + " train_files=[\"serbian/sr-data/train.csv\"],\n", + " dev_files=[\"serbian/sr-data/dev.csv\"],\n", + " test_files=[\"serbian/sr-data/test.csv\"],\n", + " checkpoint_dir=\"serbian/checkpoints/\",\n", " load_train=\"init\",\n", " n_hidden=200,\n", " epochs=1,\n",