GithubHelp home page GithubHelp logo

ojus1 / smoothedgradientdescentascent Goto Github PK

View Code? Open in Web Editor NEW
6.0 2.0 3.0 262 KB

An Implementation of Smoothed Gradient Descent-Ascent (NeurIPS 2020) and a variant of the algorithm.

Python 99.37% Shell 0.63%

smoothedgradientdescentascent's Introduction

Smoothed Gradient Descent-Ascent - PyTorch

  • This repository contains an implementation of the algorithm presented in the paper "A Single-Loop Smoothed Gradient Descent-Ascent Algorithm for Nonconvex-Concave Min-Max Problems" (NeurIPS 2020)

  • This repository applies the algorithm to a Vanilla GAN on MNIST dataset.

  • The algorithm roughly translates to using:

    • Stochastic Weight Averaging (SWA) on the discriminator ("slower-moving" discriminator).
    • And a penalty on the Discriminator loss that forces the discriminator to not stray too far away from the SWA version of the Discriminator.
  • The above algorithm, Smoothed Gradient Descent-Ascent (SGDA) is implemented at SGDA.py

  • This repository also contains an extension of the SGDA algorithm which passes gradients from both Discriminators to the Generator.

  • This change in the algorithm roughly translates to:

    • Minimizing Log-likelihood w.r.t to the SWA version of the Discriminator (in addition to the "faster-moving" discriminator)
  • The above algorithm, "Double" Smoothed Gradient Descent-Ascent is implemented at DoubleSmoothedGDA.py

Results

DCGAN - MNIST

Latent Space Interpolation.

Latent Space Interpolation

  • Notice Vanilla GDA and SGDA both suffer from Mode Collapse.
  • Double Smoothed GDA leads to a very rich latent space.
  • To reach this level of Mutual Information (MI) between Latent vector and Generated Images, usually InfoMax like additional penalty term is needed.

Samples

Samples

  • Again, SGDA suffers from Mode Collapse, while in GDA the Discriminator is fooled too easily by the Generator, hence the poorer results.
  • To solve both problems, Wasserstein version of the GAN coupled with InfoMax might be needed.
  • Double SGDA doesn't need anything special to avoid Mode Collapse.

Loss Curves

Loss Curves

  • NOTE: Loss magnitudes are not comparable since all three methods use different loss functions.
  • NOTE: These curves are only meant to intrepret the stability of losses of Generator and Discriminator.

To-do

  • Experiments on CelebA

Shameless Plug

The experiments were conducted using the tool "Poor Man's Job Scheduler". TLDR:

  • pmrun "python3 foo.py"
  • Run Asynchronous jobs on remote/local server as if they were your local machine.
  • Without directly messing with SSH.
  • Ignore files to sync with a .gitignore-style file.

smoothedgradientdescentascent's People

Contributors

ojus1 avatar

Stargazers

 avatar Panagiotis Koromilas avatar Omar Alama avatar haoyuan avatar  avatar Vishal Belsare avatar

Watchers

James Cloos avatar  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.