|
75 | 75 | }, |
76 | 76 | "outputs": [], |
77 | 77 | "source": [ |
| 78 | + "# Import Comet\n", |
| 79 | + "!pip install comet_ml\n", |
| 80 | + "import comet_ml\n", |
| 81 | + "comet_ml.init(project_name=\"6.s191lab2.2.1\")\n", |
| 82 | + "comet_model_1 = comet_ml.Experiment()\n", |
| 83 | + "\n", |
78 | 84 | "# Import Tensorflow 2.0\n", |
79 | 85 | "%tensorflow_version 2.x\n", |
80 | 86 | "import tensorflow as tf\n", |
|
300 | 306 | " x, y = loader.get_batch(batch_size)\n", |
301 | 307 | " loss = standard_train_step(x, y)\n", |
302 | 308 | "\n", |
| 309 | + " comet_model_1.log_metric(\"loss\", loss.numpy().mean(), idx)\n", |
303 | 310 | " # Record the loss and plot the evolution of the loss as a function of training\n", |
304 | 311 | " loss_history.append(loss.numpy().mean())\n", |
305 | | - " plotter.plot(loss_history.get())" |
| 312 | + " plotter.plot(loss_history.get())\n", |
| 313 | + "comet_model_1.end()" |
306 | 314 | ] |
307 | 315 | }, |
308 | 316 | { |
|
756 | 764 | "source": [ |
757 | 765 | "### Training the SS-VAE ###\n", |
758 | 766 | "\n", |
| 767 | + "comet_ml.init(project_name=\"6.s191lab2.2.2\")\n", |
| 768 | + "comet_model_2 = comet_ml.Experiment()\n", |
| 769 | + "\n", |
759 | 770 | "# Hyperparameters\n", |
760 | 771 | "batch_size = 32\n", |
761 | 772 | "learning_rate = 5e-4\n", |
|
806 | 817 | " (x, y) = loader.get_batch(batch_size)\n", |
807 | 818 | " # loss optimization\n", |
808 | 819 | " loss = ss_vae_train_step(x, y)\n", |
| 820 | + " comet_model_2.log_metric(\"loss\", loss, step=j)\n", |
809 | 821 | " \n", |
810 | 822 | " # plot the progress every 200 steps\n", |
811 | 823 | " if j % 500 == 0: \n", |
812 | | - " mdl.util.plot_sample(x, y, ss_vae)" |
| 824 | + " mdl.util.plot_sample(x, y, ss_vae)\n", |
| 825 | + " \n", |
| 826 | + "comet_model_2.end()" |
813 | 827 | ] |
814 | 828 | }, |
815 | 829 | { |
|
0 commit comments