diff --git a/advanced_training_notebook.ipynb b/advanced_training_notebook.ipynb index 5093211..5a6a418 100644 --- a/advanced_training_notebook.ipynb +++ b/advanced_training_notebook.ipynb @@ -10,7 +10,6 @@ " \"MicroWakeWord\n", "

MicroWakeWord Trainer Docker

\n", "\n", - "**This notebook requires 24G of Vram.**\n", "\n", "This notebook steps you through training a robust microWakeWord model. It is intended as a **starting point** for users looking to create a high-performance wake word detection model. This notebook is optimized for Python 3.10.\n", "\n", @@ -641,7 +640,7 @@ "config[\"clip_duration_ms\"] = 2000 # Increased\n", "\n", "config[\"target_minimization\"] = 0.9\n", - "config[\"minimization_metric\"] = None # Updated\n", + "config[\"minimization_metric\"] = \"false_positive_rate\" # Updated\n", "config[\"maximization_metric\"] = \"average_viable_recall\"\n", "\n", "with open(os.path.join(\"training_parameters.yaml\"), \"w\") as file:\n", @@ -676,20 +675,20 @@ "--training_config='training_parameters.yaml' \\\n", "--train 1 \\\n", "--restore_checkpoint 1 \\\n", - "--test_tf_nonstreaming 1 \\\n", - "--test_tflite_nonstreaming 1 \\\n", - "--test_tflite_nonstreaming_quantized 1 \\\n", - "--test_tflite_streaming 1 \\\n", + "--test_tf_nonstreaming 0 \\\n", + "--test_tflite_nonstreaming 0 \\\n", + "--test_tflite_nonstreaming_quantized 0 \\\n", + "--test_tflite_streaming 0 \\\n", "--test_tflite_streaming_quantized 1 \\\n", "--use_weights \"best_weights\" \\\n", "mixednet \\\n", - "--pointwise_filters \"64,96,128,160\" \\\n", - "--repeat_in_block \"2,2,3,3\" \\\n", - "--mixconv_kernel_sizes '[5], [7,11], [9,15], [17,23]' \\\n", - "--residual_connection \"1,1,1,0\" \\\n", - "--first_conv_filters 48 \\\n", - "--first_conv_kernel_size 7 \\\n", - "--stride 2 \n" + "--pointwise_filters \"64,64,64,64\" \\\n", + "--repeat_in_block \"1,1,1,1\" \\\n", + "--mixconv_kernel_sizes '[5], [7,11], [9,15], [23]' \\\n", + "--residual_connection \"0,0,0,0\" \\\n", + "--first_conv_filters 32 \\\n", + "--first_conv_kernel_size 5 \\\n", + "--stride 2\n" ] }, { @@ -702,7 +701,9 @@ "source": [ "import shutil\n", "import json\n", - "from IPython.display import FileLink, HTML\n", + "from http.server import HTTPServer, SimpleHTTPRequestHandler\n", + "import threading\n", + "from pathlib import Path\n", "\n", "# Copy the TFLite model file to the working directory\n", "source_path = \"trained_models/wakeword/tflite_stream_state_internal_quant/stream_state_internal_quant.tflite\"\n", @@ -712,7 +713,7 @@ "# Define the JSON metadata for the model\n", "json_data = {\n", " \"type\": \"micro\",\n", - " \"wake_word\": \"hey_norman\", # Adjust based on your target wake word\n", + " \"wake_word\": \"khum_puter\", # Adjust based on your target wake word\n", " \"author\": \"master phooey\",\n", " \"website\": \"https://github.com/MasterPhooey/MicroWakeWord-Trainer-Docker\",\n", " \"model\": \"stream_state_internal_quant.tflite\",\n", @@ -732,19 +733,37 @@ "with open(json_path, \"w\") as json_file:\n", " json.dump(json_data, json_file, indent=2)\n", "\n", - "# Generate download links with styled HTML\n", - "tflite_link = FileLink(destination_path)\n", - "json_link = FileLink(json_path)\n", + "# Custom HTTPRequestHandler to set the Content-Disposition header\n", + "class CustomHTTPRequestHandler(SimpleHTTPRequestHandler):\n", + " def end_headers(self):\n", + " if self.path.endswith(\".json\"):\n", + " self.send_header(\"Content-Disposition\", \"attachment\")\n", + " super().end_headers()\n", "\n", + "# Start an HTTP server in a separate thread\n", + "def start_server():\n", + " server = HTTPServer((\"0.0.0.0\", 8000), CustomHTTPRequestHandler)\n", + " print(\"Serving files on http://localhost:8000\")\n", + " server.serve_forever()\n", + "\n", + "thread = threading.Thread(target=start_server, daemon=True)\n", + "thread.start()\n", + "\n", + "# Generate download links with styled HTML\n", "html_content = f\"\"\"\n", + "
,\n", + "\\\"MicroWakeWord\\n\"\n", + "

MicroWakeWord Trainer Docker

\n", + "
\\n\n", "

Your files are ready for download:

\n", "\n", "

Click the links to download the files. Ensure the files are moved to the correct directory for deployment.

\n", "\"\"\"\n", "\n", + "from IPython.display import HTML\n", "display(HTML(html_content))" ] }