Git Product home page Git Product logo

dsq's People

Contributors

ricky40403 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

dsq's Issues

poor performance on CIFAR10

Hi, thank you for your implementation!

I use the CIFAR10 dataset for quick training and evaluation on the 8-bit setting, but I only got not more than 80%@top1 accuracies with/without activation quantization. Could you give me any clue of why this happens? The learning rate is decreased by 10x every 30 epochs. But the accuracy stops increasing after around 40-50 epochs.

Thanks for your attention!

RuntimeError: derivative for floor_divide is not implemented

Very appreciate for your implementation.
"RuntimeError: derivative for floor_divide is not implemented"
I have encounter this problem when i try to transform the conv layer to DSQ conv ,
and I can't find this function implement anywhere in the code.
Would you please tell me how to solve the above problem?
Thank you very much.

The code actually does not quantize in the right way when the quant_bit is not 8

Hi.
In the code, function "set_quanbit()" is used to set the quantization bit for weights. However, in function "set_quanbit()", only attribute "num_bit" is modified, while attribute "bit_range" is left unchanged.

def set_quanbit(model, quan_bit = 8): for module_name in model._modules: if len(model._modules[module_name]._modules) > 0: set_quanbit(model._modules[module_name], quan_bit) else: if hasattr(model._modules[module_name], "num_bit"): setattr(model._modules[module_name], "num_bit", quan_bit) return model

Because the default initialized value of attribute "num_bit" in class "DSQConv" is 8, the attribute "bit_range" will be initialized when the "num_bit" is 8, but the attribute "bit_range" is not modified when "num_bit" is changed. This means that when we set quant_bit other than 8, the weights will not quantize correctly.

class DSQConv(nn.Conv2d): def __init__(self, in_channels, out_channels, kernel_size, stride=1, padding=0, dilation=1, groups=1, bias=True, momentum = 0.1, num_bit = 8, QInput = True, bSetQ = True):

To fix this bug, I recommend reset attribute "bit_range" as well in function "set_quanbit()".

About performance.

Hi, thanks for sharing this great implementation. I wonder if you have ever evaluated the module you wrote, does it performs same with the paper's performance?

Some Problem

@ricky40403
Hey, thanks for your great work. When i read the paper and your code, i have three question:

  1. Can i set quan_bit to 2 or 4?
  2. I notice tested in 4 bit with res18 on imagenet, can you release the evaluate code. Have you implement the low-bits GEMM by the MLA instruction on ARM NEON?
  3. Can i transfer the algorithm to mobilenet or shufflenet serial model, have you try?

Nan (or inf) is occured during training

@ricky40403
Thanks for your hard and great work.
I copied the DSQConv.py into my project and used DSQConv instead of nn.conv2d except the first and the last layers. However during the training process, after several iterations I found that the value of alphaW is less than zero. It further caused the value of k is Nna. I used 0.5 as initial value of alphaW and set the initial learning rate to 0.001.
Would you please tell me the possible reasons of the above problem?
Thank you very much.

forward() does not recognize own class attributes

Hello. First of all, congratulation on your work. I would like to reproduce your work but I am facing a strange problem. When trying to use your DSQConv layer, I get the following error:
"torch.nn.modules.module.ModuleAttributeError: 'DSQConv' object has no attribute 'running_lw'"
Changing register_buffer for simple attribute assignment did not fix it. Can you reproduce the problem or help me in any way?

I would also like to ask you how can I store the models in an encoded way to compare the storage savings of lower bit range solutions.

Thank you in advance.

error

from PyTransformer.transformers.quantize import QConv2d, QuantConv2d, QLinear, ReLUQuant
ImportError: cannot import name 'QuantConv2d'

the 'QuantConv2d' function is not in the file .

Is there a problem with the code?thinks

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.