Giter Club home page Giter Club logo

haq's People

Contributors

kuan-wang avatar tonylins 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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

haq's Issues

fused mobilenet v1

If we applied haq on fused mobilenet v1, i.e., fuse convolutional and batch norm layer together, it seems very difficult to quantize such model in 1~8bits.
Do you have any comment on such case?

Question about linear quantization

I figure out the procedure of linear quantization and reproduce the experiments,

  1. Search the quantization strategy on the imagenet100 dataset.
  2. Finetune the model on the whole imagenet dataset with the strategy obtained from step 1.

It seems like the final accuracy of the quantized model is more dependent on the fine-tuning.
Another question is why the bit reduction process starts from the last layer as the _final_action_wall function shows.

Regarding paper and codes

By diving deep into the codes and the paper, I have two questions.

  1. I've read from the paper that "If the current policy exceeds our resource budget (on latency, energy or model size), we will sequentially decrease the bitwidth of each layer until the
    constraint is finally satisfied." Where in the codes correspond to this statement "decrease the bitwidth of the layer when the current policy exceeds budget?"

  2. Why don't you use the k-means quantization for latency/energy constraint experiments? Will you release codes for linear quantization?

Why use the 8-bit floating numbers to compute the original cost?

Hi,
The work is amazing.
When I looked through the code, I foud that you employed the 8-bit floating numbers to compute the original cost and store
it as a lookup table. I wondered why not use the 32-bit floating(not use the flag "--half" in the pretraining process) or use the 16-bit floating (use the flag "--half" in the pretraining process)? Could you please clarify that?
Thanks a lot!

Training with simulated quantization

I have noticed that the quantization mechanism is quantize(w, ak, c) = round(clamp(w, c)/s) × s. It seems like you have use the "Training with simulated quantization" in paper "Quantization and Training of Neural Networks for Efficient Integer-Arithmetic-Only Inference". Is it true?

If yes, Training with simulated quantization is just used for training. I wonder does the model also use the Integer-arithmetic-only inference process like round(clamp(w, c)/s) during the inference process?

torch version problem

I configured the Python virtual environment according to the instructions, but there is a problem with the cuda version. The cuda version I used is 11.8.

image

Quantizing activation

It seems that only weight quantization is supported in this repo, isn't it?
Do you have plan to release the implementation including activation quantization in the future?

Question about model size constraint

Dear authors,

I notice in the first two lines of Table 6 that your searched model has a model size even smaller than 2-bits quantization but a much higher accuracy. Can you illustrate your quantization policy under this constraint? It's a little strange to me because it seems your minimum bitwidth choice is 2 in the paper.

Thank you

How to measure model size?

Thanks for sharing the amazing work! I'm wondering how did you measure the model size. I downloaded your pretrained model 'resnet50_0.1_75.48.pth.tar', and found the size of the model is 102.7MB which is big.

Performance for mixed precision Resnets?

Thanks for sharing a great work!

image

I was interested in the results of deep compression vs HAQ in the paper: in case of resnets, mixed precision quantization did not bring much benefits.
I was wondering if mixed precision quantization is effective in resnet architecture or not.
Did you compare the results of HAQ vs PACT with resnets? It would be great if you can share!

Quantization of custom models

Can this project be used for the Hardware Aware quantization of self made custom models that are trained on datasets other than ImageNet so as to reduce the latency on a particular GPU?

activation quantization

can you tell me which part is using for quantize activation?

I just find quantization codes for weights and bias, but not activation.

Pretrained Mobilenet model

Hi, Dear author,
The figures in the paper show the parameters' bitwidth in MobileNet. Is it possible for you to release the pretrained quantized MobileNet model?
Thanks!

RuntimeError: CUDA error: out of memory

(.haq) [root@b6706b6a30d7 HAQ-master]# python rl_quantize.py --gpu_id 2
support models: ['alexnet', 'densenet121', 'densenet161', 'densenet169', 'densenet201', 'googlenet', 'inception_v3', 'mobilenet_v2', 'resnet101', 'resnet152', 'resnet18', 'resnet34', 'resnet50', 'resnext101_32x8d', 'resnext50_32x4d', 'shufflenet_v2_x0_5', 'shufflenet_v2_x1_0', 'shufflenet_v2_x1_5', 'shufflenet_v2_x2_0', 'squeezenet1_0', 'squeezenet1_1', 'vgg11', 'vgg11_bn', 'vgg13', 'vgg13_bn', 'vgg16', 'vgg16_bn', 'vgg19', 'vgg19_bn', 'mobilenet_v3']
==> Output path: ../../save/mobilenet_v2_imagenet...
Traceback (most recent call last):
File "rl_quantize.py", line 210, in
model = torch.nn.DataParallel(model).cuda()
File "/aiml/.haq/lib64/python3.6/site-packages/torch/nn/modules/module.py", line 265, in cuda
return self._apply(lambda t: t.cuda(device))
File "/aiml/.haq/lib64/python3.6/site-packages/torch/nn/modules/module.py", line 193, in _apply
module._apply(fn)
File "/aiml/.haq/lib64/python3.6/site-packages/torch/nn/modules/module.py", line 193, in _apply
module._apply(fn)
File "/aiml/.haq/lib64/python3.6/site-packages/torch/nn/modules/module.py", line 193, in _apply
module._apply(fn)
[Previous line repeated 1 more time]
File "/aiml/.haq/lib64/python3.6/site-packages/torch/nn/modules/module.py", line 199, in _apply
param.data = fn(param.data)
File "/aiml/.haq/lib64/python3.6/site-packages/torch/nn/modules/module.py", line 265, in
return self._apply(lambda t: t.cuda(device))
RuntimeError: CUDA error: out of memory

Linear quantization

Can you please point to the part where the linear quantization is used? Thanks. I can't find it in linear quantize environment.
self.quantizable_layer_types = [QConv2d, QLinear] might be [nn.Conv2d, nn.Linear]?

quantization environment

In quantize_env.py line 130, 131

    self.cur_ind += 1  # the index of next layer
    self.layer_embedding[self.cur_ind][-1] = action

Why cur_ind is increased by one before layer_embedding is updated?

Typo or feature?

In HAQ/lib/utils/data_utils.py in lane 93 valset = datasets.ImageFolder(traindir, test_transform) should be valset = datasets.ImageFolder(valdir, test_transform) ?

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.