Git Product home page Git Product logo

mixturegrowth's Introduction

MixtureGrowth: Growing Neural Networks by Recombining Learned Parameters

This repo contains a Pytorch implementation for MixtureGrowth.

If you find this code useful in your research then please cite

@InProceedings{phamMixtureGrowth2024,
     author={Chau Pham and Piotr Teterwak and Soren Nelson and Bryan A. Plummer},
     title={MixtureGrowth: Growing Neural Networks by Recombining Learned Parameters},
     booktitle={IEEE Winter Conference on Applications of Computer Vision (WACV)},
     year={2024}}

This code was tested using pytorch v2.0 and python 3.10.

Installation

To set up the environment, clone this repo and run:

pip install -r requirements.txt

Training New Models

You can train a model using scripts in scripts/cifar/template_mixing and scripts/imagenet/template_mixing with the following command:

./scripts/[dataset]/template_mixing/ours.sh <NUM GPUS> <DATASET> <TAG> <ADDITIONAL ARGUMENTS>

For example, for CIFAR-100:

./scripts/cifar/template_mixing/ours.sh 1 cifar100 first_run --template_size 0.5,0.5,1 --growth_epochs 200 --ensemble_train_epochs 200 --epochs 440

Thi will fully train a WRN-28-5 on CIFAR-100 for 200 epochs (network 1), then train another WRN-28-5 on CIFAR-100 for 200 epochs (network 2). Finally, it combines networks 1 and 2, and grows to a WRN-28-10. The fully grown network is then further trained for an additional 40 epochs.

Similarly, for CIFAR-10:

./scripts/cifar/template_mixing/ours.sh 1 cifar10 run_cifar10 --template_size 0.5,0.5,1 --growth_epochs 200 --ensemble_train_epochs 200 --epochs 440 

For ImageNet, modify the dataset path in scripts/imagenet/template_mixing/ours_bank.sh and run:

./scripts/imagenet/template_mixing/ours_bank.sh 2 imagenet run_imagenet --template_size 0.5,0.5,1 --growth_epochs 90 --ensemble_train_epochs 74 --epochs 178  

You can see a listing and description of many parameter settings with:

python main.py --help

Some key arguments would be:

arguments description
--template_size [list] indicates the size of template at each growth step
--growth_epochs At which epoch we start to grow
--ensemble_train_epochs Number of epochs we continue to train before growing to the fully grown network
--epochs Total training epochs

Evaluation

You can test a model using:

./scripts/cifar/template_mixing/ours_test.sh <NUM GPUS> <DATASET> <TAG> <ADDITIONAL ARGUMENTS>

For example:

./scripts/cifar/template_mixing/ours_test.sh 1 cifar100 first_run

mixturegrowth's People

Contributors

chaudatascience avatar

Stargazers

 avatar lorena avatar John S. Dvorak avatar Yang Zhiwen avatar

Watchers

Kostas Georgiou 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.