[RNE Rewrite] refactor!: add better model schema contract and validation logic - #1327
Open
barhanc wants to merge 22 commits into
Open
[RNE Rewrite] refactor!: add better model schema contract and validation logic#1327barhanc wants to merge 22 commits into
barhanc wants to merge 22 commits into
Conversation
barhanc
force-pushed
the
@bh/schema-refactor
branch
from
July 28, 2026 03:21
2f087c7 to
b1d3391
Compare
…ask specifications
…pers - Re-export schema utilities under a namespaced 'schema' export in index.ts - Re-export types flatly using 'export type *' from ./core/schema - Group constraint helpers under 'constr' object and inline DimRef object literals in task pipelines - Remove redundant static dimension constraint from Whisper task pipeline
…helper and inline DimRef objects
- Expand schema.h file-level docblock to detail the two-phase validation model (load-time validateSpec + runtime validateRuntimeConstraints), explain the two spec source paths (companion method vs MethodMeta fallback), and document output-dimension skipping behaviour pre-execution - Improve individual function docstrings for parseModelSpecJson, validateSpec, and validateRuntimeConstraints to reflect actual behaviour more precisely - Fix whisperSpeechToText decode method spec: replace named symbol strings for static constant dimensions with literal integers (1) to match schema semantics
barhanc
force-pushed
the
@bh/schema-refactor
branch
from
July 28, 2026 23:49
ef56a3f to
cacfa78
Compare
…rce merge behavior
barhanc
marked this pull request as ready for review
July 29, 2026 00:41
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Intoduces a new powerful and extensible mechanism for validating model contracts both during the runtime execution (mitigating e.g. internal error crashes when two input tensors should have the same dimension during runtime) and pipeline construction (matching model contract against a specified interface).
get_model_schemareturning string-encoded JSON. No need for constructing auxiliary tensors for specifying dynamic dimensions, multiple companions for different kinds, etc.Introduces a breaking change?
Type of change
Tested on
Testing instructions
Models that use the companion method to get the JSON schema have not yet been updated on the SWM HF as they wait for the review of this PR. For testing you can use the models at https://huggingface.co/bhanc/scratch/tree/main/ptes.
Screenshots
Related issues
Closes #1323
Checklist
Additional notes
@bh/schema-workflowbranch.@nk/universal-exporterbranch. I would be grateful if you could take a look.