Coder Social home page Coder Social logo

afcarl / l4-optimizer Goto Github PK

View Code? Open in Web Editor NEW

This project forked from martius-lab/l4-optimizer

0.0 1.0 0.0 14 KB

Code for paper "L4: Practical loss-based stepsize adaptation for deep learning"

License: MIT License

Python 48.91% Jupyter Notebook 51.09%

l4-optimizer's Introduction

L4 Stepsize Adaptation Scheme

By Michal Rolínek, Georg Martius.

Autonomous Learning Group, Max Planck Institute for Intelligent Systems.

Table of Contents

  1. Introduction
  2. Requirements
  3. Installation
  4. Usage
  5. Notes

Introduction

This repository contains TensorFlow implementation code for the paper "L4: Practical loss-based stepsize adaptation for deep learning". This work proposes an explicit rule for stepsize adaptation on top of existing optimizers such as Adam or momentum SGD.

Disclaimer: This code is a PROTOTYPE and most likely contains bugs. It should work with most Tensorflow models but most likely it doesn't comply with TensorFlow production code standards. Use at your own risk.

Requirements

TensorFlow >= 1.4.

For a PyTorch implementation of L4, see l4-pytorch (also linked here as a submodule).

Installation

Either use one of the following python pip commands,

python -m pip install git+https://github.com/martius-lab/l4-optimizer
python3 -m pip install git+https://github.com/martius-lab/l4-optimizer

or simply drop the L4/L4.py file to your project directory

Usage

Exaclty as you would expect from a TensorFlow optimizer. Empirically, good values for the 'fraction' parameter are 0.1 < fraction < 0.3, where 0.15 is set default and should work well enough in most cases. Decreasing 'fraction' is typically a good idea in case of a small batch size or more generally for very little signal in the gradients. Too high values of 'fraction' behave similarly to too high learning rates (i.e. divergence or very early plateauing).

import L4

...
opt = L4.L4Adam(fraction=0.20)
opt.minimize(loss)
...

or

import L4

...
opt = L4.L4Mom()  # default value fraction=0.15 is used
grads_and_vars = opt.compute_gradients(loss)
...
# Gradient manipulation
...

opt.apply_gradients(grads_and_vars) # (!) Passing the loss is no longer needed (!)
...

Notes

Contribute: If you spot a bug or some incompatibility, contribute via a pull request! Thank you!

l4-optimizer's People

Contributors

jviereck avatar

Watchers

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