Update ONNX export to ONNX 1.22 opsets
メンテナーはふだん 1 日以内に返信
@vejbomar がすでに取り組んでいます。
2026年9月22日 から。
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 25/100
- issue の種類
- 機能追加
- 明瞭さ
- おおむね明確
- 活発さ
- 活発
- 技術スタック
- csharp, machine-learning
調査の方向性
まず、ML.NET の ONNX エクスポーター、生成された protobuf バインディング、エクスポートのベースライン、および issue で参照されている検証とドキュメントの領域を特定します。特定のファイルやテストは指定されていません。出力されるスキーマ、ツリーのエクスポート、カスタムドメインのインポートを ONNX 1.22 と照合して確認し、その後、示されている受け入れ基準を使用して、checker の妥当性、ONNX Runtime 1.29 での実行、パリティ、旧モデルの読み込みを検証します。
索引モデルが issue の本文から書いたものです。
説明
Update ML.NET's ONNX exporter to target the latest released ONNX specification:
- ONNX version: 1.22
- Core
ai.onnxopset: 27 ai.onnx.mlopset: 5- ONNX Runtime: 1.29
ML.NET currently targets core opset 12 and ai.onnx.ml opset 2. Maintaining these old targets limits future exporter development and leaves several emitted graphs using obsolete operator schemas.
Motivation
The latest released opsets should be ML.NET's primary export target. Compatibility with older runtimes should not prevent the exporter from tracking the maintained ONNX specification.
Moving to the current opsets will:
- Allow new exporters to use modern ONNX operators and data types.
- Enable standard bitwise and string operators where suitable.
- Enable the newer
TreeEnsemblerepresentation. - Allow tree thresholds and weights to retain double precision through tensor attributes.
- Align exported models with a currently maintained ONNX Runtime release.
- Remove accumulated schema and domain-import debt.
This intentionally raises the runtime requirement for newly exported models. Existing ONNX files and ML.NET's ability to consume older models are unaffected.
Required changes
Update versions and dependencies
- Change the default core opset from 12 to 27.
- Change the
ai.onnx.mlopset from 2 to 5. - Upgrade
Microsoft.ML.OnnxRuntimeto 1.29. - Refresh the generated ONNX protobuf bindings from ONNX 1.22.
- Update the emitted IR version as required by the features used.
- Update public documentation and validation of supported target versions.
Emit current core operator schemas
Update operators whose signatures changed after opset 12:
- Emit
axesas anint64tensor input forSqueeze,Unsqueeze, andReduceSum. - Emit
axesas an input for the remainingReduce*operators changed in opset 18. - Emit
Clipbounds as inputs rather than attributes. - Review every emitted core operator against its opset-27 schema.
- Preserve ML.NET inference behaviour and output shapes.
There are currently more than twenty axes attributes across the exporter which require review.
Migrate tree exports
TreeEnsembleRegressor and TreeEnsembleClassifier are deprecated in ai.onnx.ml opset 5 and are rejected by the official ONNX checker.
- Replace the existing tree representation with
TreeEnsemble. - Reconstruct classification labels and scores where necessary.
- Use tensor-valued splits and weights to avoid unnecessary float conversion.
- Preserve missing-value routing and post-transform behaviour.
- Cover FastTree, FastForest, LightGBM, ranking, regression, and classification exports.
Correct operator-domain imports
ML.NET emits operators from the com.microsoft domain for tokenisation, hashing, and some trainer graphs, but currently writes only the core and ai.onnx.ml imports.
- Track every operator domain used by a graph.
- Emit a corresponding
opset_importentry for each domain. - Add
com.microsoftversion 1 when required. - Avoid importing unused domains where practical.
Compatibility
Newly exported models will require a runtime supporting core opset 27 and ai.onnx.ml opset 5. ONNX Runtime 1.29 is the corresponding current release.
Support for producing older opsets may remain available where it is correct and maintainable, but it must not constrain or delay the current default exporter.
Acceptance criteria
- Default exports declare core opset 27 and
ai.onnx.mlopset 5. - Exported models use valid schemas for those opsets.
- Every exported model passes the ONNX 1.22 checker with full checking enabled.
- Every exported model loads and executes with ONNX Runtime 1.29.
- ONNX results retain parity with the corresponding ML.NET pipeline.
- Tree-based models use the non-deprecated
TreeEnsembleoperator. - Every custom operator domain has an
opset_importentry. - Existing export baselines and documentation are updated.
- Loading and executing existing older ONNX models remains supported.
Non-goals
- Targeting unreleased core opset 28.
- Automatically rewriting ONNX files previously exported by ML.NET.
- Implementing every operator introduced between opsets 12 and 27.
References
- 主要言語
- C#
- スター
- 9.4k
- フォーク
- 2k
- 平均マージ
- 2日 18時間
- マージ済み PR(30日)
- 64
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
dotnet/machinelearning のほかの issue
-
area-Native untriaged
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
dotnet/machinelearning#7837 ·
メンテナーはふだん 1 日以内に返信
-
area-TensorFlow untriaged
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
dotnet/machinelearning#7836 ·
メンテナーはふだん 1 日以内に返信
-
ToArrowRecordBatches accumulates arrays from previous batches, producing invalid record batchesオープンarea-DataFrame bug untriaged
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
dotnet/machinelearning#7799 ·
メンテナーはふだん 1 日以内に返信
-
LlamaTokenizer encodes some runs of repeated characters differently from SentencePiece対応中かも @Laurianti が 42 日前に担当しました。 オープンarea-Tokenizers untriaged
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
dotnet/machinelearning#7751 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
BertTokenizer merges words separated only by `\n`, `\t` or `\r`対応中かも @Laurianti が 23 日前に担当しました。 オープンarea-Tokenizers green
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
dotnet/machinelearning#7724 · コメント 3 件 ·
メンテナーはふだん 1 日以内に返信
dotnet/machinelearning の issue をすべて見る
似ている issue
-
bug emitter:client:csharp
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
microsoft/typespec#12572 · コメント 1 件 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
-
needs-area-label
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 2 日以内に返信
-
AWS Lambda: KeyNotFoundException drops HTTP-triggered transactions when allowAllHeaders is disabledオープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
newrelic/newrelic-dotnet-agent#3949 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
area-networking
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
dotnet/aspnetcore#70545 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 87/100
メンテナーはふだん 1 日以内に返信