Giter Site home page Giter Site logo

pytorch-training-toolkit's Introduction

Pytorch training toolkit

This toolkit integrates the most well-known frameworks for machine learning like WandB for experiment tracking, Hydra for configuration management or Optuna for hyperparameter search.

In addition to that, the code is meant to be fully extensible, it should be possible to implement your own custom models/losses/optimizers without changing existing code.

Overview

Frameworks

Brief introduction to the frameworks that are integrated into the toolkit.

WandB

WandB is an experiment tracking tool for machine learning.

Using WandB in this toolkit you will be able to:

  • Track the hyperparameters and metrics of every run
  • Display the predictions through the different epochs
  • Upload complex media and charts

For more information visit its documentation.

Hydra

Hydra is a framework that simplifies the development of research and other complex applications. It makes it possible to have a modular configuration schema in order to build your experiment configurations easier.

The Hydra configuration schema is the following:

conf
├── config.yaml             # config.yaml calls one .yaml file for 
├── dataset                 # every module inside the schema
│   ├── MNIST.yaml          # the .yaml files inside every module
│   └── cifar10.yaml        # specifies the configuration of that module   
├── model                   
│   ├── resnet.yaml         
│   └── ...   
└── ...

For more information visit its documentation.

Optuna

Optuna is an open source hyperparameter optimization framework to automate hyperparameter search

In order to use Optuna together with Hydra we first need to install the Optuna Sweeper plugin.

pip install hydra-optuna-sweeper --upgrade

It is needed to set the optuna sweeper in the config file, but it is already done by default in config.yaml.

defaults:
  - override hydra/sweeper: optuna

Further changes can be added in the config file like the number of runs to execute or whether we want to maximize or minimize our objective metric.

Installation

Clone the repository and install the requirements.

git clone https://github.com/0Miquel/Pytorch-training-toolkit.git
cd Pytorch-training-toolkit
pip install -r requirements.txt

Train

CLI command to run a training experiment, which runs the configuration found in config.yaml.

cd tools
python train.py 

Additional changes in the Hydra configuration can be added in the command line in the following way:

python train.py optimizer.settings.lr=0.1 trainer.wandb=test_project

In this case we have changed the default learning rate in the optimizer to 0.1 and have set a wandb project name in order to log the results from the experiment, if no project name is given it will not log any results into wandb.

Finally, in order to run an Optuna hyperparameter search we can use the following command:

python train.py --multirun 'optimizer.settings.lr=choice(0.1, 0.01, 0.001, 0.0001)'

pytorch-training-toolkit's People

Contributors

0miquel avatar

Stargazers

 avatar Pep Bravo avatar David Serrano Lozano avatar Guillem Martínez avatar

Watchers

Kostas Georgiou avatar  avatar

pytorch-training-toolkit's Issues

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.