diff --git a/basic_training_notebook.ipynb b/basic_training_notebook.ipynb index 89769c8..5fa1935 100644 --- a/basic_training_notebook.ipynb +++ b/basic_training_notebook.ipynb @@ -60,39 +60,49 @@ "id": "dEluu7nL7ywd" }, "outputs": [], - "source": [ - "# Generates 1 sample of the target word for manual verification.\n", - "\n", - "target_word = 'khum_puter' # Phonetic spellings may produce better samples\n", - "\n", - "import os\n", - "import sys\n", - "import platform\n", - "\n", - "from IPython.display import Audio\n", - "\n", - "if not os.path.exists(\"./-m piper-sample-generator\"):\n", - " if platform.system() == \"Darwin\":\n", - " !git clone -b mps-support https://github.com/kahrendt/piper-sample-generator\n", - " else:\n", - " !git clone https://github.com/rhasspy/piper-sample-generator\n", - "\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", - " # Install system dependencies\n", - " !\"{sys.executable}\" -m pip install torch torchaudio -m piper-phonemize-cross==1.2.1\n", - "\n", - " if \"-m piper-sample-generator/\" not in sys.path:\n", - " sys.path.append(\"-m piper-sample-generator/\")\n", - "\n", - "!\"{sys.executable}\" pyrhon3 -m piper-sample-generator/generate_samples.py \"{target_word}\" \\\n", - "--max-samples 1 \\\n", - "--batch-size 1 \\\n", - "--output-dir generated_samples\n", - "\n", - "Audio(\"generated_samples/0.wav\", autoplay=True)" - ] - }, + "source": [ + "# Generates 1 sample of the target word for manual verification.\n", + "\n", + "target_word = 'khum_puter' # Phonetic spellings may produce better samples\n", + "\n", + "import os\n", + "import sys\n", + "import platform\n", + "\n", + "from IPython.display import Audio\n", + "\n", + "# Ensure the repository is cloned correctly\n", + "if not os.path.exists(\"./piper-sample-generator\"):\n", + " if platform.system() == \"Darwin\":\n", + " !git clone -b mps-support https://github.com/kahrendt/piper-sample-generator\n", + " else:\n", + " !git clone https://github.com/rhasspy/piper-sample-generator\n", + "\n", + "# Download the required model\n", + "if not os.path.exists(\"piper-sample-generator/models/en_US-libritts_r-medium.pt\"):\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", + "\n", + "# Install system dependencies\n", + "!\"{sys.executable}\" -m pip install torch torchaudio piper-phonemize-cross==1.2.1\n", + "\n", + "# Ensure the repository path is in sys.path\n", + "if \"piper-sample-generator/\" not in sys.path:\n", + " sys.path.append(\"piper-sample-generator/\")\n", + "\n", + "# Generate sample\n", + "!\"{sys.executable}\" piper-sample-generator/generate_samples.py \"{target_word}\" \\\n", + "--max-samples 1 \\\n", + "--batch-size 1 \\\n", + "--output-dir generated_samples\n", + "\n", + "# Play the generated audio sample\n", + "audio_path = \"generated_samples/0.wav\"\n", + "if os.path.exists(audio_path):\n", + " display(Audio(audio_path, autoplay=True))\n", + "else:\n", + " print(f\"Audio file not found at {audio_path}\")" + ] + }, { "cell_type": "code", "execution_count": null, @@ -108,7 +118,7 @@ "# generating negative samples similar to the wake word, and generating many more\n", "# wake word samples, possibly with different phonetic pronunciations.\n", "\n", - "!\"{sys.executable}\" pyrhon3 -m piper-sample-generator/generate_samples.py \"{target_word}\" \\\n", + "!\"{sys.executable}\" -m piper-sample-generator/generate_samples.py \"{target_word}\" \\\n", "--max-samples 1000 \\\n", "--batch-size 100 \\\n", "--output-dir generated_samples"