Comments (5)
Hi @cattpku,
We're waiting for the ONNX quantization standard, before supporting ONNX export of quantized models. See #23 for some discussion.
You can export a non-quantized model to ONNX using --summary=onnx
.
Cheers
Neta
from distiller.
Hi Neta,
I tried to export a non-quantized model to ONNX as advised, however, got a RuntimeError 'ONNX export failed: Couldn't export operator aten::softmax'.
I know this layer is added in Distiller, and I checked the corresponding 'torch/onnx/symbolic.py', the 'softmax' definition is there.
After checking Pytorch 0.4.0 doc, for 'torch.onnx' it stated 'softmax (only dim=-1 supported)', while in 'model_summaries.py', it is 'softmax = torch.nn.Softmax(dim=1)'.
Can you kindly advise? Thanks.
from distiller.
Hi @cattpku ,
Please share your command-line, so I can try to recreate this problem.
I think that using
softmax = torch.nn.Softmax(dim=-1)
is probably more correct, but I want to see why it fails for you before making changes to the code.
BTW, you can also try to change it to -1
and report if this fixes the fail you see.
Thanks
Neta
from distiller.
Hi Neta,
I am not using command-line, as I put the whole code in Pycharm to run it. I just set the following args:
--data: my own dataset path
--arch: my own network definition
--summary: default = 'onnx'
I tried to change it to -1 as suggested, it went well, no error occurred.
from distiller.
Thanks, for classification tasks the softmax input has shape==(1, num_classes) so
softmax = torch.nn.Softmax(dim=1)
and
softmax = torch.nn.Softmax(dim=-1)
are the same. But as you point out, for the general case we should follow the PyTorch ONNX limitations.
from distiller.
Related Issues (20)
- Could you provide the checkpoints for structural pruning experiments?
- checkpoints example in example jupyter-notebook download denied. HOT 1
- Support for PyTorch 1.7? HOT 3
- Can't install pyglet, even when i cloned it form github
- Higher than 8-bit Quantization not working properly!?
- yolo4 custom object detection deep compression
- Why can't I use multi-GPU training
- How can I use the distilled model in embedded device?
- Combining quantization and pruning in Distiller
- Issue running compress_classifier.py HOT 1
- Reduce the yolov3 model size of keras(.h5) or darknet(.weight)
- Quantization don't reduce the model file size
- How to train my original dataset in distiller? HOT 1
- Error running 'pip install mintapi' on Raspberry Pi
- --load-serialized will make model fail to prune HOT 1
- QAT for LSTM
- outdated requirements? HOT 2
- Sensitivity Analysis
- Does it support translation model?
- Load quantization aware model checkpoint (inference) HOT 1
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 distiller.