|
113 | 113 | "import torch\n",
|
114 | 114 | "import typing as tp\n",
|
115 | 115 | "\n",
|
| 116 | + "# Fetch `notebook_utils` module\n", |
| 117 | + "import requests\n", |
| 118 | + "from pathlib import Path\n", |
| 119 | + "\n", |
| 120 | + "if not Path(\"notebook_utils.py\").exists():\n", |
| 121 | + " r = requests.get(\n", |
| 122 | + " url=\"https://raw.githubusercontent.com/openvinotoolkit/openvino_notebooks/latest/utils/notebook_utils.py\",\n", |
| 123 | + " )\n", |
| 124 | + "\n", |
| 125 | + " open(\"notebook_utils.py\", \"w\").write(r.text)\n", |
| 126 | + "\n", |
| 127 | + "\n", |
| 128 | + "# Read more about telemetry collection at https://github.com/openvinotoolkit/openvino_notebooks?tab=readme-ov-file#-telemetry\n", |
| 129 | + "from notebook_utils import collect_telemetry\n", |
| 130 | + "\n", |
| 131 | + "collect_telemetry(\"encodec-audio-compression.ipynb\")\n", |
| 132 | + "\n", |
116 | 133 | "model_id = \"encodec_24khz\"\n",
|
117 | 134 | "# Instantiate a pretrained EnCodec model\n",
|
118 | 135 | "model = MODELS[model_id]()\n",
|
|
179 | 196 | "import librosa.display\n",
|
180 | 197 | "import IPython.display as ipd\n",
|
181 | 198 | "\n",
|
182 |
| - "# Fetch `notebook_utils` module\n", |
183 |
| - "import requests\n", |
184 |
| - "from pathlib import Path\n", |
185 |
| - "\n", |
186 |
| - "if not Path(\"notebook_utils.py\").exists():\n", |
187 |
| - " r = requests.get(\n", |
188 |
| - " url=\"https://raw.githubusercontent.com/openvinotoolkit/openvino_notebooks/latest/utils/notebook_utils.py\",\n", |
189 |
| - " )\n", |
190 |
| - "\n", |
191 |
| - " open(\"notebook_utils.py\", \"w\").write(r.text)\n", |
192 | 199 | "from notebook_utils import download_file, device_widget\n",
|
193 | 200 | "\n",
|
194 | 201 | "test_data_url = \"https://github.com/facebookresearch/encodec/raw/main/test_24k.wav\"\n",
|
|
200 | 207 | "plt.figure(figsize=(14, 5))\n",
|
201 | 208 | "librosa.display.waveshow(audio, sr=sr)\n",
|
202 | 209 | "\n",
|
203 |
| - "ipd.Audio(sample_file)\n", |
204 |
| - "\n", |
205 |
| - "# Read more about telemetry collection at https://github.com/openvinotoolkit/openvino_notebooks?tab=readme-ov-file#-telemetry\n", |
206 |
| - "from notebook_utils import collect_telemetry\n", |
207 |
| - "\n", |
208 |
| - "collect_telemetry(\"encodec-audio-compression.ipynb\")" |
| 210 | + "ipd.Audio(sample_file)" |
209 | 211 | ]
|
210 | 212 | },
|
211 | 213 | {
|
|
0 commit comments