{"cells": [{"cell_type": "markdown", "id": "fcc3a1f1", "metadata": {"papermill": {"duration": 0.010714, "end_time": "2023-03-14T15:58:52.555574", "exception": false, "start_time": "2023-03-14T15:58:52.544860", "status": "completed"}, "tags": []}, "source": ["\n", "# Tutorial 7: Deep Energy-Based Generative Models\n", "\n", "* **Author:** Phillip Lippe\n", "* **License:** CC BY-SA\n", "* **Generated:** 2023-03-14T15:57:19.480351\n", "\n", "In this tutorial, we will look at energy-based deep learning models, and focus on their application as generative models.\n", "Energy models have been a popular tool before the huge deep learning hype around 2012 hit.\n", "However, in recent years, energy-based models have gained increasing attention because of improved training methods and tricks being proposed.\n", "Although they are still in a research stage, they have shown to outperform strong Generative Adversarial Networks\n", "in certain cases which have been the state of the art of generating images\n", "([blog post](https://ajolicoeur.wordpress.com/the-new-contender-to-gans-score-matching-with-langevin-sampling/)about strong energy-based models,\n", "[blog post](https://medium.com/syncedreview/nvidia-open-sources-hyper-realistic-face-generator-stylegan-f346e1a73826) about the power of GANs).\n", "Hence, it is important to be aware of energy-based models, and as the theory can be abstract sometimes,\n", "we will show the idea of energy-based models with a lot of examples.\n", "This notebook is part of a lecture series on Deep Learning at the University of Amsterdam.\n", "The full list of tutorials can be found at https://uvadlc-notebooks.rtfd.io.\n", "\n", "\n", "---\n", "Open in [{height=\"20px\" width=\"117px\"}](https://colab.research.google.com/github/PytorchLightning/lightning-tutorials/blob/publication/.notebooks/course_UvA-DL/07-deep-energy-based-generative-models.ipynb)\n", "\n", "Give us a \u2b50 [on Github](https://www.github.com/Lightning-AI/lightning/)\n", "| Check out [the documentation](https://pytorch-lightning.readthedocs.io/en/stable/)\n", "| Join us [on Slack](https://www.pytorchlightning.ai/community)"]}, {"cell_type": "markdown", "id": "818fed51", "metadata": {"papermill": {"duration": 0.007631, "end_time": "2023-03-14T15:58:52.570190", "exception": false, "start_time": "2023-03-14T15:58:52.562559", "status": "completed"}, "tags": []}, "source": ["## Setup\n", "This notebook requires some packages besides pytorch-lightning."]}, {"cell_type": "code", "execution_count": 1, "id": "3c52da86", "metadata": {"colab": {}, "colab_type": "code", "execution": {"iopub.execute_input": "2023-03-14T15:58:52.614200Z", "iopub.status.busy": "2023-03-14T15:58:52.613288Z", "iopub.status.idle": "2023-03-14T15:58:56.051567Z", "shell.execute_reply": "2023-03-14T15:58:56.050328Z"}, "id": "LfrJLKPFyhsK", "lines_to_next_cell": 0, "papermill": {"duration": 3.450241, "end_time": "2023-03-14T15:58:56.055161", "exception": false, "start_time": "2023-03-14T15:58:52.604920", "status": "completed"}, "tags": []}, "outputs": [{"name": "stdout", "output_type": "stream", "text": ["\u001b[33mWARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv\u001b[0m\u001b[33m\r\n", "\u001b[0m"]}], "source": ["! pip install --quiet \"torch>=1.8.1, <1.14.0\" \"pytorch-lightning>=1.4, <2.0.0\" \"lightning>=2.0.0rc0\" \"setuptools==67.4.0\" \"tensorboard\" \"torchvision\" \"matplotlib\" \"ipython[notebook]>=8.0.0, <8.12.0\" \"torchmetrics>=0.7, <0.12\""]}, {"cell_type": "markdown", "id": "4d022ac7", "metadata": {"papermill": {"duration": 0.006836, "end_time": "2023-03-14T15:58:56.074281", "exception": false, "start_time": "2023-03-14T15:58:56.067445", "status": "completed"}, "tags": []}, "source": ["