Skip to content

Unofficial Alias-Free GAN implementation. Based on rosinality's version with expanded training and inference options.

License

Notifications You must be signed in to change notification settings

duskvirkus/alias-free-gan

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Alias-Free GAN

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. 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

MIT licence badge

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.

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 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

devel is the default branch and it includes the latest features but may have breaking changes.

stable branch is the latest stable release of the repository the only updates it receives between versions are to the available pretrained models, additional notebooks, and any bug fixes.

Branch All CI GPU pytest TPUs pytest
devel CI gpu pytest on gcloud tpus pytest on gcloud
stable CI gpu pytest on gcloud tpus pytest on gcloud

Examples

Training Process

Example of animation made from samples generated in training process.

training example gif


Linear Interpolations

Example of linear interpolation between two random seeds.

linear interpolation example with ffhq

linear interpolation example with custom model


Circular Interpolation

Example of circular loop interpolation

circular loop example with ffhq

circular loop example with custom model


Open Simplex Noise Loop

Example of open simplex noise loop interpolation.

noise loop example with ffhq

noise loop example with custom model


Rosinality Translate

Example output from converted rosinality translate script.

rosinality translate example with ffhq

rosinality translate example with custom model

Supported Model Architectures

Below is a list of supported model architecture. The hope is to support NVlabs code when it comes out.

model-architecture Base Repository Repository Version Limit [start,end) Description
alias-free-rosinality-v1 https://github.com/rosinality/alias-free-gan-pytorch [fixed model commit on July 7th 2021, _) Based on rosinality implementation after some model fixes.

Notes:

Notebooks

GPU Colab Training Notebook

branch Open in Colab View in GitHub
devel Open In Colab https://github.com/duskvirkus/alias-free-gan/blob/devel/notebooks/GPU_Training-Alias-Free_GAN.ipynb
stable Open In Colab https://github.com/duskvirkus/alias-free-gan/blob/stable/notebooks/GPU_Training-Alias-Free_GAN.ipynb

GPU Colab Inference Notebook

aka generate images and walks

branch Open in Colab View in GitHub
devel Open In Colab https://github.com/duskvirkus/alias-free-gan/blob/devel/notebooks/GPU_Inference_Alias_Free_GAN.ipynb
stable Open In Colab https://github.com/duskvirkus/alias-free-gan/blob/stable/notebooks/GPU_Inference_Alias_Free_GAN.ipynb

TPU Notebooks

Coming at some point in the future.

Pre-trained Models

See pretrained_models.json.

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. 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.

Contributing

Contribute Pretrained Models

Contributing your trained models for others to transfer learn off of or use in their projects. This helps reduce the training time and resources required to use.

You can do so by creating a pull request to the stable branch. Add information about your model to the to pretrained_models.json using the template below.

        {
            "model_name": "model-name-no-spaces-no-file-extension",
            "creator": "github username",
            "model_architecture": "see model architecture section",
            "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,
            "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."
        }

Contribute Notebooks

If you make a notebook and want to share it that is welcome. If it's just a notebook you can just make a pull request to stable. If it requires changes to the code base please open an issue to discuss which branch it should go on.

Other Contributions

Other contributions are welcome but open an issue to discuss what you want to change/add. Unless it's a small non breaking bug fix pull requests may or may not be accepted without discussion beforehand.