onnx / onnx/optimizer

[BUG] Pass “split_init“ produces invalid model (missing value_info.type)

Open
#256 0 comments 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

Pass “split_init“ produces invalid model (missing value_info.type)

Issue
Running the single pass split_init with onnxoptimizer 0.3.19 makes the optimized model fail ONNX validation: ValidationError("Field 'type' of 'value_info' is required but missing."). The optimizer falls back to the original model. Differential testing shows outputs remain identical, indicating the failure is structural (missing type info) rather than numerical drift.

Environment

  • Ubuntu 20.04
  • Python 3.10
  • onnx==1.19.0
  • onnxruntime==1.23.2
  • onnxoptimizer==0.3.19 (latest)

Repro steps (run from this folder)

  1. Download and unzip the attached archive, then cd into the extracted directory

split_init_repro.tar.gz

tar -xzvf split_init_repro.tar.gz
cd split_init_repro
  1. Create a Python environment (Python 3.10) and install dependencies:
python3 -m venv .venv
source .venv/bin/activate
pip install -U pip
pip install -r requirements.txt
  1. Optimize the case with only split_init:
  • python optimize_model.py --case ./case_00114_seed21153785
    • Warning observed during optimize: optimized model failed validation (ValidationError("Field 'type' of 'value_info' is required but missing.")); falling back to original model
    • The optimized model is invalid due to missing value_info.type.
  1. Differential test original vs optimized outputs using stored oracle inputs:
  • python diff_test.py --case ./case_00114_seed21153785

Observed results

  • python optimize_model.py --case case_00114_seed21153785 prints: Warning: optimized model failed validation (ValidationError("Field 'type' of 'value_info' is required but missing.")); falling back to original model
  • Differential test:
    • Case: case_00114_seed21153785
    • Each output node is identical (max_abs=0, max_rel=0)

Expected
split_init should produce a valid, checkable model. The pass currently emits a graph missing value_info.type, causing onnx.checker to fail even though numerical outputs match the original. Please investigate how the pass handles value_info when splitting the graph.

Differential Test Output Details

Case: case_00114_seed21153785
All outputs are identical (max_abs=0, max_rel=0)

Attachments

  • README.md (this document)
  • requirements.txt (dependency versions)
  • optimize_model.py (runs only split_init and saves model.opt.onnx)
  • diff_test.py (runs original vs optimized with oracle inputs; prints equality when all outputs match)
  • case_00114_seed21153785/ (contains model.onnx and oracle.pkl used for both runs)

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

Reproduce the failure with optimize_model.py using the split_init pass, then inspect the optimizer code handling value_info during graph splitting. Use diff_test.py to confirm outputs remain identical, and verify completion with onnx.checker accepting the optimized model without a missing value_info.type error.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, python
Domain
machine-learning, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.