diff --git a/.gitignore b/.gitignore index abe6a13..effdb5c 100644 --- a/.gitignore +++ b/.gitignore @@ -146,4 +146,6 @@ pretrained results alias-free-gan-ci-files -alias-free-gan-ci-files.zip \ No newline at end of file +alias-free-gan-ci-files.zip + +devel/ \ No newline at end of file diff --git a/README.md b/README.md index c94e2c6..23b3ae4 100644 --- a/README.md +++ b/README.md @@ -1,20 +1,26 @@ # Alias-Free GAN -⚠️ Still Beta Testing (first "stable" release sometime soon) ⚠️ - An unofficial version of Alias-Free Generative Adversarial Networks (https://arxiv.org/abs/2106.12423). This repository was heavily based on [Kim Seonghyeon's (rosinality) implementation](https://github.com/rosinality/alias-free-gan-pytorch). The goal of this version is to be maintainable, easy to use, and expand the features of existing implementations. This is built using pytorch and pytorch lightning (a framework that abstracts away much of the hardware specific code). See open issues unsupported features, planned features, and current bugs. -## Licence and Compensation Information +## Licence + +![MIT licence badge](https://badgen.net/badge/license/MIT/blue) This project is officially licensed as an MIT project. However, it's requested that you use this repository with the intention of actively elevating historically marginalized communities. Avoid using this project for creating anything that inflicts physical or psychological violence on individuals, groups, or animals. -If you have the financial means please consider contributing to this project or when using a pretrained model. +## Financial Support + +If you have the financial means please consider contributing to this project or creators of pretrained models. This project takes money to run because while many continuos integration (ci) tools are free to open source projects, they do not offer the necessary hardware to run tests on GPUs or TPUs. Because of this the ci testing needs to be run using Google Cloud Platform which charges for GPU and TPU instances. Any financial contributions to this project will first go to covering those costs first. -Licenses and contributions for pretrained models are designed to be flexible so please review the information for a particular model before using it. +Licenses and contributions for pretrained models is designed to be flexible so please review the information for a particular model before using it. + +Buy me a coffee: https://www.buymeacoffee.com/duskvirkus + +Tezos Wallet Address: tz1PeE5NQyyjyJdnyqyKdtFN27TvN9j3ZcUe - Only send tezos to this wallet. ## About Branches @@ -27,6 +33,35 @@ Licenses and contributions for pretrained models are designed to be flexible so | `devel` | [![CI](https://github.com/duskvirkus/alias-free-gan-pytorch-lightning/actions/workflows/ci.yml/badge.svg?branch=devel)](https://github.com/duskvirkus/alias-free-gan-pytorch-lightning/actions/workflows/ci.yml) | ![gpu pytest on gcloud](https://badgen.net/github/checks/duskvirkus/alias-free-gan/devel/gpu-pytest-on-gcloud?label=GPU%20devel) | ![tpus pytest on gcloud](https://badgen.net/github/checks/duskvirkus/alias-free-gan/devel/tpus-pytest-on-gcloud?label=TPUs%20devel) | | `stable` | [![CI](https://github.com/duskvirkus/alias-free-gan-pytorch-lightning/actions/workflows/ci.yml/badge.svg?branch=stabel)](https://github.com/duskvirkus/alias-free-gan-pytorch-lightning/actions/workflows/ci.yml) | ![gpu pytest on gcloud](https://badgen.net/github/checks/duskvirkus/alias-free-gan/stabel/gpu-pytest-on-gcloud?label=GPU%20stabel) | ![tpus pytest on gcloud](https://badgen.net/github/checks/duskvirkus/alias-free-gan/stabel/tpus-pytest-on-gcloud?label=TPUs%20stabel) | +## Examples + +![training example gif](assets/examples/aliasfree-training-painterly-faces.gif) + +Example of animation made from samples generated in training process. + +___ + +![linear interpolation example](assets/examples/first-interpolation-aliasfree-duskvirkus.gif) + +Example of linear interpolation between two random seeds. + +___ + +![circular loop example](assets/examples/aliasfree-circular-painterly-faces-duskvirkus.gif) + +Example of circular loop interpolation. + +___ + +![noise loop example](assets/examples/aliasfree-noiseloop-painterly-faces-duskvirkus.gif) + +Example of open simplex noise loop interpolation. + +___ + +![rosinality translate example](assets/examples/aliasfree-ros-translate-painterly-faces.gif) + +Example output from converted rosinality translate script. ## Supported Model Architectures Below is a list of supported model architecture. The hope is to support NVlabs code when it comes out. @@ -57,13 +92,9 @@ Below is a list of supported model architecture. The hope is to support NVlabs c [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/duskvirkus/alias-free-gan/blob/devel/notebooks/GPU_Inference_Alias_Free_GAN.ipynb) -### TPU Colab Training Notebook - -coming soon - -### Note about TPU training +### TPU Notebooks -TPU training exists currently exist simply as a proof of concept however little optimization has been done yet so it does not appear to be significantly faster than GPU training on google colab. +Coming at some point in the future. ## Pre-trained Models @@ -71,9 +102,14 @@ See [pretrained_models.json](https://github.com/duskvirkus/alias-free-gan/blob/d Use `model_name` as `--resume_from` argument for trainer.py. -Pretrained models will automatically download using wget but here's link's if that isn't working for some reason. +Pretrained models will automatically download using wget but here's link's if that isn't working for some reason. Place them under a `pretrained` directory in project root directory. + +### rosinality-ffhq-800k + +Description: A 256 model trained by rosinality on ffhq dataset for 800k steps at a batch size of 16. -rosinality-ffhq-800k: https://aliasfreegan.sfo3.cdn.digitaloceanspaces.com/rosinality-ffhq-800k.pt + - Main: https://aliasfreegan.sfo3.cdn.digitaloceanspaces.com/rosinality-ffhq-800k.pt + - Google Drive: https://drive.google.com/file/d/15B_Pz-38eIiUBCiVbgPOcv-TIoT7nc5e ## Contributing @@ -86,13 +122,12 @@ You can do so by creating a pull request to the `stable` branch. Add information ```json { "model_name": "model-name-no-spaces-no-file-extension", - "creator": "github username example:'githubusername'", + "creator": "github username", "model_architecture": "see model architecture section", - "description": "Describe your project.", + "description": "Describe your model. What was it trained on? How long was it trained for? Feel free to include links to make donations and suggested donation amounts. Also include licence information such as creative commons or other licencees.", "model_size": 512, - "gdown": "Please include a link to download your model in you're pull request and I will update this", - "sha1": "If you know how to make a sha1 hash then you can fill this out if not leave this blank.", - "licence_and_compensation_information": "Please put any licencing and compensation information here you would like to include. An example could be: 'This model is under a CC-BY-NC-SA Licence. Please send $5 for transfer learning off of it on paypal to name@example.com. Contact me at name@example.com if you would like to use it in a commercial project.'" + "wget_url": "Please include a link to download your model in you're pull request and I will update this", + "sha1": "If you know how to make a sha1 hash then you can fill this out if not leave this blank." } ``` diff --git a/assets/examples/aliasfree-circular-painterly-faces-duskvirkus.gif b/assets/examples/aliasfree-circular-painterly-faces-duskvirkus.gif new file mode 100644 index 0000000..e5dd193 Binary files /dev/null and b/assets/examples/aliasfree-circular-painterly-faces-duskvirkus.gif differ diff --git a/assets/examples/aliasfree-noiseloop-painterly-faces-duskvirkus.gif b/assets/examples/aliasfree-noiseloop-painterly-faces-duskvirkus.gif new file mode 100644 index 0000000..febeda4 Binary files /dev/null and b/assets/examples/aliasfree-noiseloop-painterly-faces-duskvirkus.gif differ diff --git a/assets/examples/aliasfree-ros-translate-painterly-faces.gif b/assets/examples/aliasfree-ros-translate-painterly-faces.gif new file mode 100644 index 0000000..2227225 Binary files /dev/null and b/assets/examples/aliasfree-ros-translate-painterly-faces.gif differ diff --git a/assets/examples/aliasfree-training-painterly-faces.gif b/assets/examples/aliasfree-training-painterly-faces.gif new file mode 100644 index 0000000..b0b5779 Binary files /dev/null and b/assets/examples/aliasfree-training-painterly-faces.gif differ diff --git a/assets/examples/first-interpolation-aliasfree-duskvirkus.gif b/assets/examples/first-interpolation-aliasfree-duskvirkus.gif new file mode 100644 index 0000000..62370c2 Binary files /dev/null and b/assets/examples/first-interpolation-aliasfree-duskvirkus.gif differ diff --git a/assets/pip-freeze-logs/v1_0_0-colab-pip-freeze-log.txt b/assets/pip-freeze-logs/v1_0_0-colab-pip-freeze-log.txt new file mode 100644 index 0000000..bf82b36 --- /dev/null +++ b/assets/pip-freeze-logs/v1_0_0-colab-pip-freeze-log.txt @@ -0,0 +1,409 @@ +absl-py==0.12.0 +aiohttp==3.7.4.post0 +alabaster==0.7.12 +albumentations==0.1.12 +altair==4.1.0 +appdirs==1.4.4 +argcomplete==1.12.3 +argon2-cffi==20.1.0 +arviz==0.11.2 +astor==0.8.1 +astropy==4.3.1 +astunparse==1.6.3 +async-timeout==3.0.1 +atari-py==0.2.9 +atomicwrites==1.4.0 +attrs==21.2.0 +audioread==2.1.9 +autograd==1.3 +Babel==2.9.1 +backcall==0.2.0 +beautifulsoup4==4.6.3 +bleach==4.0.0 +blis==0.4.1 +bokeh==2.3.3 +Bottleneck==1.3.2 +branca==0.4.2 +bs4==0.0.1 +CacheControl==0.12.6 +cached-property==1.5.2 +cachetools==4.2.2 +catalogue==1.0.0 +certifi==2021.5.30 +cffi==1.14.6 +cftime==1.5.0 +chardet==3.0.4 +charset-normalizer==2.0.4 +clang==5.0 +click==7.1.2 +cloudpickle==1.3.0 +cmake==3.12.0 +cmdstanpy==0.9.5 +colorcet==2.0.6 +colorlover==0.3.0 +community==1.0.0b1 +configparser==5.0.2 +contextlib2==0.5.5 +convertdate==2.3.2 +coverage==3.7.1 +coveralls==0.5 +crcmod==1.7 +cufflinks==0.17.3 +cupy-cuda101==9.1.0 +cvxopt==1.2.6 +cvxpy==1.0.31 +cycler==0.10.0 +cymem==2.0.5 +Cython==0.29.24 +daft==0.0.4 +dask==2.12.0 +datascience==0.10.6 +debugpy==1.0.0 +decorator==4.4.2 +defusedxml==0.7.1 +descartes==1.1.0 +dill==0.3.4 +distributed==1.25.3 +dlib @ file:///dlib-19.18.0-cp37-cp37m-linux_x86_64.whl +dm-tree==0.1.6 +docker-pycreds==0.4.0 +docopt==0.6.2 +docutils==0.17.1 +dopamine-rl==1.0.5 +earthengine-api==0.1.278 +easydict==1.9 +ecos==2.0.7.post1 +editdistance==0.5.3 +en-core-web-sm @ https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-2.2.5/en_core_web_sm-2.2.5.tar.gz +entrypoints==0.3 +ephem==4.0.0.2 +et-xmlfile==1.1.0 +fa2==0.3.5 +fastai==1.0.61 +fastdtw==0.3.4 +fastprogress==1.0.0 +fastrlock==0.6 +fbprophet==0.7.1 +feather-format==0.4.1 +filelock==3.0.12 +firebase-admin==4.4.0 +fix-yahoo-finance==0.0.22 +Flask==1.1.4 +flatbuffers==1.12 +folium==0.8.3 +fsspec==2021.7.0 +future==0.18.2 +gast==0.4.0 +GDAL==2.2.2 +gdown==3.6.4 +gensim==3.6.0 +geographiclib==1.52 +geopy==1.17.0 +gin-config==0.4.0 +gitdb==4.0.7 +GitPython==3.1.18 +glob2==0.7 +google==2.0.3 +google-api-core==1.26.3 +google-api-python-client==1.12.8 +google-auth==1.34.0 +google-auth-httplib2==0.0.4 +google-auth-oauthlib==0.4.5 +google-cloud-bigquery==1.21.0 +google-cloud-bigquery-storage==1.1.0 +google-cloud-core==1.0.3 +google-cloud-datastore==1.8.0 +google-cloud-firestore==1.7.0 +google-cloud-language==1.2.0 +google-cloud-storage==1.18.1 +google-cloud-translate==1.5.0 +google-colab @ file:///colabtools/dist/google-colab-1.0.0.tar.gz +google-pasta==0.2.0 +google-resumable-media==0.4.1 +googleapis-common-protos==1.53.0 +googledrivedownloader==0.4 +graphviz==0.10.1 +greenlet==1.1.1 +grpcio==1.39.0 +gspread==3.0.1 +gspread-dataframe==3.0.8 +gym==0.17.3 +h5py==3.1.0 +HeapDict==1.0.1 +hijri-converter==2.1.3 +holidays==0.10.5.2 +holoviews==1.14.5 +html5lib==1.0.1 +httpimport==0.5.18 +httplib2==0.17.4 +httplib2shim==0.0.3 +humanize==0.5.1 +hyperopt==0.1.2 +ideep4py==2.0.0.post3 +idna==2.10 +imageio==2.4.1 +imagesize==1.2.0 +imbalanced-learn==0.4.3 +imblearn==0.0 +imgaug==0.2.9 +importlib-metadata==4.6.4 +importlib-resources==5.2.2 +imutils==0.5.4 +inflect==2.1.0 +iniconfig==1.1.1 +intel-openmp==2021.3.0 +intervaltree==2.1.0 +ipykernel==4.10.1 +ipython==5.5.0 +ipython-genutils==0.2.0 +ipython-sql==0.3.9 +ipywidgets==7.6.3 +itsdangerous==1.1.0 +jax==0.2.19 +jaxlib @ https://storage.googleapis.com/jax-releases/cuda110/jaxlib-0.1.70+cuda110-cp37-none-manylinux2010_x86_64.whl +jdcal==1.4.1 +jedi==0.18.0 +jieba==0.42.1 +Jinja2==2.11.3 +joblib==1.0.1 +jpeg4py==0.1.4 +jsonschema==2.6.0 +jupyter==1.0.0 +jupyter-client==5.3.5 +jupyter-console==5.2.0 +jupyter-core==4.7.1 +jupyterlab-pygments==0.1.2 +jupyterlab-widgets==1.0.0 +kaggle==1.5.12 +kapre==0.3.5 +keras==2.6.0 +Keras-Preprocessing==1.1.2 +keras-vis==0.4.1 +kiwisolver==1.3.1 +korean-lunar-calendar==0.2.1 +librosa==0.8.1 +lightgbm==2.2.3 +llvmlite==0.34.0 +lmdb==0.99 +LunarCalendar==0.0.9 +lxml==4.2.6 +Markdown==3.3.4 +MarkupSafe==2.0.1 +matplotlib==3.2.2 +matplotlib-inline==0.1.2 +matplotlib-venn==0.11.6 +missingno==0.5.0 +mistune==0.8.4 +mizani==0.6.0 +mkl==2019.0 +mlxtend==0.14.0 +more-itertools==8.8.0 +moviepy==0.2.3.5 +mpmath==1.2.1 +msgpack==1.0.2 +multidict==5.1.0 +multiprocess==0.70.12.2 +multitasking==0.0.9 +murmurhash==1.0.5 +music21==5.5.0 +natsort==5.5.0 +nbclient==0.5.4 +nbconvert==5.6.1 +nbformat==5.1.3 +nest-asyncio==1.5.1 +netCDF4==1.5.7 +networkx==2.6.2 +nibabel==3.0.2 +ninja==1.10.2 +nltk==3.2.5 +notebook==5.3.1 +numba==0.51.2 +numexpr==2.7.3 +numpy==1.19.5 +nvidia-ml-py3==7.352.0 +oauth2client==4.1.3 +oauthlib==3.1.1 +okgrade==0.4.3 +opencv-contrib-python==4.1.2.30 +opencv-python==4.1.2.30 +opencv-python-headless==4.5.3.56 +openpyxl==2.5.9 +opensimplex==0.3 +opt-einsum==3.3.0 +osqp==0.6.2.post0 +packaging==21.0 +palettable==3.3.0 +pandas==1.1.5 +pandas-datareader==0.9.0 +pandas-gbq==0.13.3 +pandas-profiling==1.4.1 +pandocfilters==1.4.3 +panel==0.12.1 +param==1.11.1 +parso==0.8.2 +pathlib==1.0.1 +pathtools==0.1.2 +patsy==0.5.1 +pep517==0.11.0 +pexpect==4.8.0 +pickleshare==0.7.5 +Pillow==7.1.2 +pip-tools==6.2.0 +plac==1.1.3 +plotly==4.4.1 +plotnine==0.6.0 +pluggy==0.7.1 +pooch==1.4.0 +portpicker==1.3.9 +prefetch-generator==1.0.1 +preshed==3.0.5 +prettytable==2.1.0 +progressbar2==3.38.0 +prometheus-client==0.11.0 +promise==2.3 +prompt-toolkit==1.0.18 +protobuf==3.17.3 +psutil==5.4.8 +psycopg2==2.7.6.1 +ptyprocess==0.7.0 +py==1.10.0 +pyarrow==3.0.0 +pyasn1==0.4.8 +pyasn1-modules==0.2.8 +pycocotools==2.0.2 +pycparser==2.20 +pyct==0.4.8 +pydantic==1.8.2 +pydata-google-auth==1.2.0 +pyDeprecate==0.3.1 +pydot==1.3.0 +pydot-ng==2.0.0 +pydotplus==2.0.2 +PyDrive==1.3.1 +pyemd==0.5.1 +pyerfa==2.0.0 +pyglet==1.5.0 +Pygments==2.6.1 +pygobject==3.26.1 +pyhocon==0.3.58 +pymc3==3.11.2 +PyMeeus==0.5.11 +pymongo==3.12.0 +pymystem3==0.2.0 +PyOpenGL==3.1.5 +pyparsing==2.4.7 +pyrsistent==0.18.0 +pysndfile==1.3.8 +PySocks==1.7.1 +pystan==2.19.1.1 +pytest==3.6.4 +python-apt==0.0.0 +python-chess==0.23.11 +python-dateutil==2.8.2 +python-louvain==0.15 +python-slugify==5.0.2 +python-utils==2.5.6 +pytorch-lightning==1.4.2 +pytorch-lightning-bolts==0.3.2 +pytz==2018.9 +pyviz-comms==2.1.0 +PyWavelets==1.1.1 +PyYAML==5.4.1 +pyzmq==22.2.1 +qdldl==0.1.5.post0 +qtconsole==5.1.1 +QtPy==1.10.0 +regex==2019.12.20 +requests==2.23.0 +requests-oauthlib==1.3.0 +resampy==0.2.2 +retrying==1.3.3 +rpy2==3.4.5 +rsa==4.7.2 +scikit-image==0.16.2 +scikit-learn==0.22.2.post1 +scipy==1.4.1 +screen-resolution-extra==0.0.0 +scs==2.1.4 +seaborn==0.11.1 +semver==2.13.0 +Send2Trash==1.8.0 +sentry-sdk==1.3.1 +setuptools-git==1.2 +Shapely==1.7.1 +shortuuid==1.0.1 +simplegeneric==0.8.1 +six==1.15.0 +sklearn==0.0 +sklearn-pandas==1.8.0 +smart-open==5.1.0 +smmap==4.0.0 +snowballstemmer==2.1.0 +sortedcontainers==2.4.0 +SoundFile==0.10.3.post1 +spacy==2.2.4 +Sphinx==1.8.5 +sphinxcontrib-serializinghtml==1.1.5 +sphinxcontrib-websupport==1.2.4 +SQLAlchemy==1.4.22 +sqlparse==0.4.1 +srsly==1.0.5 +statsmodels==0.10.2 +subprocess32==3.5.4 +sympy==1.7.1 +tables==3.4.4 +tabulate==0.8.9 +tblib==1.7.0 +tensorboard==2.6.0 +tensorboard-data-server==0.6.1 +tensorboard-plugin-wit==1.8.0 +tensorflow @ file:///tensorflow-2.6.0-cp37-cp37m-linux_x86_64.whl +tensorflow-datasets==4.0.1 +tensorflow-estimator==2.6.0 +tensorflow-gcs-config==2.6.0 +tensorflow-hub==0.12.0 +tensorflow-metadata==1.2.0 +tensorflow-probability==0.13.0 +termcolor==1.1.0 +terminado==0.11.0 +testpath==0.5.0 +text-unidecode==1.3 +textblob==0.15.3 +Theano-PyMC==1.1.2 +thinc==7.4.0 +tifffile==2021.8.8 +toml==0.10.2 +tomli==1.2.1 +toolz==0.11.1 +torch @ https://download.pytorch.org/whl/cu102/torch-1.9.0%2Bcu102-cp37-cp37m-linux_x86_64.whl +torchmetrics==0.5.0 +torchsummary==1.5.1 +torchtext==0.10.0 +torchvision @ https://download.pytorch.org/whl/cu102/torchvision-0.10.0%2Bcu102-cp37-cp37m-linux_x86_64.whl +tornado==5.1.1 +tqdm==4.62.0 +traitlets==5.0.5 +tweepy==3.10.0 +typeguard==2.7.1 +typing-extensions==3.7.4.3 +tzlocal==1.5.1 +uritemplate==3.0.1 +urllib3==1.24.3 +vega-datasets==0.9.0 +wandb==0.12.0 +wasabi==0.8.2 +wcwidth==0.2.5 +webencodings==0.5.1 +Werkzeug==1.0.1 +widgetsnbextension==3.5.1 +wordcloud==1.5.0 +wrapt==1.12.1 +xarray==0.18.2 +xgboost==0.90 +xkit==0.0.0 +xlrd==1.1.0 +xlwt==1.3.0 +yarl==1.6.3 +yellowbrick==0.9.1 +zict==2.0.0 +zipp==3.5.0 diff --git a/notebooks/GPU_Inference_Alias_Free_GAN.ipynb b/notebooks/GPU_Inference_Alias_Free_GAN.ipynb index 2b90d4f..dd286bd 100644 --- a/notebooks/GPU_Inference_Alias_Free_GAN.ipynb +++ b/notebooks/GPU_Inference_Alias_Free_GAN.ipynb @@ -1,6 +1,6 @@ { "nbformat": 4, - "nbformat_minor": 0, + "nbformat_minor": 2, "metadata": { "colab": { "name": "GPU_Inference_Alias_Free_GAN.ipynb", @@ -23,19 +23,16 @@ "cells": [ { "cell_type": "markdown", + "source": [ + "\"Open" + ], "metadata": { "id": "view-in-github", "colab_type": "text" - }, - "source": [ - "\"Open" - ] + } }, { "cell_type": "markdown", - "metadata": { - "id": "d9FLSZsEo44l" - }, "source": [ "# GPU Inference - Alias-Free GAN\n", "\n", @@ -44,76 +41,73 @@ "This is a notebook for generating images and latent space walks with Alias-Free GAN on a Colab GPU instance.\n", "\n", "Repository: https://github.com/duskvirkus/alias-free-gan" - ] + ], + "metadata": { + "id": "d9FLSZsEo44l" + } }, { "cell_type": "markdown", - "metadata": { - "id": "s5awrcU8pNA7" - }, "source": [ "## GPU check\n", "\n", "If this fails change the runtime type in Runtime > Change runtime type > Select GPU." - ] + ], + "metadata": { + "id": "s5awrcU8pNA7" + } }, { "cell_type": "code", - "metadata": { - "id": "v34gmaX8haFi", - "colab": { - "base_uri": "https://localhost:8080/" - }, - "outputId": "99d50bfb-92a2-43ef-8ffa-fc755bf4fa93" - }, + "execution_count": 1, "source": [ "!nvidia-smi -L" ], - "execution_count": 1, "outputs": [ { "output_type": "stream", + "name": "stdout", "text": [ "GPU 0: Tesla P100-PCIE-16GB (UUID: GPU-a508f6d5-c4b3-f5fc-ffb7-f635f3a12a41)\n" - ], - "name": "stdout" + ] } - ] + ], + "metadata": { + "id": "v34gmaX8haFi", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "99d50bfb-92a2-43ef-8ffa-fc755bf4fa93" + } }, { "cell_type": "markdown", - "metadata": { - "id": "oAOXsX-FpbPZ" - }, "source": [ "## Clone Repository" - ] + ], + "metadata": { + "id": "oAOXsX-FpbPZ" + } }, { "cell_type": "code", - "metadata": { - "id": "CuydfwVQpan6", - "colab": { - "base_uri": "https://localhost:8080/" - }, - "outputId": "47e8d5be-1ef4-448f-adc1-b789ec4d2eb1" - }, + "execution_count": 2, "source": [ "import os\n", "\n", "repo_name = 'alias-free-gan'\n", "git_repo = 'https://github.com/duskvirkus/alias-free-gan.git'\n", - "branch_name = 'devel'\n", + "branch_name = 'stable'\n", "\n", "working_dir = os.path.join('/content', repo_name)\n", "\n", "!git clone --branch {branch_name} {git_repo}\n", "%cd {repo_name}" ], - "execution_count": 2, "outputs": [ { "output_type": "stream", + "name": "stdout", "text": [ "Cloning into 'alias-free-gan'...\n", "remote: Enumerating objects: 1247, done.\u001b[K\n", @@ -123,84 +117,88 @@ "Receiving objects: 100% (1247/1247), 73.53 MiB | 32.30 MiB/s, done.\n", "Resolving deltas: 100% (618/618), done.\n", "/content/alias-free-gan\n" - ], - "name": "stdout" + ] } - ] + ], + "metadata": { + "id": "CuydfwVQpan6", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "47e8d5be-1ef4-448f-adc1-b789ec4d2eb1" + } }, { "cell_type": "markdown", - "metadata": { - "id": "nh3SSwEwp4jX" - }, "source": [ "## Connect Drive\n", "\n", "Recomended but not nesscary connect to drive to make accessing models and saving outputs easier. If you don't do this you'll have to upload and download from your colab session." - ] + ], + "metadata": { + "id": "nh3SSwEwp4jX" + } }, { "cell_type": "code", - "metadata": { - "id": "jONkPM9fqYDZ", - "colab": { - "base_uri": "https://localhost:8080/" - }, - "outputId": "2ee130d2-a629-4b55-e04e-0a4a883fc660" - }, + "execution_count": 3, "source": [ "from google.colab import drive\n", "drive.mount('/content/drive')" ], - "execution_count": 3, "outputs": [ { "output_type": "stream", + "name": "stdout", "text": [ "Mounted at /content/drive\n" - ], - "name": "stdout" + ] } - ] + ], + "metadata": { + "id": "jONkPM9fqYDZ", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "2ee130d2-a629-4b55-e04e-0a4a883fc660" + } }, { "cell_type": "markdown", - "metadata": { - "id": "glk2ycNtqgXt" - }, "source": [ "## Install Dependencies\n", "\n", "You will likely see warnings or errors. Ignore these unless you're having trouble in other cells then include the output if you file an issue.\n", "\n", "Issue Link: https://github.com/duskvirkus/alias-free-gan/issues/new" - ] + ], + "metadata": { + "id": "glk2ycNtqgXt" + } }, { "cell_type": "code", - "metadata": { - "id": "_LfvT2UPqjOJ" - }, + "execution_count": null, "source": [ "!python install.py" ], - "execution_count": null, - "outputs": [] + "outputs": [], + "metadata": { + "id": "_LfvT2UPqjOJ" + } }, { "cell_type": "markdown", - "metadata": { - "id": "zlKPcoS3rIRf" - }, "source": [ "## Set Model and Save Location" - ] + ], + "metadata": { + "id": "zlKPcoS3rIRf" + } }, { "cell_type": "code", - "metadata": { - "id": "8FUCrvzHrHlT" - }, + "execution_count": 5, "source": [ "model_path = '/content/drive/MyDrive/colab-gpu-alias-free/alias-free-gan/results/training-000005/000145-epoch-checkpoint.pt'\n", "model_size = 256 # 256, 512, or 1024\n", @@ -208,25 +206,25 @@ "import os\n", "os.makedirs(out_base_path, exist_ok=True)" ], - "execution_count": 5, - "outputs": [] + "outputs": [], + "metadata": { + "id": "8FUCrvzHrHlT" + } }, { "cell_type": "markdown", - "metadata": { - "id": "ufjH87Y7rV9h" - }, "source": [ "## Setup Output Counter\n", "\n", "This is will help avoid overwriting some generated files by accident." - ] + ], + "metadata": { + "id": "ufjH87Y7rV9h" + } }, { "cell_type": "code", - "metadata": { - "id": "-MIcXlsXrZt7" - }, + "execution_count": 6, "source": [ "def get_output_count():\n", " global output_count\n", @@ -235,40 +233,36 @@ "\n", "output_count = -1" ], - "execution_count": 6, - "outputs": [] + "outputs": [], + "metadata": { + "id": "-MIcXlsXrZt7" + } }, { "cell_type": "markdown", - "metadata": { - "id": "g1Y1KzRGsDSq" - }, "source": [ "## Generate Single Images\n", "\n", "This will generate a folder of images with a seed range. These seeds can be used in the next section for interpolations. Checkout the help for more information on seed values." - ] + ], + "metadata": { + "id": "g1Y1KzRGsDSq" + } }, { "cell_type": "code", - "metadata": { - "id": "9L88V3--tLxG" - }, + "execution_count": null, "source": [ "!python scripts/generate_images.py --help" ], - "execution_count": null, - "outputs": [] + "outputs": [], + "metadata": { + "id": "9L88V3--tLxG" + } }, { "cell_type": "code", - "metadata": { - "id": "FKb-GsTmsUke", - "colab": { - "base_uri": "https://localhost:8080/" - }, - "outputId": "ca100f94-30f7-453d-ab1a-192d9b02615c" - }, + "execution_count": null, "source": [ "out_dir = os.path.join(out_base_path, 'images' + get_output_count())\n", "!python scripts/generate_images.py \\\n", @@ -277,10 +271,10 @@ " --outdir {out_dir} \\\n", " --seed_stop 9" ], - "execution_count": null, "outputs": [ { "output_type": "stream", + "name": "stdout", "text": [ "Using Alias-Free GAN version: 1.0.0\n", "GPU available: True, used: True\n", @@ -310,16 +304,19 @@ "Generating image for seed 6 at truncation 0.750000 and saving to /content/drive/MyDrive/alias-free-experiments/testing/training-5-epoch-145/images-0/seed0006.png\n", "Generating image for seed 7 at truncation 0.750000 and saving to /content/drive/MyDrive/alias-free-experiments/testing/training-5-epoch-145/images-0/seed0007.png\n", "Generating image for seed 8 at truncation 0.750000 and saving to /content/drive/MyDrive/alias-free-experiments/testing/training-5-epoch-145/images-0/seed0008.png\n" - ], - "name": "stdout" + ] } - ] + ], + "metadata": { + "id": "FKb-GsTmsUke", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "ca100f94-30f7-453d-ab1a-192d9b02615c" + } }, { "cell_type": "markdown", - "metadata": { - "id": "4Zxj8uGAuUDn" - }, "source": [ "## Generate Interpolation\n", "\n", @@ -343,28 +340,25 @@ "\n", "- As always checkout the help for more information on all available options.\n", "- This automatically compensates for the distance between seed to make animation smoother." - ] + ], + "metadata": { + "id": "4Zxj8uGAuUDn" + } }, { "cell_type": "code", - "metadata": { - "id": "ywSskK58u0FD" - }, + "execution_count": null, "source": [ "!python scripts/generate_interpolation.py --help" ], - "execution_count": null, - "outputs": [] + "outputs": [], + "metadata": { + "id": "ywSskK58u0FD" + } }, { "cell_type": "code", - "metadata": { - "id": "yE5PA5t5upXO", - "colab": { - "base_uri": "https://localhost:8080/" - }, - "outputId": "ead088a2-3779-4be1-dcd7-a89809378814" - }, + "execution_count": null, "source": [ "out_dir = os.path.join(out_base_path, 'interpolate' + get_output_count())\n", "!python scripts/generate_interpolation.py \\\n", @@ -373,10 +367,10 @@ " --outdir {out_dir} \\\n", " --frames 48" ], - "execution_count": null, "outputs": [ { "output_type": "stream", + "name": "stdout", "text": [ "Using Alias-Free GAN version: 1.0.0\n", "GPU available: True, used: True\n", @@ -448,16 +442,19 @@ "Generate from vectors progress: 45/48\n", "Generate from vectors progress: 46/48\n", "Generate from vectors progress: 47/48\n" - ], - "name": "stdout" + ] } - ] + ], + "metadata": { + "id": "yE5PA5t5upXO", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "ead088a2-3779-4be1-dcd7-a89809378814" + } }, { "cell_type": "markdown", - "metadata": { - "id": "WRbYCuMyxPd4" - }, "source": [ "## Circular Interpolation\n", "\n", @@ -472,28 +469,25 @@ "**Notes:**\n", "\n", "- Seed values are used diffently from generate images and interpolate." - ] + ], + "metadata": { + "id": "WRbYCuMyxPd4" + } }, { "cell_type": "code", - "metadata": { - "id": "jptQsC63y2Y0" - }, + "execution_count": null, "source": [ "!python scripts/generate_interpolation.py --help" ], - "execution_count": null, - "outputs": [] + "outputs": [], + "metadata": { + "id": "jptQsC63y2Y0" + } }, { "cell_type": "code", - "metadata": { - "id": "YsBl9maGxwrY", - "colab": { - "base_uri": "https://localhost:8080/" - }, - "outputId": "82288435-7a21-4fb2-c6a5-1972e7e7fded" - }, + "execution_count": null, "source": [ "out_dir = os.path.join(out_base_path, 'circular' + get_output_count())\n", "!python scripts/generate_interpolation.py \\\n", @@ -504,10 +498,10 @@ " --frames 48 \\\n", " --diameter 2.0" ], - "execution_count": null, "outputs": [ { "output_type": "stream", + "name": "stdout", "text": [ "Using Alias-Free GAN version: 1.0.0\n", "GPU available: True, used: True\n", @@ -579,16 +573,19 @@ "Generate from vectors progress: 45/48\n", "Generate from vectors progress: 46/48\n", "Generate from vectors progress: 47/48\n" - ], - "name": "stdout" + ] } - ] + ], + "metadata": { + "id": "YsBl9maGxwrY", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "82288435-7a21-4fb2-c6a5-1972e7e7fded" + } }, { "cell_type": "markdown", - "metadata": { - "id": "q3Pu1KZ0zIAA" - }, "source": [ "## Simplex Noise\n", "\n", @@ -603,28 +600,25 @@ "**Notes:**\n", "\n", "- Seed values are used diffently from generate images and interpolate." - ] + ], + "metadata": { + "id": "q3Pu1KZ0zIAA" + } }, { "cell_type": "code", - "metadata": { - "id": "bZmVVSQDzG37" - }, + "execution_count": null, "source": [ "!python scripts/generate_interpolation.py --help" ], - "execution_count": null, - "outputs": [] + "outputs": [], + "metadata": { + "id": "bZmVVSQDzG37" + } }, { "cell_type": "code", - "metadata": { - "id": "R4mckIeEz5qh", - "colab": { - "base_uri": "https://localhost:8080/" - }, - "outputId": "0b92b717-6e4d-4e86-c40d-2d70e3aaf630" - }, + "execution_count": null, "source": [ "out_dir = os.path.join(out_base_path, 'simplex_noise' + get_output_count())\n", "!python scripts/generate_interpolation.py \\\n", @@ -635,10 +629,10 @@ " --frames 48 \\\n", " --diameter 0.3" ], - "execution_count": null, "outputs": [ { "output_type": "stream", + "name": "stdout", "text": [ "Using Alias-Free GAN version: 1.0.0\n", "GPU available: True, used: True\n", @@ -710,16 +704,19 @@ "Generate from vectors progress: 45/48\n", "Generate from vectors progress: 46/48\n", "Generate from vectors progress: 47/48\n" - ], - "name": "stdout" + ] } - ] + ], + "metadata": { + "id": "R4mckIeEz5qh", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "0b92b717-6e4d-4e86-c40d-2d70e3aaf630" + } }, { "cell_type": "markdown", - "metadata": { - "id": "Hyc3vsCC0HIS" - }, "source": [ "## Repeat / Load Interpolation\n", "\n", @@ -733,28 +730,25 @@ " ## Values in these numpy.arrays range between 0 and 1\n", " })\n", "```" - ] + ], + "metadata": { + "id": "Hyc3vsCC0HIS" + } }, { "cell_type": "code", - "metadata": { - "id": "GCsnEGkO0Gow" - }, + "execution_count": null, "source": [ "!python scripts/generate_interpolation.py --help" ], - "execution_count": null, - "outputs": [] + "outputs": [], + "metadata": { + "id": "GCsnEGkO0Gow" + } }, { "cell_type": "code", - "metadata": { - "id": "2lIpPNi711XR", - "colab": { - "base_uri": "https://localhost:8080/" - }, - "outputId": "25de0c0e-d199-4607-997f-092409670dc7" - }, + "execution_count": null, "source": [ "out_dir = os.path.join(out_base_path, 'z_vector_load' + get_output_count())\n", "!python scripts/generate_interpolation.py \\\n", @@ -764,10 +758,10 @@ " --outdir {out_dir} \\\n", " --path_to_z_vectors '/content/drive/MyDrive/alias-free-experiments/testing/training-5-epoch-145/simplex_noise-3/z_vectors.pt'" ], - "execution_count": null, "outputs": [ { "output_type": "stream", + "name": "stdout", "text": [ "Using Alias-Free GAN version: 1.0.0\n", "GPU available: True, used: True\n", @@ -838,44 +832,44 @@ "Generate from vectors progress: 45/48\n", "Generate from vectors progress: 46/48\n", "Generate from vectors progress: 47/48\n" - ], - "name": "stdout" + ] } - ] + ], + "metadata": { + "id": "2lIpPNi711XR", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "25de0c0e-d199-4607-997f-092409670dc7" + } }, { "cell_type": "markdown", - "metadata": { - "id": "e364fod5Ap34" - }, "source": [ "## Rosinality Translate Script\n", "\n", "Creates animation with translation on the same latent.\n", "\n", "Run the first cell to install latest version of ffmpeg for the video codacs. Required if using `--video True` argument." - ] + ], + "metadata": { + "id": "e364fod5Ap34" + } }, { "cell_type": "code", - "metadata": { - "id": "VSR4ZhHqKqw3" - }, + "execution_count": null, "source": [ "!python scripts/rosinality_generate.py --help" ], - "execution_count": null, - "outputs": [] + "outputs": [], + "metadata": { + "id": "VSR4ZhHqKqw3" + } }, { "cell_type": "code", - "metadata": { - "colab": { - "base_uri": "https://localhost:8080/" - }, - "id": "alSYMck-ApYr", - "outputId": "4265eaa4-247a-4380-8f05-225b3dc90ab8" - }, + "execution_count": 8, "source": [ "out_dir = os.path.join(out_base_path, 'rosinality_translate' + get_output_count())\n", "!python scripts/rosinality_generate.py \\\n", @@ -886,10 +880,10 @@ " --frames True \\\n", " {model_path}" ], - "execution_count": 8, "outputs": [ { "output_type": "stream", + "name": "stdout", "text": [ "Using Alias-Free GAN version: 1.0.0\n", "GPU available: True, used: True\n", @@ -913,10 +907,16 @@ "OpenCV: FFMPEG: tag 0x5634504d/'MP4V' is not supported with codec id 12 and format 'mp4 / MP4 (MPEG-4 Part 14)'\n", "OpenCV: FFMPEG: fallback to use tag 0x7634706d/'mp4v'\n", "100% 120/120 [00:00<00:00, 1022.33it/s]\n" - ], - "name": "stdout" + ] } - ] + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "alSYMck-ApYr", + "outputId": "4265eaa4-247a-4380-8f05-225b3dc90ab8" + } } ] } \ No newline at end of file diff --git a/notebooks/GPU_Training_Alias_Free_GAN.ipynb b/notebooks/GPU_Training_Alias_Free_GAN.ipynb index 6a012ce..b971b91 100644 --- a/notebooks/GPU_Training_Alias_Free_GAN.ipynb +++ b/notebooks/GPU_Training_Alias_Free_GAN.ipynb @@ -1,6 +1,6 @@ { "nbformat": 4, - "nbformat_minor": 0, + "nbformat_minor": 2, "metadata": { "colab": { "name": "GPU_Training-Alias-Free_GAN.ipynb", @@ -21,19 +21,16 @@ "cells": [ { "cell_type": "markdown", + "source": [ + "\"Open" + ], "metadata": { "id": "view-in-github", "colab_type": "text" - }, - "source": [ - "\"Open" - ] + } }, { "cell_type": "markdown", - "metadata": { - "id": "iooMpU0wSq1v" - }, "source": [ "# GPU Training - Alias-Free GAN\n", "by duskvirkus\n", @@ -41,103 +38,101 @@ "This is a notebook for training Alias-Free GAN on a Colab GPU instance.\n", "\n", "Repository: https://github.com/duskvirkus/alias-free-gan" - ] + ], + "metadata": { + "id": "iooMpU0wSq1v" + } }, { "cell_type": "markdown", - "metadata": { - "id": "f3ygaIX_TP7A" - }, "source": [ "# GPU check\n", "\n", "If this fails change the runtime type in `Runtime > Change runtime type > Select GPU`." - ] + ], + "metadata": { + "id": "f3ygaIX_TP7A" + } }, { "cell_type": "code", - "metadata": { - "id": "ZFKRHS3TTPbH", - "colab": { - "base_uri": "https://localhost:8080/" - }, - "outputId": "b6a82132-cb65-486e-fa1e-1ec8f0b0c7ae" - }, + "execution_count": 1, "source": [ "!nvidia-smi -L" ], - "execution_count": 1, "outputs": [ { "output_type": "stream", + "name": "stdout", "text": [ "GPU 0: Tesla V100-SXM2-16GB (UUID: GPU-d79f0a3f-4bb2-e6de-74e4-0274ee6a17ec)\n" - ], - "name": "stdout" + ] } - ] + ], + "metadata": { + "id": "ZFKRHS3TTPbH", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "b6a82132-cb65-486e-fa1e-1ec8f0b0c7ae" + } }, { "cell_type": "markdown", - "metadata": { - "id": "iRc3UyhPTi_6" - }, "source": [ "## Connect Google Drive\n", "\n", "This notebook is designed to be used with google drive connected. If you'd like to use it without google drive you'll have to make changes.\n", "\n", "The main reason behind this is Colab sessions automaticall shut off after a number of hours (~10 for free, ~20 for pro, ~24 pro+). This risks loosing training progress if it's not saved to persistent storage." - ] + ], + "metadata": { + "id": "iRc3UyhPTi_6" + } }, { "cell_type": "code", - "metadata": { - "id": "6t1M2VB4Tif6", - "colab": { - "base_uri": "https://localhost:8080/" - }, - "outputId": "89137096-b1b5-4e59-c812-be749790aff1" - }, + "execution_count": 2, "source": [ "from google.colab import drive\n", "drive.mount('/content/drive')" ], - "execution_count": 2, "outputs": [ { "output_type": "stream", + "name": "stdout", "text": [ "Mounted at /content/drive\n" - ], - "name": "stdout" + ] } - ] + ], + "metadata": { + "id": "6t1M2VB4Tif6", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "89137096-b1b5-4e59-c812-be749790aff1" + } }, { "cell_type": "markdown", - "metadata": { - "id": "zPv1ThsOU-Op" - }, "source": [ "## Clone / cd into Repository" - ] + ], + "metadata": { + "id": "zPv1ThsOU-Op" + } }, { "cell_type": "code", - "metadata": { - "id": "_NBaGNEbSqPX", - "colab": { - "base_uri": "https://localhost:8080/" - }, - "outputId": "8bc766dd-e349-4d86-acc5-2d3f889f09cb" - }, + "execution_count": 3, "source": [ "import os\n", "drive_path = '/content/drive/MyDrive/'\n", "repo_container_dir = 'colab-alias-free-gan'\n", "repo_name = 'alias-free-gan'\n", "git_repo = 'https://github.com/duskvirkus/alias-free-gan.git'\n", + "branch_name = 'stable'\n", "\n", "working_dir = os.path.join(drive_path, repo_container_dir, repo_name)\n", "\n", @@ -147,14 +142,14 @@ " container_path = os.path.join(drive_path, repo_container_dir)\n", " os.makedirs(container_path)\n", " %cd {container_path}\n", - " !git clone {git_repo}\n", + " !git clone --branch {branch_name} {git_repo}\n", " %cd {repo_name}\n", " !mkdir pretrained" ], - "execution_count": 3, "outputs": [ { "output_type": "stream", + "name": "stdout", "text": [ "/content/drive/MyDrive/colab-alias-free-gan\n", "Cloning into 'alias-free-gan'...\n", @@ -166,36 +161,36 @@ "Resolving deltas: 100% (588/588), done.\n", "Checking out files: 100% (94/94), done.\n", "/content/drive/MyDrive/colab-alias-free-gan/alias-free-gan\n" - ], - "name": "stdout" + ] } - ] + ], + "metadata": { + "id": "_NBaGNEbSqPX", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "8bc766dd-e349-4d86-acc5-2d3f889f09cb" + } }, { "cell_type": "markdown", - "metadata": { - "id": "z6qSNzMhXQta" - }, "source": [ "## Install Dependancies" - ] + ], + "metadata": { + "id": "z6qSNzMhXQta" + } }, { "cell_type": "code", - "metadata": { - "id": "pZYccZIHSpNs", - "colab": { - "base_uri": "https://localhost:8080/" - }, - "outputId": "31e76795-036b-4096-b792-4ef58d613f06" - }, + "execution_count": 4, "source": [ "!python install.py" ], - "execution_count": 4, "outputs": [ { "output_type": "stream", + "name": "stdout", "text": [ "Collecting pytorch-lightning\n", " Downloading pytorch_lightning-1.4.2-py3-none-any.whl (916 kB)\n", @@ -333,16 +328,19 @@ " Uninstalling future-0.16.0:\n", " Successfully uninstalled future-0.16.0\n", "Successfully installed GitPython-3.1.18 PyYAML-5.4.1 aiohttp-3.7.4.post0 async-timeout-3.0.1 configparser-5.0.2 docker-pycreds-0.4.0 fsspec-2021.7.0 future-0.18.2 gitdb-4.0.7 multidict-5.1.0 ninja-1.10.2 opencv-python-headless-4.5.3.56 opensimplex-0.3 pathtools-0.1.2 pyDeprecate-0.3.1 pydantic-1.8.2 pyhocon-0.3.58 pytorch-lightning-1.4.2 pytorch-lightning-bolts-0.3.2 sentry-sdk-1.3.1 shortuuid-1.0.1 smmap-4.0.0 subprocess32-3.5.4 torchmetrics-0.5.0 wandb-0.12.0 yarl-1.6.3\n" - ], - "name": "stdout" + ] } - ] + ], + "metadata": { + "id": "pZYccZIHSpNs", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "31e76795-036b-4096-b792-4ef58d613f06" + } }, { "cell_type": "markdown", - "metadata": { - "id": "xdzlUBR5XanA" - }, "source": [ "## Convert Dataset\n", "\n", @@ -363,27 +361,24 @@ "```\n", "\n", "The above example would result in an input of `unconverted_dataset='path/to/dataset_root_dir'`" - ] + ], + "metadata": { + "id": "xdzlUBR5XanA" + } }, { "cell_type": "code", - "metadata": { - "colab": { - "base_uri": "https://localhost:8080/" - }, - "id": "LqswLFEkarPc", - "outputId": "7e332047-f216-42a1-b07b-cf3a28335637" - }, + "execution_count": null, "source": [ "unconverted_dataset = '/content/drive/MyDrive/dataset-creation/painterly-faces-v2'\n", "out_path = '/content/drive/MyDrive/datasets-aliasfree/painterly-faces-v2-256'\n", "dataset_size = 256 # one of the following 256, 512, 1024\n", "!python scripts/convert_dataset.py --size {dataset_size} {unconverted_dataset} {out_path}" ], - "execution_count": null, "outputs": [ { "output_type": "stream", + "name": "stdout", "text": [ "Make dataset of image sizes: 256\n", "0it [00:00, ?it/s]/usr/local/lib/python3.7/dist-packages/torchvision/transforms/functional.py:387: UserWarning: Argument interpolation should be of type InterpolationMode instead of int. Please, use InterpolationMode enum.\n", @@ -391,40 +386,43 @@ "1it [00:00, 1.60it/s]/usr/local/lib/python3.7/dist-packages/torchvision/transforms/functional.py:387: UserWarning: Argument interpolation should be of type InterpolationMode instead of int. Please, use InterpolationMode enum.\n", " \"Argument interpolation should be of type InterpolationMode instead of int. \"\n", "1158it [06:45, 2.85it/s]\n" - ], - "name": "stdout" + ] } - ] + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "LqswLFEkarPc", + "outputId": "7e332047-f216-42a1-b07b-cf3a28335637" + } }, { "cell_type": "markdown", - "metadata": { - "id": "D6Yc1QbacaId" - }, "source": [ "## Info on training options\n", "\n", "Most training options work rather well out of the box. See the training section for suggested arguments.\n", "\n", "You can see a full list of training options by running the following cell." - ] + ], + "metadata": { + "id": "D6Yc1QbacaId" + } }, { "cell_type": "code", - "metadata": { - "id": "yuc-24U3dH_l" - }, + "execution_count": null, "source": [ "!python scripts/trainer.py --help" ], - "execution_count": null, - "outputs": [] + "outputs": [], + "metadata": { + "id": "yuc-24U3dH_l" + } }, { "cell_type": "markdown", - "metadata": { - "id": "EMt7IazBas5c" - }, "source": [ "## Training\n", "\n", @@ -468,13 +466,14 @@ "If the model makes it through the first epoch you're unlike to encounter any errors after that.\n", "\n", "\n" - ] + ], + "metadata": { + "id": "EMt7IazBas5c" + } }, { "cell_type": "code", - "metadata": { - "id": "rI69L2vybsPr" - }, + "execution_count": 5, "source": [ "model_size = 256\n", "dataset_location = '/content/drive/MyDrive/datasets-aliasfree/painterly-faces-v2-256'\n", @@ -485,18 +484,14 @@ "sample_frequency = 1 # in kimgs or thousands of images\n", "checkpoint_frequency = 4 # in kimgs or thousands of images" ], - "execution_count": 5, - "outputs": [] + "outputs": [], + "metadata": { + "id": "rI69L2vybsPr" + } }, { "cell_type": "code", - "metadata": { - "id": "avx9vyhlczji", - "colab": { - "base_uri": "https://localhost:8080/" - }, - "outputId": "a7a81d6b-32ec-4d9e-e118-9e3a28045574" - }, + "execution_count": 12, "source": [ "!python scripts/trainer.py \\\n", " --gpus 1 \\\n", @@ -510,10 +505,10 @@ " --save_checkpoint_every_kimgs {checkpoint_frequency} \\\n", " --augment {augmentations}" ], - "execution_count": 12, "outputs": [ { "output_type": "stream", + "name": "stdout", "text": [ "Using Alias-Free GAN version: 1.0.0\n", "\n", @@ -550,10 +545,16 @@ "Epoch 5: 14% 20/144 [00:20<01:59, 1.03it/s, kimgs=1.480, r_t_stat=1.000, ada_aug_p=0.006784]/usr/local/lib/python3.7/dist-packages/pytorch_lightning/trainer/trainer.py:1047: UserWarning: Detected KeyboardInterrupt, attempting graceful shutdown...\n", " rank_zero_warn(\"Detected KeyboardInterrupt, attempting graceful shutdown...\")\n", "Epoch 5: 14% 20/144 [00:40<04:00, 1.94s/it, kimgs=1.480, r_t_stat=1.000, ada_aug_p=0.006784]\n" - ], - "name": "stdout" + ] } - ] + ], + "metadata": { + "id": "avx9vyhlczji", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "a7a81d6b-32ec-4d9e-e118-9e3a28045574" + } } ] -} +} \ No newline at end of file diff --git a/pretrained_models.json b/pretrained_models.json index 50ab036..516a5fd 100644 --- a/pretrained_models.json +++ b/pretrained_models.json @@ -4,11 +4,10 @@ "model_name": "rosinality-ffhq-800k", "creator": "rosinality", "model_architecture": "alias-free-rosinality-v1", - "description": "FFHQ 256 model trained by rosinality (source: https://github.com/rosinality/alias-free-gan-pytorch/issues/3)", + "description": "FFHQ 256 model trained by rosinality (source: https://github.com/rosinality/alias-free-gan-pytorch/issues/3). Trained for 800k steps with a batch size of 16.", "model_size": 256, "wget_url": "https://aliasfreegan.sfo3.cdn.digitaloceanspaces.com/rosinality-ffhq-800k.pt", - "sha1": "06e900cc5451cac5226cf12663c484cf29144e0c", - "licence_and_compensation_information": "test information" + "sha1": "06e900cc5451cac5226cf12663c484cf29144e0c" } ] } \ No newline at end of file diff --git a/scripts/trainer.py b/scripts/trainer.py index 4c4c178..396628e 100644 --- a/scripts/trainer.py +++ b/scripts/trainer.py @@ -97,7 +97,7 @@ def cli_main(args=None): resume_path = save_path model_architecture = pretrained['model_architecture'] - print('\n\nLicence and compensation information for %s pretrained model: %s\n\n' % (pretrained['model_name'], pretrained['licence_and_compensation_information'])) + print('\n\nModel information:\nname:%s\ncreated by: %s\n%s\n\n' % (pretrained['model_name'], pretrained['creator'], pretrained['description'])) else: print('Invalid model size for %s! Model works with size=%d but your trying to train a size=%d model.' % (pretrained['model_name'], pretrained['model_size'], args.size)) exit(1)