Giter Club home page Giter Club logo

fracbits's Introduction

Network Quantizing with Fractional Bitwidths

This is the codebase of searching bit-widths for neural networks based on fractional bit-widths, as proposed in FracBits arXiv AAAI2021.

Run

  1. Requirements:
    • python3, pytorch 1.0, torchvision 0.2.1, pyyaml 3.13.
    • Prepare ImageNet-1k data following pytorch example.
  2. Training and Testing:
    • The codebase is a general ImageNet training framework using yaml config under apps dir, based on PyTorch.
    • To test, download pretrained models to logs dir and directly run command.
    • To train, comment test_only and pretrained in config file. You will need to manage visible gpus by yourself.
    • Command: python train.py app:{apps/***.yml}. {apps/***.yml} is config file. Do not miss app: prefix.
  3. Still have questions?
    • If you still have questions, please search closed issues first. If the problem is not solved, please open a new.

Technical Details

Implementing network quantizing is straightforward:

  • Quantization layers are implemented in models/quantizable_ops.
  • Training with quantizing is implemented by setting a reasonable [kappa] in the yml file.
  • [q_mobilenetv1_uint8_train_val.yml] is a good start yml example. For ablation test, please run test_ablation with the corresponding test ablation yml file.

License

CC 4.0 Attribution-NonCommercial International

The software is for educaitonal and academic research purpose only.

Citing

@article{yang2020fracbits,
  title={FracBits: Mixed Precision Quantization via Fractional Bit-Widths},
  author={Yang, Linjie and Jin, Qing},
  journal={arXiv preprint arXiv:2007.02017},
  year={2020}
}

fracbits's People

Contributors

dejqk avatar

Stargazers

Haoning XU avatar LiuTielong avatar  avatar Jinyu Bai avatar  avatar  avatar  avatar  avatar  avatar Jianjing An avatar Balint Cristian avatar

Watchers

James Cloos avatar  avatar

fracbits's Issues

downloading fp_pretrained model

Hello.

I am trying to reproduce the output using your code in mobilenet_v2 for cifar10 dataset.
I wonder if you are providing the fp_pretrained model for the above setup.

In addition, I wonder although I do not load the fp_pretrained to the model, this algorithm can be properly working from scratch.

Thank you in advance. I will be looking forward to your answer.

Need help with pyarrow configuration

Hi @deJQK,

Seems like you are using apache arrow for distributed training.
Can you explain more on how to configurate environment for pyarrow?
I cannot start training as i always get FileNotFoundError: [Errno 2] No such file or directory: 'hadoop'

Thanks in advance.

Need help with obtaining the bit width assigned to each layer.

I am trying to run your code and will be using your work in an academic project. I ran this experiment but I couldn't see any way provided to get which layers were assigned what bitwidth.

How can I get the bitwidths for each layer in the network, similar to the data used to create figure 2 in the paper (attached below)?
image

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.