Skip to content

Commit

Permalink
added alterations to lab1 solutions (part1 and part2)
Browse files Browse the repository at this point in the history
  • Loading branch information
Shorna Alam authored and Shorna Alam committed Jan 8, 2024
1 parent 61edcc0 commit a98e4a6
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
2 changes: 1 addition & 1 deletion lab1/solutions/Part1_TensorFlow_Solution.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
"source": [
"%pip install comet_ml\n",
"import comet_ml\n",
"comet_ml.init(project_name=\"6.s191lab1.1.0\")\n",
"comet_ml.init(project_name=\"6.s191lab1_part0\")\n",
"comet_experiment = comet_ml.Experiment()"
]
},
Expand Down
18 changes: 13 additions & 5 deletions lab1/solutions/Part2_Music_Generation_Solution.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@
"source": [
"%pip install comet_ml\n",
"import comet_ml\n",
"comet_ml.init(project_name=\"6.s191lab1.2\")\n",
"comet_ml.init(project_name=\"6.s191lab1_part2\")\n",
"comet_experiment = comet_ml.Experiment()\n",
"\n",
"# Import Tensorflow 2.0\n",
Expand All @@ -219,7 +219,9 @@
"\n",
"# Check that we are using a GPU, if not switch runtimes\n",
"# using Runtime > Change Runtime Type > GPU\n",
"assert len(tf.config.list_physical_devices('GPU')) > 0"
"assert len(tf.config.list_physical_devices('GPU')) > 0\n",
"\n",
"from scipy.io.wavfile import write"
]
},
{
Expand Down Expand Up @@ -1099,8 +1101,7 @@
" model.save_weights(checkpoint_prefix)\n",
" \n",
"# Save the trained model and the weights\n",
"model.save_weights(checkpoint_prefix)\n",
"comet_experiment.end()\n"
"model.save_weights(checkpoint_prefix)\n"
]
},
{
Expand Down Expand Up @@ -1275,7 +1276,14 @@
" # If its a valid song (correct syntax), lets play it! \n",
" if waveform:\n",
" print(\"Generated song\", i)\n",
" ipythondisplay.display(waveform)"
" ipythondisplay.display(waveform)\n",
"\n",
" numeric_data = np.frombuffer(waveform.data, dtype=np.int16)\n",
" wav_file_path = f\"output_{i}.wav\"\n",
" write(wav_file_path, 88200, numeric_data)\n",
" comet_experiment.log_asset(wav_file_path)\n",
" \n",
"comet_experiment.end()"
]
},
{
Expand Down

0 comments on commit a98e4a6

Please sign in to comment.