Code Monkey home page Code Monkey logo

Comments (9)

jiaxiang-wu avatar jiaxiang-wu commented on July 20, 2024
  • For compressed models generated by UniformQuantTFLearner, all the operations that match TensorFlow's rule for tf.contrib.quantize.experimental_create_training_graph will be quantized. For MobileNet-v1 and MobileNet-v2, all operations will be quantized; for ResNet models, some operation may not be quantized (at least this is true for TensorFlow-1.10.0).
  • For TF-Lite models generated by tools/conversion/export_quant_tflite_model.py with the enbl_post_quant option enabled, all operations will be quantized.
  • By "chips", which hardware do you refer to exactly? Do you have the corresponding DL inference engine for that hardware, with integer operations supported?

from pocketflow.

wangxianrui avatar wangxianrui commented on July 20, 2024

em..I am just working on a project, and the other requires a fully_quantized model to run on their 'chips', but i do not know exactly.

from pocketflow.

jiaxiang-wu avatar jiaxiang-wu commented on July 20, 2024

In short, you need to know which inference engine they are using, and then try to obtain a fully-quantized model (maybe not from PocketFlow) that can be parsed by that inference engine.

from pocketflow.

Aspirinkb avatar Aspirinkb commented on July 20, 2024

Will you give the details of how the quantized model weights are saved and how they run mathmatically? So one can implement the model on some specific devices for inference acceleration.

from pocketflow.

jiaxiang-wu avatar jiaxiang-wu commented on July 20, 2024

@Aspirinkb
For UniformQuantTFLearner, we are using TensorFlow's quantization-aware training API, i.e.:

tf.contrib.quantize.experimental_create_training_graph(
    input_graph=None,
    weight_bits=8,
    activation_bits=8,
    quant_delay=0,
    freeze_bn_delay=None,
    scope=None
)

to modify the graph and insert quantization operations. You may refer to their documentations to see how it works in details.

from pocketflow.

Aspirinkb avatar Aspirinkb commented on July 20, 2024

If I prefer to use UniformQuantLearner of PocketFlow's to quantize models rather than TensorFlow's, where can I get the details of the quantized models about their weights, graphs and so on? Do you give some inference implementations about that?If not, I think it is a necessary feature of PocketFlow. What do you think?

from pocketflow.

wangxianrui avatar wangxianrui commented on July 20, 2024

I also have a question about Uniform Quantization Learner, is this method just quantize weight and activation? So, the data flows int network is still float type, instead ofquantize bits such as 8 or 4 bits?
thanks!

from pocketflow.

jiaxiang-wu avatar jiaxiang-wu commented on July 20, 2024

@Aspirinkb
UniformQuantLearner is mainly for research purpose (for instance, to see how well RL can determine the bit-width allocation strategy). An efficient inference implementation heavily relies on the hardware platform and requires lots on work. For efficient deployment, we recommend you to use UniformQuantTFLearner, which can be deployed under the TensorFlow Lite framework.

from pocketflow.

jiaxiang-wu avatar jiaxiang-wu commented on July 20, 2024

@wangxianrui
What are you referring to with "data flows in the network"? Gradients are in 32-bit full-precision. Model weights have both quantized version (for forward pass and backward pass) and unquantized version (for gradient update). Layer activations are quantized.

from pocketflow.

Related Issues (20)

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.