Skip to content

feat(0805): Add semantic ONNX names for w_sub exports - #1241

Open
vbaddi wants to merge 1 commit into
mainfrom
wsub-semantic-onnx-names
Open

feat(0805): Add semantic ONNX names for w_sub exports#1241
vbaddi wants to merge 1 commit into
mainfrom
wsub-semantic-onnx-names

Conversation

@vbaddi

@vbaddi vbaddi commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Preserve semantic HF parameter names during TorchScript w_sub export
  • Rename local-function weighted nodes such as self_attn/q_proj/MatMul
  • Register the graph-only rename transform automatically for use_onnx_subfunctions=True
  • Bump the w_sub export cache version to avoid reusing older opaque ONNX artifacts
  • Add focused ONNX transform and quickcheck coverage.

Tests

  • pytest -q tests/base/test_onnx_transforms.py -k rename_wsub
  • pytest -q tests/unit_test/models/test_model_quickcheck.py -k semantic_weight_and_node_names
  • pytest -q tests/transformers/qeff_classes/test_automodel_for_causal_lm.py -k "hash_creation and llama and
    subfunc"

@vbaddi vbaddi added enhancement New feature or request 1.23 Release 1.23 Features ci_ready labels Aug 5, 2026
@ochougul ochougul removed the ci_ready label Aug 7, 2026
class RenameWsubNodesTransform(BaseOnnxTransform):
"""Name local-function operators from their semantic layer parameters."""

_LAYER_PARAMETER_RE = re.compile(r"(?:^|\.)layers\.\d+\.(?P<role>.+)\.weight$")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this regex applicable to all architectures and generic?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm, would not be fully generic, but this covers the models Perf. team is tracking, so this list should be good for now.

Also, FYI: this would not be much useful when dynamo comes in bdw.

@vbaddi
vbaddi marked this pull request as ready for review August 10, 2026 17:21
@vbaddi vbaddi self-assigned this Aug 10, 2026
  Preserve Hugging Face parameter names during TorchScript w_sub ONNX export and rename local-function weighted
  nodes from semantic parameter inputs.

  Adds a graph-only ONNX transform for w_sub node names, registers it for legacy use_onnx_subfunctions=True
  exports, and bumps the subfunction export cache version to avoid reusing older opaque-name artifacts.

  Adds focused unit and quickcheck coverage for semantic initializer and node names.

Signed-off-by: vbaddi <vbaddi@qti.qualcomm.com>
@vbaddi
vbaddi force-pushed the wsub-semantic-onnx-names branch from 80c7928 to f8f8e7d Compare August 11, 2026 07:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

1.23 Release 1.23 Features ci_ready enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants