Update ONNX export to ONNX 1.22 opsets
Les mainteneurs répondent en général sous 1 jour
@vejbomar y travaille déjà.
Depuis le 22/9/2026.
Évaluation
- Difficulté
- 5/5
- Temps estimé
- Plus d'une semaine
- Accessibilité débutants
- 25/100
- Type d'issue
- Fonctionnalité
- Clarté
- Plutôt claire
- Activité
- Active
- Stack technique
- csharp, machine-learning
- Domaine
- machine-learning
Piste de recherche
Commencez par localiser l’exportateur ONNX de ML.NET, les bindings protobuf générés, les références de base d’exportation ainsi que les zones de validation et de documentation mentionnées dans l’issue ; aucun fichier ni test spécifique n’est nommé. Examinez les schémas émis, les exportations d’arbres et les importations de domaines personnalisés par rapport à ONNX 1.22, puis utilisez les critères d’acceptation indiqués pour vérifier la validité du checker, l’exécution avec ONNX Runtime 1.29, la parité et le chargement d’anciens modèles.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
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
- Langage dominant
- C#
- Étoiles
- 9.4k
- Forks
- 2k
- Merge moyen
- 2 j 18 h
- PR mergées (30 j)
- 64
Préparer son environnement
- Aucun Dockerfile ni fichier Docker Compose
- Propose un modèle de pull request
- Lire le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de dotnet/machinelearning
-
area-Native untriaged
Difficulté 2/5 1-3 heures Accessibilité débutants 76/100
dotnet/machinelearning#7837 ·
Les mainteneurs répondent en général sous 1 jour
-
area-TensorFlow untriaged
Difficulté 2/5 1-3 heures Accessibilité débutants 62/100
dotnet/machinelearning#7836 ·
Les mainteneurs répondent en général sous 1 jour
-
ToArrowRecordBatches accumulates arrays from previous batches, producing invalid record batchesOuvertearea-DataFrame bug untriaged
Difficulté 2/5 1-3 heures Accessibilité débutants 62/100
dotnet/machinelearning#7799 ·
Les mainteneurs répondent en général sous 1 jour
-
LlamaTokenizer encodes some runs of repeated characters differently from SentencePiecePeut-être pris @Laurianti l’a pris il y a 42 jours. Ouvertearea-Tokenizers untriaged
Difficulté 2/5 1-3 heures Accessibilité débutants 88/100
dotnet/machinelearning#7751 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
-
BertTokenizer merges words separated only by `\n`, `\t` or `\r`Peut-être pris @Laurianti l’a pris il y a 23 jours. Ouvertearea-Tokenizers green
Difficulté 2/5 1-3 heures Accessibilité débutants 85/100
dotnet/machinelearning#7724 · 3 commentaires ·
Les mainteneurs répondent en général sous 1 jour
Toutes les issues de dotnet/machinelearning
Issues similaires
-
bug emitter:client:csharp
Difficulté 2/5 1-3 heures Accessibilité débutants 84/100
microsoft/typespec#12572 · 1 commentaire · 1 réaction ·
Les mainteneurs répondent en général sous 1 jour
-
needs-area-label
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
Les mainteneurs répondent en général sous 2 jours
-
AWS Lambda: KeyNotFoundException drops HTTP-triggered transactions when allowAllHeaders is disabledOuvertebug
Difficulté 2/5 1-3 heures Accessibilité débutants 70/100
newrelic/newrelic-dotnet-agent#3949 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
-
area-networking
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
dotnet/aspnetcore#70545 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 87/100
Les mainteneurs répondent en général sous 1 jour