Emit current shape-only ONNX GenAI tensor contracts - #725
Conversation
Publish explicit tensor shapes from the shared ONNX GenAI metadata authority, preserve symbolic and unconstrained dimensions, and remove retired workflow capabilities. Refresh all 15 conformance packages and validate them against the current consumer TensorContract schema. Co-authored-by: Copilot <[email protected]>
|
Closing per project decision to pause cross-repository producer coordination and make the onnx-genai Mobius conformance signal manual-only for now. The implementation remains available in this PR if producer conformance is resumed later. |
| @@ -0,0 +1,74 @@ | |||
| # Copyright (c) Microsoft Corporation. | |||
|
|
||
|
|
||
| def test_published_metadata_rejects_rank_shape_disagreement(): | ||
| with pytest.raises(ValueError, match="declares rank 2.*has rank 1"): |
Performance Comparison
|
There was a problem hiding this comment.
🔵 Needs a closer look
It changes a broad, externally-consumed metadata/schema surface (tensor contracts + manifest) across many fixtures and producers, so a final human verification of downstream compatibility is warranted.
Pull request overview
This PR updates Mobius’ ONNX GenAI inference-metadata emission to match the current schema expectations by removing retired rank fields from tensor contracts and retiring the workflow manifest capabilities list, while preserving explicit shape semantics (including scalars shape: [], symbolic dims, and unconstrained Any dims). It also refreshes the conformance fixtures and adds tests to ensure produced packages continue to validate against the canonical JSON schema.
Changes:
- Retire tensor-contract
rankemission (schema + producers + tests) and rely onshapelength as the sole rank signal. - Remove/normalize away
pipeline.workflow.manifest.capabilitiesand centralize YAML serialization via_dump_yaml+_published_metadata. - Add a schema-validation test over all generated signal packages and refresh all fixture snapshots to the new serialized form.
File summaries
| File | Description |
|---|---|
| tests/static_cache_metadata_test.py | Updates static-cache assertions from rank to shape/len(shape). |
| tests/onnx_genai_current_schema_test.py | New test validating all materialized packages against the current JSON schema. |
| tests/generate_onnx_genai_validation_packages.py | Uses _dump_yaml for deterministic, normalized metadata output. |
| tests/compare_onnx_genai_validation_packages.py | Adds invariant check that retired tensor-contract rank is not serialized. |
| tests/canonical_workflow_contract_test.py | Updates contract assertions to require shape and forbid rank. |
| tests/fixtures/onnx_genai_workflows/vlm/inference_metadata.yaml | Snapshot refresh: removes rank fields and workflow capabilities. |
| tests/fixtures/onnx_genai_workflows/video/inference_metadata.yaml | Snapshot refresh: removes rank fields and workflow capabilities. |
| tests/fixtures/onnx_genai_workflows/tts/inference_metadata.yaml | Snapshot refresh: removes rank fields and workflow capabilities. |
| tests/fixtures/onnx_genai_workflows/static_cache/inference_metadata.yaml | Snapshot refresh: removes rank fields and workflow capabilities. |
| tests/fixtures/onnx_genai_workflows/speculative/inference_metadata.yaml | Snapshot refresh: removes rank fields and workflow capabilities. |
| tests/fixtures/onnx_genai_workflows/shared_state_pixel_flow/inference_metadata.yaml | Snapshot refresh: removes rank fields and workflow capabilities. |
| tests/fixtures/onnx_genai_workflows/protbert_protein_embeddings/inference_metadata.yaml | Snapshot refresh: removes rank, updates dynamic dims to Any where appropriate. |
| tests/fixtures/onnx_genai_workflows/masked/inference_metadata.yaml | Snapshot refresh: removes rank fields and workflow capabilities. |
| tests/fixtures/onnx_genai_workflows/hierarchical_audio/inference_metadata.yaml | Snapshot refresh: removes rank fields and workflow capabilities. |
| tests/fixtures/onnx_genai_workflows/esm2_protein_embeddings/inference_metadata.yaml | Snapshot refresh: removes rank fields and workflow capabilities. |
| tests/fixtures/onnx_genai_workflows/diffusion/inference_metadata.yaml | Snapshot refresh: removes rank fields and workflow capabilities. |
| tests/fixtures/onnx_genai_workflows/diffusion_guided/inference_metadata.yaml | Snapshot refresh: removes rank fields and workflow capabilities. |
| tests/fixtures/onnx_genai_workflows/decoder/inference_metadata.yaml | Snapshot refresh: removes rank fields and workflow capabilities. |
| tests/fixtures/onnx_genai_workflows/codec/inference_metadata.yaml | Snapshot refresh: removes rank fields and workflow capabilities. |
| tests/fixtures/onnx_genai_workflows/adapter/inference_metadata.yaml | Snapshot refresh: removes rank fields and workflow capabilities. |
| src/mobius/models/sensenova_u1_test.py | Updates shared-state workflow expectations to forbid manifest capabilities. |
| src/mobius/integrations/onnx_genai/workflow_metadata_test.py | Updates workflow tests to forbid manifest capabilities and rely on shape. |
| src/mobius/integrations/onnx_genai/speech_to_text_workflow_metadata_test.py | Updates tests to forbid manifest capabilities. |
| src/mobius/integrations/onnx_genai/speech_enhancement_metadata_test.py | Updates tests to use len(shape) rather than rank. |
| src/mobius/integrations/onnx_genai/shared_state_flow_metadata.py | Removes rank from emitted tensor contracts; keeps explicit shape. |
| src/mobius/integrations/onnx_genai/package_facts_test.py | Updates image media contract assertion from rank to shape. |
| src/mobius/integrations/onnx_genai/inference_metadata.py | Removes rank dependence in contract compatibility and routes YAML writes through _dump_yaml. |
| src/mobius/integrations/onnx_genai/inference_metadata_test.py | Updates test fixtures/helpers to match shape-only contract serialization. |
| src/mobius/integrations/onnx_genai/decoder_metadata.py | Uses _dump_yaml for normalized YAML serialization. |
| src/mobius/integrations/onnx_genai/convert.py | Uses _dump_yaml for normalized YAML serialization. |
| src/mobius/integrations/onnx_genai/codec_workflow_metadata_test.py | Updates codec workflow contract assertion to remove rank. |
| src/mobius/integrations/onnx_genai/auto_export_test.py | Updates auto-export workflow assertions from rank to shape/len(shape) and forbids capabilities. |
| src/mobius/integrations/onnx_genai/_workflow_contract.py | Makes shape emission explicit (errors on unknown rank), uses Any for anonymous dynamic dims, and normalizes returned workflow via _published_metadata. |
| src/mobius/integrations/onnx_genai/_schema/inference_metadata.schema.json | Updates schema: removes tensor-contract rank requirement, requires shape array, and documents Any semantics. |
| src/mobius/integrations/onnx_genai/_metadata_io.py | Introduces _published_metadata normalization and _dump_yaml wrapper used by writers. |
| src/mobius/integrations/onnx_genai/_metadata_io_test.py | New unit tests covering normalization behavior and Any shape semantics. |
Review details
- Files reviewed: 37/37 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Summary
rankemission from the shared ONNX GenAI metadata builders and serializershape: [], named symbolic dimensions, and independentAnydynamic dimensions without inventing fixed extentsFixes the producer failure reported by onnx-genai signal run https://github.com/justinchuby/onnx-genai/actions/runs/33886695719.
Validation
git diff --checkA broader local non-integration run also reproduced three unrelated failures unchanged on Mobius
origin/main(GGUF evidence expectation, Qwen Image diffusers API drift, and ModernBERT synthetic tolerance).