mirror of
https://github.com/labmlai/annotated_deep_learning_paper_implementations.git
synced 2025-10-29 17:57:14 +08:00
185 lines
3.6 KiB
Plaintext
185 lines
3.6 KiB
Plaintext
{
|
|
"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": [
|
|
"[](https://github.com/labmlai/annotated_deep_learning_paper_implementations)\n",
|
|
"[](https://colab.research.google.com/github/labmlai/annotated_deep_learning_paper_implementations/blob/master/labml_nn/gan/dcgan/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": [
|
|
"from labml import experiment\n",
|
|
"from labml_nn.gan.dcgan 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_dcgan\")"
|
|
],
|
|
"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",
|
|
" {'discriminator': 'cnn',\n",
|
|
" 'generator': 'cnn',\n",
|
|
" 'label_smoothing': 0.01})"
|
|
],
|
|
"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
|
|
}
|
|
]
|
|
}
|