Giter Club home page Giter Club logo

Comments (3)

efrantar avatar efrantar commented on August 18, 2024

Hi, this part of the code and its hyper-parameters are mostly adapted from BRECQ. The purpose of this is to find a narrower quantization grid (relative to the min-max which includes all outliers) by minimizing the p-norm. Setting norm = 2.4 gives slightly more weight to outliers in this search than for norm = 2.

from obc.

vinsis avatar vinsis commented on August 18, 2024

Ok thank you. Another question - where exactly is the quantization happening?

  • The quantize function is simply a chain of affine tranform, clamping and reverse affine transform. It does not reduce the number of bits to store the weights.
  • The bits variable is simply used to calculate maxq which is used to calculate the scale.

I am unable to find where a fp32 value is stored in a bits number of bits.

from obc.

vinsis avatar vinsis commented on August 18, 2024

I guess you could add an extra line in the quantize function like so:

def quantize(x, scale, zero, maxq):
    q = torch.clamp(torch.round(x / scale) + zero, 0, maxq)
    q = convert_q_to_nbits(q, bits)
    return scale * (q - zero)

But I get why you didn't do it. Closing the issue now.

from obc.

Related Issues (10)

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.