|
195 | 195 | "source": [ |
196 | 196 | "%pip install comet_ml\n", |
197 | 197 | "import comet_ml\n", |
198 | | - "comet_ml.init(project_name=\"6.s191lab1.2\")\n", |
| 198 | + "comet_ml.init(project_name=\"6.s191lab1_part2\")\n", |
199 | 199 | "comet_experiment = comet_ml.Experiment()\n", |
200 | 200 | "\n", |
201 | 201 | "# Import Tensorflow 2.0\n", |
|
219 | 219 | "\n", |
220 | 220 | "# Check that we are using a GPU, if not switch runtimes\n", |
221 | 221 | "# using Runtime > Change Runtime Type > GPU\n", |
222 | | - "assert len(tf.config.list_physical_devices('GPU')) > 0" |
| 222 | + "assert len(tf.config.list_physical_devices('GPU')) > 0\n", |
| 223 | + "\n", |
| 224 | + "from scipy.io.wavfile import write" |
223 | 225 | ] |
224 | 226 | }, |
225 | 227 | { |
|
1099 | 1101 | " model.save_weights(checkpoint_prefix)\n", |
1100 | 1102 | " \n", |
1101 | 1103 | "# Save the trained model and the weights\n", |
1102 | | - "model.save_weights(checkpoint_prefix)\n", |
1103 | | - "comet_experiment.end()\n" |
| 1104 | + "model.save_weights(checkpoint_prefix)\n" |
1104 | 1105 | ] |
1105 | 1106 | }, |
1106 | 1107 | { |
|
1275 | 1276 | " # If its a valid song (correct syntax), lets play it! \n", |
1276 | 1277 | " if waveform:\n", |
1277 | 1278 | " print(\"Generated song\", i)\n", |
1278 | | - " ipythondisplay.display(waveform)" |
| 1279 | + " ipythondisplay.display(waveform)\n", |
| 1280 | + "\n", |
| 1281 | + " numeric_data = np.frombuffer(waveform.data, dtype=np.int16)\n", |
| 1282 | + " wav_file_path = f\"output_{i}.wav\"\n", |
| 1283 | + " write(wav_file_path, 88200, numeric_data)\n", |
| 1284 | + " comet_experiment.log_asset(wav_file_path)\n", |
| 1285 | + " \n", |
| 1286 | + "comet_experiment.end()" |
1279 | 1287 | ] |
1280 | 1288 | }, |
1281 | 1289 | { |
|
0 commit comments