Giter Club home page Giter Club logo

fastai_timm's Introduction

A bunch of experiments on integrating fastai with timm

The main idea of this repo is finding the best way to integrate timm backbones into fastai so they fine tune good on downstream tasks.

Implementing a splitter for timm models

Timm models are different than torchvision ones, and need a proper splitter of parameters so they can be properly finetuned.

Experiments

We use W&B for experiment tracking trough the WandbCallback in fastai. The task we are trying to optimize is fine tunning a pretrained backbone on a new dataset.

The fine tunning is performed with fine_tune for a fixed number of epochs.

$ python fine_tune.py --help                                                                      
usage: fine_tune.py [-h] [--batch_size BATCH_SIZE] [--epochs EPOCHS] [--num_experiments NUM_EXPERIMENTS] [--learning_rate LEARNING_RATE]
                    [--img_size IMG_SIZE] [--resize_method RESIZE_METHOD] [--model_name MODEL_NAME] [--split_func SPLIT_FUNC] [--pool POOL] [--seed SEED]
                    [--wandb_project WANDB_PROJECT] [--wandb_entity WANDB_ENTITY] [--dataset DATASET]

options:
  -h, --help            show this help message and exit
  --batch_size BATCH_SIZE
  --epochs EPOCHS
  --num_experiments NUM_EXPERIMENTS
  --learning_rate LEARNING_RATE
  --img_size IMG_SIZE
  --resize_method RESIZE_METHOD
  --model_name MODEL_NAME
  --split_func SPLIT_FUNC
  --pool POOL
  --seed SEED
  --wandb_project WANDB_PROJECT
  --wandb_entity WANDB_ENTITY
  --dataset DATASET

Running a Sweep with W&B

  • Create a W&B account on https://wandb.ai/signup

  • Setup your machine for fastai, you will need to install latest fastai and wandb. We can provide credtis on jarvislabs.ai if needed.

  • Clone this repo

Time to run the experiment, We can perform hyperparameter sweep using W&B.

  • Setting your sweep YAML file: To run a sweep you will need first to configure what parameters you want to explore, this is done on the sweep.yaml file. In this file, you will specify the parameters the sweep will explore. For instance, setting:
learning_rate:
    values: [0.002, 0.008]

tells the sweep to choose the learning_rate param from the 2 values: 0.002 and 0.008. What happens if we want a distribution?

learning_rate:
    distribution: uniform
    min: 0.0001
    max: 0.01

You can check all the possibilities for defining parameters here.

  • Creating the sweep: In a terminal window, run:
wandb sweep sweep.yaml
  • Running the actual training of the sweep (you can paste the output of the previous command here)
wandb agent <SWEEP_ID>

References:

fastai_timm's People

Contributors

jph00 avatar tcapelle avatar simjeg avatar

Stargazers

Farrukh Nauman avatar 陈学斌 avatar (Shawn) Yuxuan Tong avatar Kazybek Askarbek avatar Durojaiye Abisoye Emmanuel avatar Jacob A Rose avatar misza222 avatar 爱可可-爱生活 avatar Dzmitry Pletnikau avatar Kedar Dabhadkar avatar Francisco Mussari avatar Tiago Fernandes avatar Quan Tran avatar Robin Cole avatar Kurian Benoy avatar  avatar Dickson Neoh avatar Clive  avatar Kurian Benoy avatar Matt Rosinski avatar dongwiki avatar Scott Condron avatar

Watchers

James Cloos avatar Clive  avatar  avatar

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