This is the codebase of searching bit-widths for neural networks based on fractional bit-widths, as proposed in FracBits arXiv AAAI2021.
- Requirements:
- python3, pytorch 1.0, torchvision 0.2.1, pyyaml 3.13.
- Prepare ImageNet-1k data following pytorch example.
- 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
andpretrained
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 missapp:
prefix.
- The codebase is a general ImageNet training framework using yaml config under
- Still have questions?
- If you still have questions, please search closed issues first. If the problem is not solved, please open a new.
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 runtest_ablation
with the corresponding test ablation yml file.
CC 4.0 Attribution-NonCommercial International
The software is for educaitonal and academic research purpose only.
@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}
}