A tool for ONNX model:Shape inference, MACs(FLOPs) counting for each layer, Extract subgraph from ONNX model, or do inplace op fusion, and any operation you can image with ONNX.
Project description
onnx-tool
A tool for ONNX model:
- Shape inference.
- MACs(FLOPs) counting for each layer.
- Extract subgraph from ONNX model, or do inplace op fusion.
...
and any operation you can image with ONNX.
New:
- Quantized models are initially supported in v0.3.0 release.
- 4 onnx models of Stable Diffusion are supported in v0.2.14 release. view results
- Memory usage of each layer is valid in v0.2.10 release.
- Pytorch models are also valid if torch.onnx.export succeeded.
Shape inference
how to use: data/Profile.md.
pytorch usage: data/PytorchUsage.md.
MACs counting for each layer (FLOPs=2*MACs)
Float MultipleAdd Count, Memory Usage(in bytes), Parameters(elements number)
how to use: data/Profile.md.
pytorch usage: data/PytorchUsage.md.
Extract subgraph from ONNX model
how to use: data/Subgraph.md.
Inplace op fusion
how to use: data/Subgraph.md.
Add any hidden tensors to model's outputs
how to use: data/Profile.md.
Tensor operations
- Export weight tensors to files
- Simplify tensor and node names, convert name from a long string to a short string
- Remove unused tensors, models like vgg19-7.onnx set its static weight tensors as its input tensors
- Set custom input and output tensors' name and dimension, change model from fixed input to dynamic input
how to use: data/Tensors.md.
How to install
pip install onnx-tool
OR
pip install --upgrade git+https://github.com/ThanatosShinji/onnx-tool.git
python>=3.6
If pip install onnx-tool
failed by onnx's installation, you may try pip install onnx==1.8.1
(a lower version like this) first.
Then pip install onnx-tool
again.
Known Issues
- Loop op is not supported
Results of ONNX Model Zoo and SOTA models
Some models have dynamic input shapes. The MACs varies from input shapes. The input shapes used in these results are writen to data/public/config.py. These onnx models with all tensors' shape can be downloaded: baidu drive(code: p91k) google drive
|
|
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for onnx_tool-0.3.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 10be2f9fa08b4445f74dc4c3817ba10228f60488180123c7b30ddf8385d880f1 |
|
MD5 | 64d3ff37e6ba2355bf4678a073c587f8 |
|
BLAKE2b-256 | de41197b07d2fba7ef5b7f31b6e13459664911592086579a0b911947856556f1 |