{ "nbformat": 4, "nbformat_minor": 0, "metadata": { "colab": { "name": "Cycle GAN", "provenance": [], "collapsed_sections": [], "toc_visible": true }, "kernelspec": { "name": "python3", "language": "python", "display_name": "Python 3" }, "accelerator": "GPU" }, "cells": [ { "cell_type": "markdown", "metadata": { "id": "AYV_dMVDxyc2" }, "source": [ "[![Github](https://img.shields.io/github/stars/labmlai/annotated_deep_learning_paper_implementations?style=social)](https://github.com/labmlai/annotated_deep_learning_paper_implementations)\n", "[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/labmlai/annotated_deep_learning_paper_implementations/blob/master/labml_nn/gan/wasserstein/experiment.ipynb)\n", "\n", "## DCGAN\n", "\n", "This is an experiment training DCGAN model." ] }, { "cell_type": "markdown", "metadata": { "id": "AahG_i2y5tY9" }, "source": [ "Install the `labml-nn` package" ] }, { "cell_type": "code", "metadata": { "id": "ZCzmCrAIVg0L", "colab": { "base_uri": "https://localhost:8080/" }, "outputId": "2fe2685f-731c-4c47-854e-a4f00e485281" }, "source": [ "!pip install labml-nn" ], "outputs": [], "execution_count": null }, { "cell_type": "markdown", "metadata": { "id": "SE2VUQ6L5zxI" }, "source": [ "Imports" ] }, { "cell_type": "code", "metadata": { "id": "0hJXx_g0wS2C" }, "source": [ "\n", "from labml import experiment\n", "from labml_nn.gan.wasserstein.experiment import Configs" ], "outputs": [], "execution_count": null }, { "cell_type": "markdown", "metadata": { "id": "Lpggo0wM6qb-" }, "source": [ "Create an experiment" ] }, { "cell_type": "code", "metadata": { "id": "bFcr9k-l4cAg" }, "source": [ "experiment.create(name=\"mnist_wgan\")" ], "outputs": [], "execution_count": null }, { "cell_type": "markdown", "metadata": { "id": "-OnHLi626tJt" }, "source": [ "Initialize configurations" ] }, { "cell_type": "code", "metadata": { "id": "Piz0c5f44hRo" }, "source": [ "conf = Configs()" ], "outputs": [], "execution_count": null }, { "cell_type": "markdown", "metadata": { "id": "wwMzCqpD6vkL" }, "source": [ "Set experiment configurations and assign a configurations dictionary to override configurations" ] }, { "cell_type": "code", "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 17 }, "id": "e6hmQhTw4nks", "outputId": "4be767af-0ebd-4c35-8da0-0e532495e037" }, "source": [ "experiment.configs(conf,\n", " {\n", " 'discriminator': 'cnn',\n", " 'generator': 'cnn',\n", " 'label_smoothing': 0.01,\n", " 'generator_loss': 'wasserstein',\n", " 'discriminator_loss': 'wasserstein',\n", " })" ], "outputs": [], "execution_count": null }, { "cell_type": "markdown", "metadata": { "id": "KJZRf8527GxL" }, "source": [ "Start the experiment and run the training loop." ] }, { "cell_type": "code", "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 649 }, "id": "aIAWo7Fw5DR8", "outputId": "e3b02247-8ff9-47b5-8f52-49c9e3b8377f" }, "source": [ "with experiment.start():\n", " conf.run()" ], "outputs": [], "execution_count": null }, { "cell_type": "code", "metadata": { "id": "oBXXlP2b7XZO" }, "source": [ "" ], "outputs": [], "execution_count": null } ] }