onnx / onnx/optimizer

CleanUnusedInitializersAndNodeArgs warning still issued after onnxoptimizer run

Open
#110 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
834
Forks
109
Avg merge
6h 55m
Merged PRs (30d)
2

Description

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

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Python reproduction using ONNX 1.13.0 and onnxoptimizer 0.3.6, then inspect how get_fuse_and_elimination_passes() and optimize() handle unused initializers. Reproduce the warnings on the saved model and identify whether optimization should remove them; done means the reported warnings no longer appear or the behavior is clearly documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.