Update basic_training_notebook.ipynb

This commit is contained in:
MasterPhooey
2025-01-02 23:10:57 -06:00
committed by GitHub
parent a5d3307d8c
commit e603d2e5fb

View File

@@ -20,27 +20,39 @@
] ]
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": null,
"metadata": { "metadata": {
"id": "BFf6511E65ff" "id": "BFf6511E65ff"
}, },
"outputs": [], "outputs": [],
"source": [ "source": [
"# Installs microWakeWord. Be sure to restart the session after this is finished.\n", "# Installs microWakeWord. Be sure to restart the session after this is finished.\n",
"import platform\n", "import platform\n",
"\n", "import sys\n",
"if platform.system() == \"Darwin\":\n", "import os\n",
" # `pymicro-features` is installed from a fork to support building on macOS\n", "\n",
" !{sys.executable} pip install 'git+https://github.com/puddly/pymicro-features@puddly/minimum-cpp-version'\n", "if platform.system() == \"Darwin\":\n",
"\n", " # `pymicro-features` is installed from a fork to support building on macOS\n",
"# `audio-metadata` is installed from a fork to unpin `attrs` from a version that breaks Jupyter\n", " !\"{sys.executable}\" -m pip install 'git+https://github.com/puddly/pymicro-features@puddly/minimum-cpp-version'\n",
"!{sys.executable} pip install 'git+https://github.com/whatsnowplaying/audio-metadata@d4ebb238e6a401bb1a5aaaac60c9e2b3cb30929f'\n", "\n",
"\n", "# `audio-metadata` is installed from a fork to unpin `attrs` from a version that breaks Jupyter\n",
"!git clone -b https://github.com/kahrendt/microWakeWord\n", "!\"{sys.executable}\" -m pip install 'git+https://github.com/whatsnowplaying/audio-metadata@d4ebb238e6a401bb1a5aaaac60c9e2b3cb30929f'\n",
"!{sys.executable} pip install -e ./microWakeWord" "\n",
] "# Clone the microWakeWord repository\n",
}, "repo_path = \"./microWakeWord\"\n",
"if not os.path.exists(repo_path):\n",
" print(\"Cloning microWakeWord repository...\")\n",
" !git clone https://github.com/kahrendt/microWakeWord.git {repo_path}\n",
"\n",
"# Ensure the repository exists before attempting to install\n",
"if os.path.exists(repo_path):\n",
" print(\"Installing microWakeWord...\")\n",
" !\"{sys.executable}\" -m pip install -e {repo_path}\n",
"else:\n",
" print(f\"Repository not found at {repo_path}. Cloning might have failed.\")"
]
},
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": null,
@@ -59,21 +71,21 @@
"\n", "\n",
"from IPython.display import Audio\n", "from IPython.display import Audio\n",
"\n", "\n",
"if not os.path.exists(\"./piper-sample-generator\"):\n", "if not os.path.exists(\"./-m piper-sample-generator\"):\n",
" if platform.system() == \"Darwin\":\n", " if platform.system() == \"Darwin\":\n",
" !git clone -b mps-support https://github.com/kahrendt/piper-sample-generator\n", " !git clone -b mps-support https://github.com/kahrendt/piper-sample-generator\n",
" else:\n", " else:\n",
" !git clone https://github.com/rhasspy/piper-sample-generator\n", " !git clone https://github.com/rhasspy/piper-sample-generator\n",
"\n", "\n",
" !wget -O piper-sample-generator/models/en_US-libritts_r-medium.pt 'https://github.com/rhasspy/piper-sample-generator/releases/download/v2.0.0/en_US-libritts_r-medium.pt'\n", " !wget -O -m piper-sample-generator/models/en_US-libritts_r-medium.pt 'https://github.com/rhasspy/-m piper-sample-generator/releases/download/v2.0.0/en_US-libritts_r-medium.pt'\n",
"\n", "\n",
" # Install system dependencies\n", " # Install system dependencies\n",
" !{sys.executable} pip install torch torchaudio piper-phonemize-cross==1.2.1\n", " !\"{sys.executable}\" -m pip install torch torchaudio -m piper-phonemize-cross==1.2.1\n",
"\n", "\n",
" if \"piper-sample-generator/\" not in sys.path:\n", " if \"-m piper-sample-generator/\" not in sys.path:\n",
" sys.path.append(\"piper-sample-generator/\")\n", " sys.path.append(\"-m piper-sample-generator/\")\n",
"\n", "\n",
"!{sys.executable} pyrhon3 piper-sample-generator/generate_samples.py \"{target_word}\" \\\n", "!\"{sys.executable}\" pyrhon3 -m piper-sample-generator/generate_samples.py \"{target_word}\" \\\n",
"--max-samples 1 \\\n", "--max-samples 1 \\\n",
"--batch-size 1 \\\n", "--batch-size 1 \\\n",
"--output-dir generated_samples\n", "--output-dir generated_samples\n",
@@ -91,12 +103,12 @@
"source": [ "source": [
"# Generates a larger amount of wake word samples.\n", "# Generates a larger amount of wake word samples.\n",
"# Start here when trying to improve your model.\n", "# Start here when trying to improve your model.\n",
"# See https://github.com/rhasspy/piper-sample-generator for the full set of\n", "# See https://github.com/rhasspy/-m piper-sample-generator for the full set of\n",
"# parameters. In particular, experiment with noise-scales and noise-scale-ws,\n", "# parameters. In particular, experiment with noise-scales and noise-scale-ws,\n",
"# generating negative samples similar to the wake word, and generating many more\n", "# generating negative samples similar to the wake word, and generating many more\n",
"# wake word samples, possibly with different phonetic pronunciations.\n", "# wake word samples, possibly with different phonetic pronunciations.\n",
"\n", "\n",
"!{sys.executable} pyrhon3 piper-sample-generator/generate_samples.py \"{target_word}\" \\\n", "!\"{sys.executable}\" pyrhon3 -m piper-sample-generator/generate_samples.py \"{target_word}\" \\\n",
"--max-samples 1000 \\\n", "--max-samples 1000 \\\n",
"--batch-size 100 \\\n", "--batch-size 100 \\\n",
"--output-dir generated_samples" "--output-dir generated_samples"