Update basic_training_notebook.ipynb

This commit is contained in:
MasterPhooey
2025-01-03 08:37:42 -06:00
committed by GitHub
parent 131ab0d315
commit d396899e05

View File

@@ -542,18 +542,47 @@
"outputs": [],
"source": [
"import shutil\n",
"import json\n",
"from IPython.display import FileLink\n",
"\n",
"# Define the source path and desired download location\n",
"# Define the source path and desired download location for the TFLite file\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",
"# Copy the file to the current working directory\n",
"# Copy the TFLite 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)"
"# Define the JSON file content\n",
"json_data = {\n",
" \"type\": \"micro\",\n",
" \"wake_word\": \"khum_puter\", # Adjust this if the target_word changes dynamically\n",
" \"author\": \"master phooey\",\n",
" \"website\": \"https://github.com/MasterPhooey/MicroWakeWord-Trainer-Docker\",\n",
" \"model\": \"stream_state_internal_quant.tflite\",\n",
" \"trained_languages\": [\"en\"],\n",
" \"version\": 2,\n",
" \"micro\": {\n",
" \"probability_cutoff\": 0.97,\n",
" \"sliding_window_size\": 5,\n",
" \"feature_step_size\": 10,\n",
" \"tensor_arena_size\": 30000,\n",
" \"minimum_esphome_version\": \"2024.7.0\"\n",
" }\n",
"}\n",
"\n",
"# Define the JSON file path\n",
"json_path = \"./stream_state_internal_quant.json\"\n",
"\n",
"# Write the JSON file\n",
"with open(json_path, \"w\") as json_file:\n",
" json.dump(json_data, json_file, indent=2)\n",
"\n",
"# Generate download links for both files\n",
"print(\"Download your files:\")\n",
"print(\"TFLite Model:\")\n",
"display(FileLink(destination_path))\n",
"print(\"\\nJSON Metadata:\")\n",
"display(FileLink(json_path))"
]
}
],