Giter Club home page Giter Club logo

stylegan2-flax-tpu's Introduction

StyleGAN2 Flax TPU

This implementation is adapted from the stylegan2 codebase by Matthias Wright.

Specifically, the features we've added allow for better scaling of StyleGAN2 training on TPUs:

  • ๐Ÿญ Enable data-parallel training on TPU pods (tested on TPU v2 to v4 generations)
  • ๐Ÿ’พ Google Cloud Storage (GCS) integration/dataset sharding between workers
  • ๐Ÿ– Quality-of-life improvements (e.g. improved W&B logging)

This food does not exist! Click to see more samples ๐Ÿช๐Ÿฐ๐Ÿฃ๐Ÿน

These Cookies Do Not Exist

๐Ÿง‘โ€๐Ÿ”ง Install

  1. Clone the repository:
    git clone https://github.com/nyx-ai/stylegan2-flax-tpu.git
  2. Go into the directory:
    cd stylegan2-flax-tpu
  3. Install Jax according to your platform.
  4. Install requirements:
    pip install -r requirements.txt

๐Ÿ–ผ Generate Images

We released four 256x256 pretrained models: cookie, cheesecake, sushi and cocktail. Download them from the latest release.

python generate_images.py \
   --checkpoint checkpoints/cookie-256.pkl \
   --seeds 0 42 420 666 \
   --truncation_psi 0.7 \
   --out_path generated_images

Check the Colab notebook for more examples: Open In Colab

โš™๏ธ Train Custom Models

Add your images into a folder /path/to/image_dir:

/path/to/image_dir/
    0.jpg
    1.jpg
    2.jpg
    4.jpg
    ...

and create a TFRecord dataset:

python dataset_utils/images_to_tfrecords.py --image_dir /path/to/image_dir/ --data_dir /path/to/tfrecord

For more detailed instructions please refer to this README.

The following command trains with 128 resolution and batch size of 8.

python main.py --data_dir /path/to/tfrecord

Read more about suitable training parameters here.

๐Ÿ™ Acknowledgements

stylegan2-flax-tpu's People

Contributors

masterscrat avatar mar-muel avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.