Giter VIP home page Giter VIP logo

[Bug] (suggested fix) `mmrazor.models.algorithms.mm_architecture.MMArchitectureQuant.get_deploy_model()` fails if `predict` mode lacks nodes from the `model.quantizer.tracer.skipped_methods` configuration, but the architecture `quantizer.prepare(fp32_model)` has these nodes. about mmrazor HOT 4 OPEN

elisa-aleman avatar elisa-aleman commented on September 28, 2024
[Bug] (suggested fix) `mmrazor.models.algorithms.mm_architecture.MMArchitectureQuant.get_deploy_model()` fails if `predict` mode lacks nodes from the `model.quantizer.tracer.skipped_methods` configuration, but the architecture `quantizer.prepare(fp32_model)` has these nodes.

from mmrazor.

Comments (4)

elisa-aleman avatar elisa-aleman commented on September 28, 2024

Looking more into it, it seems the tensor mode fix is correct, but the next error has to do with the model having some modules that can't be fake quantized modules like Hard Sigmoid, which are defined in torch.ao.quantization.qconfig_mapping._FIXED_QPARAMS_OP_TO_OBSERVER.

from mmrazor.

Veccoy avatar Veccoy commented on September 28, 2024

Hi! How did you use the output of the method get_deploy_model of MMArchitectureQuant to then convert the model to onnx?

I'm trying to export a quantized model using PyTorch 1.13.1 and using MMDeploy for_mmrazor branch didn't work for me... So, looking at MMRazor, I have created a hook called at the end of the training, that gets the output of get_deploy_model (an torch ObservedGraphModule) and passes it to torch.onnx.export with some arguments.

I'm not sure what I'm doing is right, but I also don't understand why using MMDeploy if MMRazor provides quantizers with onnx_export methods...

EDIT: I have an exported onnx file but it seems that I only have quantized weights and not activations

from mmrazor.

elisa-aleman avatar elisa-aleman commented on September 28, 2024

I used a merge of the most recent mmdeploy with the for_mmrazor branch.

from mmrazor.

Veccoy avatar Veccoy commented on September 28, 2024

Which script(s) are you using? What is the purpose of having a get_deploy_model method in MMRazor that returns an GraphModule and a deploy.py script in MMDeploy that takes a checkpoint file as input? I'm confused. Moreover, we already have an export_onnx method in TorchNativeQuantizer of MMRazor and it seems that the get_deploy_model method is never called in the QAT training of MMRazor.

from mmrazor.

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.