Update basic_training_notebook.ipynb

This commit is contained in:
MasterPhooey
2025-01-03 08:07:24 -06:00
committed by GitHub
parent 8a10e4f8f7
commit 2e80414de7

View File

@@ -510,8 +510,10 @@
"# On Google colab, it doesn't print the mini-batch results, so it may appear\n", "# On Google colab, it doesn't print the mini-batch results, so it may appear\n",
"# stuck for several minutes! Additionally, it is very slow compared to training\n", "# stuck for several minutes! Additionally, it is very slow compared to training\n",
"# on a local GPU.\n", "# on a local GPU.\n",
"import os\n",
"os.environ['LD_LIBRARY_PATH'] = \"/usr/lib/x86_64-linux-gnu:\" + os.environ.get('LD_LIBRARY_PATH', '')\n",
"\n", "\n",
"!python -m microwakeword.model_train_eval \\\n", "!\"{sys.executable}\" -m microwakeword.model_train_eval \\\n",
"--training_config='training_parameters.yaml' \\\n", "--training_config='training_parameters.yaml' \\\n",
"--train 1 \\\n", "--train 1 \\\n",
"--restore_checkpoint 1 \\\n", "--restore_checkpoint 1 \\\n",
@@ -539,20 +541,21 @@
}, },
"outputs": [], "outputs": [],
"source": [ "source": [
"# Downloads the tflite model file. To use on the device, you need to write a\n", "import shutil\n",
"# Model JSON file. See https://esphome.io/components/micro_wake_word for the\n", "from IPython.display import FileLink\n",
"# documentation and\n",
"# https://github.com/esphome/micro-wake-word-models/tree/main/models/v2 for\n",
"# examples. Adjust the probability threshold based on the test results obtained\n",
"# after training is finished. You may also need to increase the Tensor arena\n",
"# model size if the model fails to load.\n",
"\n", "\n",
"from google.colab import files\n", "# Define the source path and desired download location\n",
"source_path = \"trained_models/wakeword/tflite_stream_state_internal_quant/stream_state_internal_quant.tflite\"\n",
"destination_path = \"./stream_state_internal_quant.tflite\"\n",
"\n", "\n",
"files.download(f\"trained_models/wakeword/tflite_stream_state_internal_quant/stream_state_internal_quant.tflite\")" "# Copy the file to the current working directory\n",
"shutil.copy(source_path, destination_path)\n",
"\n",
"# Generate a link to download the file\n",
"print(\"Download your file:\")\n",
"FileLink(destination_path)"
] ]
} },
],
"metadata": { "metadata": {
"accelerator": "GPU", "accelerator": "GPU",
"colab": { "colab": {