Coder Social home page Coder Social logo

gdfq's Introduction

Generative-Low-bitwidth-Data-Free-Quantization

We provide PyTorch implementation for "Generative Low bitwidth Data Free Quantization".

Paper


Dependencies

  • Python 3.6
  • PyTorch 1.2.0
  • dependencies in requirements.txt

Getting Started

Installation

  1. Clone this repo:

     git clone https://github.com/xushoukai/Generative-Low-bitwidth-Data-Free-Quantization.git
     cd Generative-Low-bitwidth-Data-Free-Quantization
    
  2. Install pytorch and other dependencies.

     pip install -r requirements.txt
    

Set the paths of datasets for testing

  1. Set the "dataPath" in "cifar100_resnet20.hocon" as the path root of your CIFAR-100 dataset. For example:

     dataPath = "/home/datasets/Datasets/cifar"
    
  2. Set the "dataPath" in "imagenet_resnet18.hocon" as the path root of your ImageNet dataset. For example:

     dataPath = "/home/datasets/Datasets/imagenet"
    

Training

To quantize the pretrained ResNet-20 on CIFAR-100 to 4-bit:

python main.py --conf_path=./cifar100_resnet20.hocon --id=01

To quantize the pretrained ResNet-18 on ImageNet to 4-bit:

python main.py --conf_path=./imagenet_resnet18.hocon --id=01

Results

Dataset Model Pretrain Top1 Acc(%) W4A4(Ours) Top1 Acc(%)
CIFAR-100 ResNet-20 70.33 63.58 ± 0.23
ImageNet ResNet-18 71.47 60.60 ± 0.15

Note that we use the pretrained models from pytorchcv.


Citation

If this work is useful for your research, please cite our paper:

@InProceedings{xu2020generative,
title = {Generative Low-bitwidth Data Free Quantization},
author = {Shoukai, Xu and Haokun, Li and Bohan, Zhuang and Jing, Liu and Jiezhang, Cao and Chuangrun, Liang and Mingkui, Tan},
booktitle = {The European Conference on Computer Vision},
year = {2020}
}

Acknowledgments

This work was partially supported by the Key-Area Research and Development Program of Guangdong Province 2018B010107001, Program for Guangdong Introducing Innovative and Entrepreneurial Teams 2017ZT07X183, Fundamental Research Funds for the Central Universities D2191240.

gdfq's People

Contributors

xushoukai avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

gdfq's Issues

论文里的一些疑惑的地方

您好,您论文里提到
①warm-up阶段只更新生成器G;
②fine-tuning阶段固定量化模型中的BN statistics
请问这两部分在代码里的哪部分呢?
另外代码里在前四个epoch 里unfreeze_model,不固定激活范围,在后面的epoch里都选择fix激活范围,这是为什么呢?

Saving quantised model

Hi,Thank you for your contribution,
How did you save the quantised model? torch.save(model.state_dict(),"") will save the weight in FP32?

Thanks

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.