Install onnxoptimizer

This commit is contained in:
Fangjun Kuang 2024-04-09 14:55:58 +08:00
parent 10ae39f8ab
commit 589eb626f9
16 changed files with 26 additions and 8 deletions

View File

@ -2,6 +2,8 @@
set -ex
python3 -m pip install onnxoptimizer
log() {
# This function is from espnet
local fname=${BASH_SOURCE[1]##*/}

View File

@ -49,6 +49,7 @@ RUN pip install --no-cache-dir \
multi_quantization \
numba \
numpy \
onnxoptimizer \
onnx \
onnxmltools \
onnxruntime \

View File

@ -55,6 +55,7 @@ RUN pip install --no-cache-dir \
onnx \
onnxruntime \
onnxmltools \
onnxoptimizer \
multi_quantization \
typeguard \
numpy \

View File

@ -55,6 +55,7 @@ RUN pip install --no-cache-dir \
onnx \
onnxruntime \
onnxmltools \
onnxoptimizer \
multi_quantization \
typeguard \
numpy \

View File

@ -69,6 +69,7 @@ RUN pip uninstall -y tqdm && \
onnx \
onnxruntime \
onnxmltools \
onnxoptimizer \
multi_quantization \
typeguard \
numpy \

View File

@ -56,6 +56,7 @@ RUN pip install --no-cache-dir \
onnx \
onnxruntime \
onnxmltools \
onnxoptimizer \
multi_quantization \
typeguard \
numpy \

View File

@ -56,6 +56,7 @@ RUN pip install --no-cache-dir \
onnx \
onnxruntime \
onnxmltools \
onnxoptimizer \
multi_quantization \
typeguard \
numpy \

View File

@ -56,6 +56,7 @@ RUN pip install --no-cache-dir \
onnx \
onnxruntime \
onnxmltools \
onnxoptimizer \
multi_quantization \
typeguard \
numpy \

View File

@ -56,6 +56,7 @@ RUN pip install --no-cache-dir \
onnx \
onnxruntime \
onnxmltools \
onnxoptimizer \
multi_quantization \
typeguard \
numpy \

View File

@ -56,6 +56,7 @@ RUN pip install --no-cache-dir \
onnx \
onnxruntime \
onnxmltools \
onnxoptimizer \
multi_quantization \
typeguard \
numpy \

View File

@ -56,6 +56,7 @@ RUN pip install --no-cache-dir \
onnx \
onnxruntime \
onnxmltools \
onnxoptimizer \
multi_quantization \
typeguard \
numpy \

View File

@ -56,6 +56,7 @@ RUN pip install --no-cache-dir \
onnx \
onnxruntime \
onnxmltools \
onnxoptimizer \
multi_quantization \
typeguard \
numpy \

View File

@ -56,6 +56,7 @@ RUN pip install --no-cache-dir \
onnx \
onnxruntime \
onnxmltools \
onnxoptimizer \
multi_quantization \
typeguard \
numpy \

View File

@ -56,6 +56,7 @@ RUN pip install --no-cache-dir \
onnx \
onnxruntime \
onnxmltools \
onnxoptimizer \
multi_quantization \
typeguard \
numpy \

View File

@ -38,6 +38,7 @@ from typing import Dict
import k2
import onnx
import onnxoptimizer
import torch
import torch.nn as nn
from onnxruntime.quantization import QuantType, quantize_dynamic
@ -234,12 +235,13 @@ def export_audio_tagging_model_onnx(
def optimize_model(filename):
# see https://github.com/microsoft/onnxruntime/issues/1899#issuecomment-534806537
from onnx import optimizer
# see
# https://github.com/microsoft/onnxruntime/issues/1899#issuecomment-534806537
# and
# https://github.com/onnx/onnx/issues/582#issuecomment-937788108
passes = ["extract_constant_to_initializer", "eliminate_unused_initializer"]
onnx_model = onnx.load(filename)
optimized_model = optimizer.optimize(onnx_model, passes)
optimized_model = onnxoptimizer.optimize(onnx_model, passes)
onnx.save(optimized_model, filename)

View File

@ -8,13 +8,14 @@ pypinyin==0.50.0
tensorboard
typeguard
dill
onnx==1.15.0
onnxruntime==1.16.3
onnx>=1.15.0
onnxruntime>=1.16.3
onnxoptimizer
# style check session:
black==22.3.0
isort==5.10.1
flake8==5.0.4
flake8==5.0.4
# cantonese word segment support
pycantonese==3.4.0
pycantonese==3.4.0