GithubHelp home page GithubHelp logo

superweights's Introduction

SuperWeight Networks

Implementation of SuperWeight Networks from "Learning to Compose SuperWeights for Neural Parameter Allocation Search"

Requirements

Python 3, PyTorch == 1.11.0, torchvision == 0.12.0, timm == 0.5.4, fvcore,
matplotlib, sklearn

Training

To train a 4 member Multi-Depth/Width ensemble of WRN 28-[7,4] 16-[7,4] on CIFAR-100 run:

python main_no.py path/to/data --dataset cifar100 --job-id <jobid> --ngpu <number of gpus> \
--cifar_split full --epochs 200 --batch_size 128 --decay 5e-4 --schedule 60 120 160 --gammas 0.2 0.2 0.2 --cutout \
--arch swrn --share_type wavg_slide --max_params 18000000 --depth 28 --wide 7 \
--n_students 3 --student_depths 28_16_16 --student_widths 4_7_4 \
--group_split_epochs 20 --group_split_threshold_start 0.1 \
--coefficient_share --coefficient_unshare_epochs 10 --coefficient_unshare_threshold 0.9 --param_group_bins 4

The --depth and --wide flags control the deepest network, --n_students, --student_depths, and --student_widths dictate the remaining networks. Depths must be in decreasing order and for each depth the widths must be in decreasing order. For CIFAR-10, simply adjust the --dataset flag.

To train a Multi-Width configuration of WRN 28-[7,4,3] on CIFAR-100 run:

python main_no.py path/to/data --dataset cifar100 --job-id <jobid> --ngpu <number of gpus> \
--cifar_split full --epochs 200 --batch_size 128 --decay 5e-4 --schedule 60 120 160 --gammas 0.2 0.2 0.2 --cutout \
--arch swrn --share_type wavg_slide --max_params 18000000 --depth 28 --wide 7 \
--n_students 2 --student_depths 28_28 --student_widths 4_3 \
--group_split_epochs 20 --group_split_threshold_start 0.1 \
--coefficient_share --coefficient_unshare_epochs 10 --coefficient_unshare_threshold 0.9  --param_group_bins 4

Evaluation

To evaluate a trained model with the Multi-Depth/Width configuration, run:

python main_no.py path/to/data --dataset cifar100 --job-id <jobid> --ngpu <number of gpus> \
--cifar_split full --epochs 200 --batch_size 128 --decay 5e-4 --schedule 60 120 160 --gammas 0.2 0.2 0.2 --cutout \
--arch swrn --share_type wavg_slide --max_params 18000000 --depth 28 --wide 7 \
--n_students 3 --student_depths 28_16_16 --student_widths 4_7_4 \
--group_split_epochs 20 --group_split_threshold_start 0.1 \
--coefficient_share --coefficient_unshare_epochs 10 --coefficient_unshare_threshold 0.9 \
 --evaluate --resume snapshots/<jobid>/checkpoint.pth.tar    --param_group_bins 4

Code largely authored by Soren Nelson and built on from https://github.com/BryanPlummer/SSN.

superweights's People

Stargazers

 avatar  avatar

Watchers

 avatar

Forkers

johndpope

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.