optimizer icon indicating copy to clipboard operation
optimizer copied to clipboard

CleanUnusedInitializersAndNodeArgs warning still issued after onnxoptimizer run

Open sharvil opened this issue 3 years ago • 1 comments

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')

sharvil avatar Jan 11 '23 04:01 sharvil

@sharvil It is recommended that use onnx-simplifier .

HSQ79815 avatar Feb 17 '23 09:02 HSQ79815