Comments (5)
Greetings, @HFVladimir!
Indeed, it is required in general to export the NNCF-compressed models to ONNX using the compression controller's method, and not via the regular torch.onnx.export
path. Look towards the bottom of the usage code snippet in the README.md.
It seems that the corresponding code is missing in the mmdetection integration patch, which we will be fixing soon. What you would have to do in the mmdetection code is basically this - replace the mmdetection's original torch.onnx.export
call with the comp_ctrl.export_model
taking a single parameter specifying the path to the output ONNX model. Make sure you pass the comp_ctrl
compression controller object to wherever that call occurs. See sample code for examples on where this is done in various training pipelines.
from nncf.
Hi @HFVladimir, actually you can have a look at the export_model
method of the compression controller: https://github.com/openvinotoolkit/nncf_pytorch/blob/develop/nncf/compression_method_api.py#L197-221
We use this method to export quantized models - as you can see, it's not much different from the tools/pytorch2onnx.py
script in mmdetection. You can use the mmdetection script to export you model, just mind the torch.onnx.export
arguments (e.g. opset_version
).
BTW, do you have the FakeQuantize layers properly inserted in your model graph in PyTorch? Could you please share the compressed_graph.dot
file which is dumped to your log directory (you should be able to see FakeQuantize layers present there)?
from nncf.
Our patch for mmdetection is just a simple demonstration of how to include NNCF into a big project. This patch doesn't aim to provide a full function to a user. It is just a demonstration.
If you would like to get full NNCF support in mmdetection I highly recommend you to use mmdetection fork, on which our team is working. There is a readme that expresses instructions on how to export a model to ONNX or OpenVINO and to evaluate these models.
While currently we haven't tested Cascade R-CNN support, in our mmdetection fork we will cover all possible models.
@vshampor
I suppose we can close this issue
from nncf.
@aleksei-kashapov is this resolved by #363?
from nncf.
@aleksei-kashapov is this resolved by #363?
We can not guarantee the support of Cascade R-CNN as export to ONNX is currently unavailable in the official mmdetetction repo. But this model will have an export in our fork, which is here https://github.com/openvinotoolkit/mmdetection
from nncf.
Related Issues (20)
- Compressed models that call torch.is_floating_point() during inference are traced with runtime error.
- nncf + ultralytics yolov8 training-time compression HOT 7
- Ultralytics yolov8 QAT example HOT 1
- [Good First Issue] [NNCF] Make NNCF common utils code pass mypy checks HOT 23
- [Good First Issue] [NNCF] Make NNCF common accuracy aware training code pass mypy checks HOT 17
- [Good First Issue] [NNCF] Make NNCF common tensor statistics code pass mypy checks HOT 9
- [Good First Issue] [NNCF] Make NNCF common sparsity code pass mypy checks HOT 6
- Thanks to our Contributors HOT 1
- [Good First Issue][NNCF]: Add INT8 weight compression conformance test for Tinyllama-1.1b PyTorch model HOT 19
- [Good First Issue][NNCF]: Fixing NNCFGraph export for visualization in Netron HOT 6
- Why doesn't the size and precision of the model change after INT4 quantization? HOT 2
- [Good First Issue][NNCF]: Optimize memory footprint by removing redundant collected statistics HOT 8
- [Good First Issue][NNCF]: Dump actual_subset_size to ov.Model HOT 8
- [Good First Issue][NNCF]: dump the ignored scope more gracefully HOT 4
- [Good First Issue][NNCF]: check number of u8, u4 constants in weight compression tests HOT 10
- PTQ of Fast R-CNN crashes in PyTorch backend HOT 1
- [Good First Issue][NNCF]: fix invalid error reporting in JSON schema HOT 19
- [Good First Issue][NNCF]: Add tests for torch device utils HOT 5
- [Good First Issue][NNCF]: Remove compress_to_fp16=False from examples HOT 3
- AttributeError: 'list' object has no attribute 'keys' when executing yolov8_quantize_with_accuracy_control example HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nncf.