|
71 | 71 | "source": [ |
72 | 72 | "%pip install comet_ml\n", |
73 | 73 | "import comet_ml\n", |
74 | | - "comet_ml.init(project_name=\"6.s191lab1.2\")\n", |
| 74 | + "comet_ml.init(project_name=\"6.s191lab1_part2\")\n", |
75 | 75 | "comet_experiment = comet_ml.Experiment()\n", |
76 | 76 | "\n", |
77 | 77 | "# Import Tensorflow 2.0\n", |
|
93 | 93 | "\n", |
94 | 94 | "# Check that we are using a GPU, if not switch runtimes\n", |
95 | 95 | "# 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" |
97 | 99 | ] |
98 | 100 | }, |
99 | 101 | { |
|
735 | 737 | " model.save_weights(checkpoint_prefix)\n", |
736 | 738 | " \n", |
737 | 739 | "# 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" |
740 | 741 | ] |
741 | 742 | }, |
742 | 743 | { |
|
906 | 907 | " # If its a valid song (correct syntax), lets play it! \n", |
907 | 908 | " if waveform:\n", |
908 | 909 | " 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()" |
910 | 918 | ] |
911 | 919 | }, |
912 | 920 | { |
|
0 commit comments