Giter Site home page Giter Site logo

bitprune's Introduction

Bit-Pruning

This is the official repo for ICLR 2023 Paper "Bit-Pruning: A Sparse Multiplication-Less Dot-Product" Yusuke Sekikawa and Shingo Yashima

paper, openreview

Usage

Set GPU(s) to use

export CUDA_VISIBLE_DEVICES=0
export CUDA_VISIBLE_DEVICES=1

Run train and test

python main.py --config 'config/cifar10.yaml' 
python main.py --config 'config/cifar100.yaml' 
python main.py --config 'config/imagenet.yaml' 

You can change any config by specifying the config name (e.g., optim.spr_w) followed by the value (e.g., optim.spr_w 16 model.wgt_bit 8 ...). use run_xxx.sh for batch execution.

Plot bit-pruning loss

Run vis_cost.ipynb to plot proximal weight and their loss landscape (Fig. 3, Fig. 11).

Plot histrram of learned weight

Run vis_hist.ipynb to plot the histgram of learned weight distribution (Fig. 6).

Installation

Setup docker image from pytorch/pytorch

docker pull pytorch/pytorch
docker run -dit --gpus all -v /username/Project/:/home/src -v /data1/dataset:/home/data --name username --shm-size=64gb pytorch/pytorch
docker exec -e CUDA_VISIBLE_DEVICES='0' -u 0 -it username bash
apt-get  -y update && apt-get -y install libgl1 && apt-get  -y install libglib2.0-0
yes | pip install opencv-python
yes | pip install opencv-contrib-python
yes | pip install einops
yes | pip install kornia
yes | pip install lightning-bolts
yes | pip install pytorch-lightning
yes | pip install fvcore
yes | pip install scipy
conda install -c conda-forge easydict --yes 
conda install -c conda-forge ruamel.yaml --yes 

If you find our code or paper useful, please cite the following:

@inproceedings{iclr2023bitprune,
  author    = {Yusuke, Sekikawa and Shingo, Yashima},
  title     = {Bit-Pruning: A Sparse Multiplication-Less Dot-Product},
  booktitle={Proceedings of the International Conference on Learning Representations},
  year      = {2023},
  url={https://openreview.net/forum?id=YUDiZcZTI8}
}

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.