Skip to content

Commit 61edcc0

Browse files
Shorna AlamShorna Alam
Shorna Alam
authored and
Shorna Alam
committed
name changes, audio logging for lab1part2
1 parent 1ed7a57 commit 61edcc0

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

lab1/Part2_Music_Generation.ipynb

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@
7171
"source": [
7272
"%pip install comet_ml\n",
7373
"import comet_ml\n",
74-
"comet_ml.init(project_name=\"6.s191lab1.2\")\n",
74+
"comet_ml.init(project_name=\"6.s191lab1_part2\")\n",
7575
"comet_experiment = comet_ml.Experiment()\n",
7676
"\n",
7777
"# Import Tensorflow 2.0\n",
@@ -93,7 +93,9 @@
9393
"\n",
9494
"# Check that we are using a GPU, if not switch runtimes\n",
9595
"# using Runtime > Change Runtime Type > GPU\n",
96-
"assert len(tf.config.list_physical_devices('GPU')) > 0"
96+
"assert len(tf.config.list_physical_devices('GPU')) > 0\n",
97+
"\n",
98+
"from scipy.io.wavfile import write"
9799
]
98100
},
99101
{
@@ -735,8 +737,7 @@
735737
" model.save_weights(checkpoint_prefix)\n",
736738
" \n",
737739
"# Save the trained model and the weights\n",
738-
"model.save_weights(checkpoint_prefix)\n",
739-
"comet_experiment.end()\n"
740+
"model.save_weights(checkpoint_prefix)\n"
740741
]
741742
},
742743
{
@@ -906,7 +907,14 @@
906907
" # If its a valid song (correct syntax), lets play it! \n",
907908
" if waveform:\n",
908909
" print(\"Generated song\", i)\n",
909-
" ipythondisplay.display(waveform)"
910+
" ipythondisplay.display(waveform)\n",
911+
"\n",
912+
" numeric_data = np.frombuffer(waveform.data, dtype=np.int16)\n",
913+
" wav_file_path = f\"output_{i}.wav\"\n",
914+
" write(wav_file_path, 88200, numeric_data)\n",
915+
" comet_experiment.log_asset(wav_file_path)\n",
916+
"\n",
917+
"comet_experiment.end()"
910918
]
911919
},
912920
{

0 commit comments

Comments
 (0)