onnx / optimizer

Actively maintained ONNX Optimizer
Apache License 2.0
647 stars 90 forks source link

CleanUnusedInitializersAndNodeArgs warning still issued after onnxoptimizer run #110

Open sharvil opened 1 year ago

sharvil commented 1 year ago

I converted a model from PyTorch to ONNX. The ONNX model produces > 100 warnings of the type:

2023-01-10 20:26:41.949523885 [W:onnxruntime:, graph.cc:3487 CleanUnusedInitializersAndNodeArgs] Removing initializer '1026'. It is not used by any node and should be removed from the model.

I used the following code to run onnxoptimizer on the model:

import onnx
import onnxoptimizer

model = onnx.load('model.onnx')
passes = onnxoptimizer.get_fuse_and_elimination_passes()
model = onnxoptimizer.optimize(model, passes)
onnx.save(model, 'model-opt.onnx')

I'm still seeing the same warnings when I load the optimized model. Here are the package versions I'm using:

>>> onnx.__version__, onnxoptimizer.__version__
('1.13.0', '0.3.6')
HSQ79815 commented 1 year ago

@sharvil It is recommended that use onnx-simplifier .