From 5510e01581f7ed7af08147344211c91992beb0bf Mon Sep 17 00:00:00 2001 From: Walter Hugo Lopez Pinaya Date: Thu, 16 Mar 2023 10:12:07 +0000 Subject: [PATCH] Remove TODOs Signed-off-by: Walter Hugo Lopez Pinaya --- .../2d_autoencoderkl_tutorial.ipynb | 10 ---------- .../2d_autoencoderkl_tutorial.py | 4 ---- .../2d_ddpm/2d_ddpm_compare_schedulers.ipynb | 3 --- .../2d_ddpm/2d_ddpm_compare_schedulers.py | 3 --- .../2d_ddpm/2d_ddpm_inpainting.ipynb | 5 +---- .../generative/2d_ddpm/2d_ddpm_inpainting.py | 5 +---- .../generative/2d_ddpm/2d_ddpm_tutorial.ipynb | 16 +--------------- .../generative/2d_ddpm/2d_ddpm_tutorial.py | 5 +---- .../2d_ddpm/2d_ddpm_tutorial_ignite.ipynb | 19 ++----------------- .../2d_ddpm/2d_ddpm_tutorial_ignite.py | 6 +----- .../2d_ddpm_tutorial_v_prediction.ipynb | 3 --- .../2d_ddpm/2d_ddpm_tutorial_v_prediction.py | 3 --- .../generative/2d_ldm/2d_ldm_tutorial.ipynb | 12 ------------ .../generative/2d_ldm/2d_ldm_tutorial.py | 5 ----- ...stable_diffusion_v2_super_resolution.ipynb | 10 ---------- ...2d_stable_diffusion_v2_super_resolution.py | 3 --- .../2d_vqgan/2d_vqgan_tutorial.ipynb | 2 -- .../generative/2d_vqgan/2d_vqgan_tutorial.py | 2 -- .../2d_vqvae/2d_vqvae_tutorial.ipynb | 1 - .../generative/2d_vqvae/2d_vqvae_tutorial.py | 1 - .../2d_vqvae_transformer_tutorial.ipynb | 19 +++++++------------ .../3d_autoencoderkl_tutorial.ipynb | 14 +++----------- .../3d_autoencoderkl_tutorial.py | 3 --- .../generative/3d_ddpm/3d_ddpm_tutorial.ipynb | 3 --- .../generative/3d_ddpm/3d_ddpm_tutorial.py | 3 --- .../3d_vqvae/3d_vqvae_tutorial.ipynb | 5 +---- .../generative/3d_vqvae/3d_vqvae_tutorial.py | 2 -- ...pm_classifier_free_guidance_tutorial.ipynb | 3 --- ..._ddpm_classifier_free_guidance_tutorial.py | 3 --- 29 files changed, 18 insertions(+), 155 deletions(-) diff --git a/tutorials/generative/2d_autoencoderkl/2d_autoencoderkl_tutorial.ipynb b/tutorials/generative/2d_autoencoderkl/2d_autoencoderkl_tutorial.ipynb index 965b1350..c000b207 100644 --- a/tutorials/generative/2d_autoencoderkl/2d_autoencoderkl_tutorial.ipynb +++ b/tutorials/generative/2d_autoencoderkl/2d_autoencoderkl_tutorial.ipynb @@ -23,16 +23,6 @@ "\n" ] }, - { - "cell_type": "code", - "execution_count": 1, - "id": "6f87583c", - "metadata": {}, - "outputs": [], - "source": [ - "# TODO: Add buttom with \"Open with Colab\"" - ] - }, { "cell_type": "markdown", "id": "2caa73e1", diff --git a/tutorials/generative/2d_autoencoderkl/2d_autoencoderkl_tutorial.py b/tutorials/generative/2d_autoencoderkl/2d_autoencoderkl_tutorial.py index 0ecb5acf..6c2046c1 100644 --- a/tutorials/generative/2d_autoencoderkl/2d_autoencoderkl_tutorial.py +++ b/tutorials/generative/2d_autoencoderkl/2d_autoencoderkl_tutorial.py @@ -16,10 +16,6 @@ # # -# + -# TODO: Add buttom with "Open with Colab" -# - - # ## Set up environment using Colab # !pip install -q "monai-weekly[tqdm]==1.1.dev2239" diff --git a/tutorials/generative/2d_ddpm/2d_ddpm_compare_schedulers.ipynb b/tutorials/generative/2d_ddpm/2d_ddpm_compare_schedulers.ipynb index 4595b4d3..85d984da 100644 --- a/tutorials/generative/2d_ddpm/2d_ddpm_compare_schedulers.ipynb +++ b/tutorials/generative/2d_ddpm/2d_ddpm_compare_schedulers.ipynb @@ -16,7 +16,6 @@ "[3] - PNDM - Liu et al. \"Pseudo Numerical Methods for Diffusion Models on Manifolds\" https://arxiv.org/abs/2202.09778\n", "\n", "\n", - "TODO: Add Open in Colab\n", "\n", "## Setup environment" ] @@ -108,8 +107,6 @@ "from tqdm import tqdm\n", "\n", "from generative.inferers import DiffusionInferer\n", - "\n", - "# TODO: Add right import reference after deployed\n", "from generative.networks.nets import DiffusionModelUNet\n", "from generative.networks.schedulers import DDIMScheduler, DDPMScheduler, PNDMScheduler\n", "\n", diff --git a/tutorials/generative/2d_ddpm/2d_ddpm_compare_schedulers.py b/tutorials/generative/2d_ddpm/2d_ddpm_compare_schedulers.py index f9409bfe..13523f9f 100644 --- a/tutorials/generative/2d_ddpm/2d_ddpm_compare_schedulers.py +++ b/tutorials/generative/2d_ddpm/2d_ddpm_compare_schedulers.py @@ -25,7 +25,6 @@ # [3] - PNDM - Liu et al. "Pseudo Numerical Methods for Diffusion Models on Manifolds" https://arxiv.org/abs/2202.09778 # # -# TODO: Add Open in Colab # # ## Setup environment @@ -64,8 +63,6 @@ from tqdm import tqdm from generative.inferers import DiffusionInferer - -# TODO: Add right import reference after deployed from generative.networks.nets import DiffusionModelUNet from generative.networks.schedulers import DDIMScheduler, DDPMScheduler, PNDMScheduler diff --git a/tutorials/generative/2d_ddpm/2d_ddpm_inpainting.ipynb b/tutorials/generative/2d_ddpm/2d_ddpm_inpainting.ipynb index 1fc3f9f0..69aa07fa 100644 --- a/tutorials/generative/2d_ddpm/2d_ddpm_inpainting.ipynb +++ b/tutorials/generative/2d_ddpm/2d_ddpm_inpainting.ipynb @@ -13,7 +13,6 @@ "\n", "[2] - Lugmayr et al. \"RePaint: Inpainting using Denoising Diffusion Probabilistic Models\" https://arxiv.org/abs/2201.09865\n", "\n", - "TODO: Add Open in Colab\n", "\n", "## Setup environment" ] @@ -109,8 +108,6 @@ "from tqdm import tqdm\n", "\n", "from generative.inferers import DiffusionInferer\n", - "\n", - "# TODO: Add right import reference after deployed\n", "from generative.networks.nets import DiffusionModelUNet\n", "from generative.networks.schedulers import DDPMScheduler\n", "\n", @@ -914,7 +911,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.8.13" + "version": "3.10.6" } }, "nbformat": 4, diff --git a/tutorials/generative/2d_ddpm/2d_ddpm_inpainting.py b/tutorials/generative/2d_ddpm/2d_ddpm_inpainting.py index 58874039..6dcaee81 100644 --- a/tutorials/generative/2d_ddpm/2d_ddpm_inpainting.py +++ b/tutorials/generative/2d_ddpm/2d_ddpm_inpainting.py @@ -6,7 +6,7 @@ # extension: .py # format_name: percent # format_version: '1.3' -# jupytext_version: 1.14.1 +# jupytext_version: 1.14.4 # kernelspec: # display_name: Python 3 (ipykernel) # language: python @@ -22,7 +22,6 @@ # # [2] - Lugmayr et al. "RePaint: Inpainting using Denoising Diffusion Probabilistic Models" https://arxiv.org/abs/2201.09865 # -# TODO: Add Open in Colab # # ## Setup environment @@ -63,8 +62,6 @@ from tqdm import tqdm from generative.inferers import DiffusionInferer - -# TODO: Add right import reference after deployed from generative.networks.nets import DiffusionModelUNet from generative.networks.schedulers import DDPMScheduler diff --git a/tutorials/generative/2d_ddpm/2d_ddpm_tutorial.ipynb b/tutorials/generative/2d_ddpm/2d_ddpm_tutorial.ipynb index 40595441..67e1307a 100644 --- a/tutorials/generative/2d_ddpm/2d_ddpm_tutorial.ipynb +++ b/tutorials/generative/2d_ddpm/2d_ddpm_tutorial.ipynb @@ -12,7 +12,6 @@ "\n", "[1] - Ho et al. \"Denoising Diffusion Probabilistic Models\" https://arxiv.org/abs/2006.11239\n", "\n", - "TODO: Add Open in Colab\n", "\n", "## Setup environment" ] @@ -42,7 +41,6 @@ "execution_count": 2, "id": "dd62a552", "metadata": { - "collapsed": false, "jupyter": { "outputs_hidden": false } @@ -111,8 +109,6 @@ "from tqdm import tqdm\n", "\n", "from generative.inferers import DiffusionInferer\n", - "\n", - "# TODO: Add right import reference after deployed\n", "from generative.networks.nets import DiffusionModelUNet\n", "from generative.networks.schedulers import DDPMScheduler\n", "\n", @@ -138,7 +134,6 @@ "execution_count": 3, "id": "8fc58c80", "metadata": { - "collapsed": false, "jupyter": { "outputs_hidden": false } @@ -171,7 +166,6 @@ "execution_count": 4, "id": "ad5a1948", "metadata": { - "collapsed": false, "jupyter": { "outputs_hidden": false } @@ -197,7 +191,6 @@ "execution_count": 5, "id": "65e1c200", "metadata": { - "collapsed": false, "jupyter": { "outputs_hidden": false } @@ -236,7 +229,6 @@ "execution_count": 6, "id": "e2f9bebd", "metadata": { - "collapsed": false, "jupyter": { "outputs_hidden": false } @@ -276,7 +268,6 @@ "execution_count": 7, "id": "938318c2", "metadata": { - "collapsed": false, "jupyter": { "outputs_hidden": false } @@ -326,7 +317,6 @@ "execution_count": 8, "id": "b698f4f8", "metadata": { - "collapsed": false, "jupyter": { "outputs_hidden": false } @@ -379,7 +369,6 @@ "execution_count": 9, "id": "2c52e4f4", "metadata": { - "collapsed": false, "jupyter": { "outputs_hidden": false }, @@ -423,7 +412,6 @@ "execution_count": 10, "id": "0f697a13", "metadata": { - "collapsed": false, "jupyter": { "outputs_hidden": false }, @@ -861,7 +849,6 @@ "execution_count": 11, "id": "2cdcda81", "metadata": { - "collapsed": false, "jupyter": { "outputs_hidden": false } @@ -911,7 +898,6 @@ "execution_count": 12, "id": "1427e5d4", "metadata": { - "collapsed": false, "jupyter": { "outputs_hidden": false } @@ -995,7 +981,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.8.13" + "version": "3.10.6" } }, "nbformat": 4, diff --git a/tutorials/generative/2d_ddpm/2d_ddpm_tutorial.py b/tutorials/generative/2d_ddpm/2d_ddpm_tutorial.py index 2d81ddb6..43394caf 100644 --- a/tutorials/generative/2d_ddpm/2d_ddpm_tutorial.py +++ b/tutorials/generative/2d_ddpm/2d_ddpm_tutorial.py @@ -6,7 +6,7 @@ # extension: .py # format_name: percent # format_version: '1.3' -# jupytext_version: 1.14.1 +# jupytext_version: 1.14.4 # kernelspec: # display_name: Python 3 (ipykernel) # language: python @@ -21,7 +21,6 @@ # # [1] - Ho et al. "Denoising Diffusion Probabilistic Models" https://arxiv.org/abs/2006.11239 # -# TODO: Add Open in Colab # # ## Setup environment @@ -62,8 +61,6 @@ from tqdm import tqdm from generative.inferers import DiffusionInferer - -# TODO: Add right import reference after deployed from generative.networks.nets import DiffusionModelUNet from generative.networks.schedulers import DDPMScheduler diff --git a/tutorials/generative/2d_ddpm/2d_ddpm_tutorial_ignite.ipynb b/tutorials/generative/2d_ddpm/2d_ddpm_tutorial_ignite.ipynb index 53f95818..1ba60203 100644 --- a/tutorials/generative/2d_ddpm/2d_ddpm_tutorial_ignite.ipynb +++ b/tutorials/generative/2d_ddpm/2d_ddpm_tutorial_ignite.ipynb @@ -12,7 +12,6 @@ "\n", "[1] - Ho et al. \"Denoising Diffusion Probabilistic Models\" https://arxiv.org/abs/2006.11239\n", "\n", - "TODO: Add Open in Colab\n", "\n", "## Setup environment" ] @@ -44,7 +43,6 @@ "execution_count": 2, "id": "dd62a552", "metadata": { - "collapsed": false, "jupyter": { "outputs_hidden": false } @@ -98,7 +96,6 @@ "import os\n", "import shutil\n", "import tempfile\n", - "from typing import Dict, Mapping, Optional, Union\n", "\n", "import matplotlib.pyplot as plt\n", "import numpy as np\n", @@ -114,8 +111,6 @@ "\n", "from generative.inferers import DiffusionInferer\n", "from generative.engines import DiffusionPrepareBatch\n", - "\n", - "# TODO: Add right import reference after deployed\n", "from generative.networks.nets import DiffusionModelUNet\n", "from generative.networks.schedulers import DDPMScheduler\n", "\n", @@ -141,7 +136,6 @@ "execution_count": 3, "id": "8fc58c80", "metadata": { - "collapsed": false, "jupyter": { "outputs_hidden": false } @@ -174,7 +168,6 @@ "execution_count": 4, "id": "ad5a1948", "metadata": { - "collapsed": false, "jupyter": { "outputs_hidden": false } @@ -200,7 +193,6 @@ "execution_count": 5, "id": "65e1c200", "metadata": { - "collapsed": false, "jupyter": { "outputs_hidden": false } @@ -239,7 +231,6 @@ "execution_count": 6, "id": "e2f9bebd", "metadata": { - "collapsed": false, "jupyter": { "outputs_hidden": false } @@ -279,7 +270,6 @@ "execution_count": 7, "id": "938318c2", "metadata": { - "collapsed": false, "jupyter": { "outputs_hidden": false } @@ -329,7 +319,6 @@ "execution_count": 8, "id": "b698f4f8", "metadata": { - "collapsed": false, "jupyter": { "outputs_hidden": false } @@ -382,11 +371,9 @@ "execution_count": 9, "id": "2c52e4f4", "metadata": { - "collapsed": false, "jupyter": { "outputs_hidden": false - }, - "lines_to_next_cell": 0 + } }, "outputs": [], "source": [ @@ -425,7 +412,6 @@ "execution_count": 11, "id": "0f697a13", "metadata": { - "collapsed": false, "jupyter": { "outputs_hidden": false }, @@ -2156,7 +2142,6 @@ "execution_count": 12, "id": "1427e5d4", "metadata": { - "collapsed": false, "jupyter": { "outputs_hidden": false } @@ -2241,7 +2226,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.13" + "version": "3.10.6" } }, "nbformat": 4, diff --git a/tutorials/generative/2d_ddpm/2d_ddpm_tutorial_ignite.py b/tutorials/generative/2d_ddpm/2d_ddpm_tutorial_ignite.py index 24307b90..929715ad 100644 --- a/tutorials/generative/2d_ddpm/2d_ddpm_tutorial_ignite.py +++ b/tutorials/generative/2d_ddpm/2d_ddpm_tutorial_ignite.py @@ -21,7 +21,6 @@ # # [1] - Ho et al. "Denoising Diffusion Probabilistic Models" https://arxiv.org/abs/2006.11239 # -# TODO: Add Open in Colab # # ## Setup environment @@ -49,7 +48,6 @@ import os import shutil import tempfile -from typing import Dict, Mapping, Optional, Union import matplotlib.pyplot as plt import numpy as np @@ -59,14 +57,12 @@ from monai.apps import MedNISTDataset from monai.config import print_config from monai.data import CacheDataset, DataLoader -from monai.engines import PrepareBatch, SupervisedEvaluator, SupervisedTrainer, default_prepare_batch +from monai.engines import SupervisedEvaluator, SupervisedTrainer from monai.handlers import MeanAbsoluteError, MeanSquaredError, StatsHandler, ValidationHandler, from_engine from monai.utils import first, set_determinism from generative.inferers import DiffusionInferer from generative.engines import DiffusionPrepareBatch - -# TODO: Add right import reference after deployed from generative.networks.nets import DiffusionModelUNet from generative.networks.schedulers import DDPMScheduler diff --git a/tutorials/generative/2d_ddpm/2d_ddpm_tutorial_v_prediction.ipynb b/tutorials/generative/2d_ddpm/2d_ddpm_tutorial_v_prediction.ipynb index 7df8fd35..c0e809c1 100644 --- a/tutorials/generative/2d_ddpm/2d_ddpm_tutorial_v_prediction.ipynb +++ b/tutorials/generative/2d_ddpm/2d_ddpm_tutorial_v_prediction.ipynb @@ -12,7 +12,6 @@ "[1] - Ho et al. \"Denoising Diffusion Probabilistic Models\" https://arxiv.org/abs/2006.11239\n", "[2] - Ho et al. \"Imagen Video: High Definition Video Generation with Diffusion Models\" https://arxiv.org/abs/2210.02303\n", "\n", - "TODO: Add Open in Colab\n", "\n", "## Setup environment" ] @@ -110,8 +109,6 @@ "from tqdm import tqdm\n", "\n", "from generative.inferers import DiffusionInferer\n", - "\n", - "# TODO: Add right import reference after deployed\n", "from generative.networks.nets import DiffusionModelUNet\n", "from generative.networks.schedulers import DDPMScheduler\n", "\n", diff --git a/tutorials/generative/2d_ddpm/2d_ddpm_tutorial_v_prediction.py b/tutorials/generative/2d_ddpm/2d_ddpm_tutorial_v_prediction.py index fcc4b30e..815ef0d9 100644 --- a/tutorials/generative/2d_ddpm/2d_ddpm_tutorial_v_prediction.py +++ b/tutorials/generative/2d_ddpm/2d_ddpm_tutorial_v_prediction.py @@ -21,7 +21,6 @@ # [1] - Ho et al. "Denoising Diffusion Probabilistic Models" https://arxiv.org/abs/2006.11239 # [2] - Ho et al. "Imagen Video: High Definition Video Generation with Diffusion Models" https://arxiv.org/abs/2210.02303 # -# TODO: Add Open in Colab # # ## Setup environment @@ -62,8 +61,6 @@ from tqdm import tqdm from generative.inferers import DiffusionInferer - -# TODO: Add right import reference after deployed from generative.networks.nets import DiffusionModelUNet from generative.networks.schedulers import DDPMScheduler diff --git a/tutorials/generative/2d_ldm/2d_ldm_tutorial.ipynb b/tutorials/generative/2d_ldm/2d_ldm_tutorial.ipynb index 64cd2746..11b8e2a6 100644 --- a/tutorials/generative/2d_ldm/2d_ldm_tutorial.ipynb +++ b/tutorials/generative/2d_ldm/2d_ldm_tutorial.ipynb @@ -8,16 +8,6 @@ "# 2D Latent Diffusion Model" ] }, - { - "cell_type": "code", - "execution_count": 1, - "id": "5501b133", - "metadata": {}, - "outputs": [], - "source": [ - "# TODO: Add buttom with \"Open with Colab\"" - ] - }, { "cell_type": "markdown", "id": "c6801e8b", @@ -224,7 +214,6 @@ " transforms.LoadImaged(keys=[\"image\"]),\n", " transforms.EnsureChannelFirstd(keys=[\"image\"]),\n", " transforms.ScaleIntensityRanged(keys=[\"image\"], a_min=0.0, a_max=255.0, b_min=0.0, b_max=1.0, clip=True),\n", - " # TODO: Change transformations\n", " transforms.RandAffined(\n", " keys=[\"image\"],\n", " rotate_range=[(-np.pi / 36, np.pi / 36), (-np.pi / 36, np.pi / 36)],\n", @@ -1505,7 +1494,6 @@ "scheduler.set_timesteps(num_inference_steps=1000)\n", "\n", "with torch.no_grad():\n", - "\n", " z_mu, z_sigma = autoencoderkl.encode(image)\n", " z = autoencoderkl.sampling(z_mu, z_sigma)\n", "\n", diff --git a/tutorials/generative/2d_ldm/2d_ldm_tutorial.py b/tutorials/generative/2d_ldm/2d_ldm_tutorial.py index 3eb85258..7b4d6edf 100644 --- a/tutorials/generative/2d_ldm/2d_ldm_tutorial.py +++ b/tutorials/generative/2d_ldm/2d_ldm_tutorial.py @@ -16,10 +16,6 @@ # # 2D Latent Diffusion Model -# + -# TODO: Add buttom with "Open with Colab" -# - - # ## Set up environment using Colab # @@ -76,7 +72,6 @@ transforms.LoadImaged(keys=["image"]), transforms.EnsureChannelFirstd(keys=["image"]), transforms.ScaleIntensityRanged(keys=["image"], a_min=0.0, a_max=255.0, b_min=0.0, b_max=1.0, clip=True), - # TODO: Change transformations transforms.RandAffined( keys=["image"], rotate_range=[(-np.pi / 36, np.pi / 36), (-np.pi / 36, np.pi / 36)], diff --git a/tutorials/generative/2d_super_resolution/2d_stable_diffusion_v2_super_resolution.ipynb b/tutorials/generative/2d_super_resolution/2d_stable_diffusion_v2_super_resolution.ipynb index 2a383dc9..52ef0894 100644 --- a/tutorials/generative/2d_super_resolution/2d_stable_diffusion_v2_super_resolution.ipynb +++ b/tutorials/generative/2d_super_resolution/2d_stable_diffusion_v2_super_resolution.ipynb @@ -19,16 +19,6 @@ "[3] - Ho et al. \"High Definition Video Generation with Diffusion Models\" https://arxiv.org/abs/2210.02303" ] }, - { - "cell_type": "code", - "execution_count": 1, - "id": "0122d777", - "metadata": {}, - "outputs": [], - "source": [ - "# TODO: Add buttom with \"Open with Colab\"" - ] - }, { "cell_type": "markdown", "id": "b839bf2d", diff --git a/tutorials/generative/2d_super_resolution/2d_stable_diffusion_v2_super_resolution.py b/tutorials/generative/2d_super_resolution/2d_stable_diffusion_v2_super_resolution.py index 9c3a9afd..fa0c9dc0 100644 --- a/tutorials/generative/2d_super_resolution/2d_stable_diffusion_v2_super_resolution.py +++ b/tutorials/generative/2d_super_resolution/2d_stable_diffusion_v2_super_resolution.py @@ -28,9 +28,6 @@ # # [3] - Ho et al. "High Definition Video Generation with Diffusion Models" https://arxiv.org/abs/2210.02303 -# %% -# TODO: Add buttom with "Open with Colab" - # %% [markdown] # ## Set up environment using Colab # diff --git a/tutorials/generative/2d_vqgan/2d_vqgan_tutorial.ipynb b/tutorials/generative/2d_vqgan/2d_vqgan_tutorial.ipynb index 2566d397..17420da7 100644 --- a/tutorials/generative/2d_vqgan/2d_vqgan_tutorial.ipynb +++ b/tutorials/generative/2d_vqgan/2d_vqgan_tutorial.ipynb @@ -9,7 +9,6 @@ "\n", "This tutorial illustrates how to use MONAI for training a Vector Quantized Generative Adversarial Network (VQGAN) on 2D images.\n", "\n", - "TODO: Add Open in Colab\n", "\n", "## Setup environment" ] @@ -102,7 +101,6 @@ "from torch.nn import L1Loss\n", "from tqdm import tqdm\n", "\n", - "# TODO: Add right import reference after deployed\n", "from generative.losses import PatchAdversarialLoss, PerceptualLoss\n", "from generative.networks.nets import VQVAE, PatchDiscriminator\n", "\n", diff --git a/tutorials/generative/2d_vqgan/2d_vqgan_tutorial.py b/tutorials/generative/2d_vqgan/2d_vqgan_tutorial.py index fd347f20..7c9d4104 100644 --- a/tutorials/generative/2d_vqgan/2d_vqgan_tutorial.py +++ b/tutorials/generative/2d_vqgan/2d_vqgan_tutorial.py @@ -18,7 +18,6 @@ # # This tutorial illustrates how to use MONAI for training a Vector Quantized Generative Adversarial Network (VQGAN) on 2D images. # -# TODO: Add Open in Colab # # ## Setup environment @@ -58,7 +57,6 @@ from torch.nn import L1Loss from tqdm import tqdm -# TODO: Add right import reference after deployed from generative.losses import PatchAdversarialLoss, PerceptualLoss from generative.networks.nets import VQVAE, PatchDiscriminator diff --git a/tutorials/generative/2d_vqvae/2d_vqvae_tutorial.ipynb b/tutorials/generative/2d_vqvae/2d_vqvae_tutorial.ipynb index 78c0e6a1..9f5db16d 100644 --- a/tutorials/generative/2d_vqvae/2d_vqvae_tutorial.ipynb +++ b/tutorials/generative/2d_vqvae/2d_vqvae_tutorial.ipynb @@ -16,7 +16,6 @@ "\n", "[1] - [Oord et al. \"Neural Discrete Representation Learning\"](https://arxiv.org/abs/1711.00937)\n", "\n", - "TODO: Add Open in Colab\n", "\n", "### Setup environment" ] diff --git a/tutorials/generative/2d_vqvae/2d_vqvae_tutorial.py b/tutorials/generative/2d_vqvae/2d_vqvae_tutorial.py index 3a73d3c4..42ba7b14 100644 --- a/tutorials/generative/2d_vqvae/2d_vqvae_tutorial.py +++ b/tutorials/generative/2d_vqvae/2d_vqvae_tutorial.py @@ -9,7 +9,6 @@ # # [1] - [Oord et al. "Neural Discrete Representation Learning"](https://arxiv.org/abs/1711.00937) # -# TODO: Add Open in Colab # # ### Setup environment diff --git a/tutorials/generative/2d_vqvae_transformer/2d_vqvae_transformer_tutorial.ipynb b/tutorials/generative/2d_vqvae_transformer/2d_vqvae_transformer_tutorial.ipynb index dea56501..56ad82bf 100644 --- a/tutorials/generative/2d_vqvae_transformer/2d_vqvae_transformer_tutorial.ipynb +++ b/tutorials/generative/2d_vqvae_transformer/2d_vqvae_transformer_tutorial.ipynb @@ -606,13 +606,7 @@ "Epoch 69: 100%|████████████████| 63/63 [00:31<00:00, 1.98it/s, recons_loss=0.0173, quantization_loss=6.11e-5]\n", "Epoch 70: 100%|████████████████| 63/63 [00:31<00:00, 1.97it/s, recons_loss=0.0179, quantization_loss=5.79e-5]\n", "Epoch 71: 100%|█████████████████| 63/63 [00:31<00:00, 1.98it/s, recons_loss=0.0176, quantization_loss=6.1e-5]\n", - "Epoch 72: 100%|████████████████| 63/63 [00:31<00:00, 1.98it/s, recons_loss=0.0175, quantization_loss=5.29e-5]\n" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ + "Epoch 72: 100%|████████████████| 63/63 [00:31<00:00, 1.98it/s, recons_loss=0.0175, quantization_loss=5.29e-5]\n", "Epoch 73: 100%|█████████████████| 63/63 [00:31<00:00, 1.98it/s, recons_loss=0.017, quantization_loss=5.79e-5]\n", "Epoch 74: 100%|████████████████| 63/63 [00:31<00:00, 1.98it/s, recons_loss=0.0169, quantization_loss=6.35e-5]\n", "Epoch 75: 100%|████████████████| 63/63 [00:31<00:00, 1.98it/s, recons_loss=0.0165, quantization_loss=5.69e-5]\n", @@ -1378,7 +1372,9 @@ "cell_type": "code", "execution_count": 17, "id": "c64b1237", - "metadata": {}, + "metadata": { + "lines_to_next_cell": 2 + }, "outputs": [], "source": [ "optimizer = torch.optim.Adam(params=transformer_model.parameters(), lr=5e-4)\n", @@ -1388,7 +1384,9 @@ { "cell_type": "markdown", "id": "ad0849c3", - "metadata": {}, + "metadata": { + "lines_to_next_cell": 2 + }, "source": [ "First we will define a function to allow us to generate random samples from the transformer. This will allow us to keep track of training progress as well to see how samples look during the training cycle" ] @@ -1402,7 +1400,6 @@ "source": [ "@torch.no_grad()\n", "def generate(net, vqvae_model, starting_tokens, seq_len, **kwargs):\n", - "\n", " progress_bar = iter(range(seq_len))\n", "\n", " latent_seq = starting_tokens.long()\n", @@ -1527,7 +1524,6 @@ " progress_bar = tqdm(enumerate(train_loader), total=len(train_loader), ncols=110)\n", " progress_bar.set_description(f\"Epoch {epoch}\")\n", " for step, batch in progress_bar:\n", - "\n", " images = batch[\"image\"].to(device)\n", " # Encode images using vqvae and transformer to 1D sequence\n", " quantizations = vqvae_model.index_quantize(images)\n", @@ -1561,7 +1557,6 @@ " val_loss = 0\n", " with torch.no_grad():\n", " for val_step, batch in enumerate(val_loader, start=1):\n", - "\n", " images = batch[\"image\"].to(device)\n", " # Encode images using vqvae and transformer to 1D sequence\n", " quantizations = vqvae_model.index_quantize(images)\n", diff --git a/tutorials/generative/3d_autoencoderkl/3d_autoencoderkl_tutorial.ipynb b/tutorials/generative/3d_autoencoderkl/3d_autoencoderkl_tutorial.ipynb index c9cd3eb4..0eb2f79c 100644 --- a/tutorials/generative/3d_autoencoderkl/3d_autoencoderkl_tutorial.ipynb +++ b/tutorials/generative/3d_autoencoderkl/3d_autoencoderkl_tutorial.ipynb @@ -11,7 +11,9 @@ { "cell_type": "markdown", "id": "eca65c39", - "metadata": {}, + "metadata": { + "lines_to_next_cell": 2 + }, "source": [ "This demo is a toy example of how to use MONAI's AutoencoderKL. In particular, it uses the Autoencoder with a Kullback-Leibler regularisation as implemented by Rombach et. al [1].\n", "\n", @@ -22,16 +24,6 @@ "[Brain tumor 3D segmentation with MONAI](https://github.com/Project-MONAI/tutorials/blob/main/3d_segmentation/brats_segmentation_3d.ipynb)" ] }, - { - "cell_type": "code", - "execution_count": null, - "id": "946adc65", - "metadata": {}, - "outputs": [], - "source": [ - "# TODO: Add Open in Colab" - ] - }, { "cell_type": "code", "execution_count": null, diff --git a/tutorials/generative/3d_autoencoderkl/3d_autoencoderkl_tutorial.py b/tutorials/generative/3d_autoencoderkl/3d_autoencoderkl_tutorial.py index 331dcb71..f18f91d2 100644 --- a/tutorials/generative/3d_autoencoderkl/3d_autoencoderkl_tutorial.py +++ b/tutorials/generative/3d_autoencoderkl/3d_autoencoderkl_tutorial.py @@ -23,9 +23,6 @@ # # [Brain tumor 3D segmentation with MONAI](https://github.com/Project-MONAI/tutorials/blob/main/3d_segmentation/brats_segmentation_3d.ipynb) -# + -# TODO: Add Open in Colab -# - # !python -c "import monai" || pip install -q "monai-weekly[pillow, tqdm, einops, nibabel]" # !python -c "import matplotlib" || pip install -q matplotlib diff --git a/tutorials/generative/3d_ddpm/3d_ddpm_tutorial.ipynb b/tutorials/generative/3d_ddpm/3d_ddpm_tutorial.ipynb index 70c23960..0c3ff8a5 100644 --- a/tutorials/generative/3d_ddpm/3d_ddpm_tutorial.ipynb +++ b/tutorials/generative/3d_ddpm/3d_ddpm_tutorial.ipynb @@ -11,7 +11,6 @@ "\n", "[1] - [Ho et al. \"Denoising Diffusion Probabilistic Models\"](https://arxiv.org/abs/2006.11239)\n", "\n", - "TODO: Add Open in Colab\n", "\n", "## Setup environment" ] @@ -116,8 +115,6 @@ "from tqdm import tqdm\n", "\n", "from generative.inferers import DiffusionInferer\n", - "\n", - "# TODO: Add right import reference after deployed\n", "from generative.networks.nets import DiffusionModelUNet\n", "from generative.networks.schedulers import DDPMScheduler\n", "\n", diff --git a/tutorials/generative/3d_ddpm/3d_ddpm_tutorial.py b/tutorials/generative/3d_ddpm/3d_ddpm_tutorial.py index 400a49af..612b84dd 100644 --- a/tutorials/generative/3d_ddpm/3d_ddpm_tutorial.py +++ b/tutorials/generative/3d_ddpm/3d_ddpm_tutorial.py @@ -20,7 +20,6 @@ # # [1] - [Ho et al. "Denoising Diffusion Probabilistic Models"](https://arxiv.org/abs/2006.11239) # -# TODO: Add Open in Colab # # ## Setup environment @@ -61,8 +60,6 @@ from tqdm import tqdm from generative.inferers import DiffusionInferer - -# TODO: Add right import reference after deployed from generative.networks.nets import DiffusionModelUNet from generative.networks.schedulers import DDPMScheduler diff --git a/tutorials/generative/3d_vqvae/3d_vqvae_tutorial.ipynb b/tutorials/generative/3d_vqvae/3d_vqvae_tutorial.ipynb index a20a5393..587b82fb 100644 --- a/tutorials/generative/3d_vqvae/3d_vqvae_tutorial.ipynb +++ b/tutorials/generative/3d_vqvae/3d_vqvae_tutorial.ipynb @@ -14,10 +14,7 @@ "The VQVAE can also be used as a generative model if an autoregressor model (e.g., PixelCNN, Decoder Transformer) is trained on the discrete latent representations of the VQVAE bottleneck. This falls outside of the scope of this tutorial.\n", "\n", "[1] - [Oord et al. \"Neural Discrete Representation Learning\"](https://arxiv.org/abs/1711.00937)\n", - "\n", - "TODO: Add Open in Colab\n", - "\n", - "### Setup environment" + "\n" ] }, { diff --git a/tutorials/generative/3d_vqvae/3d_vqvae_tutorial.py b/tutorials/generative/3d_vqvae/3d_vqvae_tutorial.py index 95786e15..1a64a9df 100644 --- a/tutorials/generative/3d_vqvae/3d_vqvae_tutorial.py +++ b/tutorials/generative/3d_vqvae/3d_vqvae_tutorial.py @@ -9,9 +9,7 @@ # # [1] - [Oord et al. "Neural Discrete Representation Learning"](https://arxiv.org/abs/1711.00937) # -# TODO: Add Open in Colab # -# ### Setup environment # %% [markdown] # ### Setup imports diff --git a/tutorials/generative/classifier_free_guidance/2d_ddpm_classifier_free_guidance_tutorial.ipynb b/tutorials/generative/classifier_free_guidance/2d_ddpm_classifier_free_guidance_tutorial.ipynb index 4c28a1b4..d99cf37d 100644 --- a/tutorials/generative/classifier_free_guidance/2d_ddpm_classifier_free_guidance_tutorial.ipynb +++ b/tutorials/generative/classifier_free_guidance/2d_ddpm_classifier_free_guidance_tutorial.ipynb @@ -14,7 +14,6 @@ "[2] - Ho and Salimans \"Classifier-Free Diffusion Guidance\" https://arxiv.org/abs/2207.12598\n", "\n", "\n", - "TODO: Add Open in Colab\n", "\n", "## Setup environment" ] @@ -112,8 +111,6 @@ "from tqdm import tqdm\n", "\n", "from generative.inferers import DiffusionInferer\n", - "\n", - "# TODO: Add right import reference after deployed\n", "from generative.networks.nets import DiffusionModelUNet\n", "from generative.networks.schedulers import DDPMScheduler\n", "\n", diff --git a/tutorials/generative/classifier_free_guidance/2d_ddpm_classifier_free_guidance_tutorial.py b/tutorials/generative/classifier_free_guidance/2d_ddpm_classifier_free_guidance_tutorial.py index ee00c512..3828229b 100644 --- a/tutorials/generative/classifier_free_guidance/2d_ddpm_classifier_free_guidance_tutorial.py +++ b/tutorials/generative/classifier_free_guidance/2d_ddpm_classifier_free_guidance_tutorial.py @@ -23,7 +23,6 @@ # [2] - Ho and Salimans "Classifier-Free Diffusion Guidance" https://arxiv.org/abs/2207.12598 # # -# TODO: Add Open in Colab # # ## Setup environment @@ -64,8 +63,6 @@ from tqdm import tqdm from generative.inferers import DiffusionInferer - -# TODO: Add right import reference after deployed from generative.networks.nets import DiffusionModelUNet from generative.networks.schedulers import DDPMScheduler