Skip to content

Fix ORT GenAI export metadata - #377

Merged
xiaoyu-work merged 4 commits into
mainfrom
xiaoyu/ort-genai-export-fixes
Jul 30, 2026
Merged

Fix ORT GenAI export metadata#377
xiaoyu-work merged 4 commits into
mainfrom
xiaoyu/ort-genai-export-fixes

Conversation

@xiaoyu-work

Copy link
Copy Markdown
Contributor

Summary

  • copy tokenizer files locally when hf_model_id is a local directory
  • emit qwen3_vl model type instead of qwen2_5_vl for Qwen3-VL exports
  • include Qwen3-VL vision/video metadata in genai_config.json

Validation

  • PYTHONPATH=$PWD/src conda run -n olive python -m pytest src/mobius/integrations/ort_genai/auto_export_test.py -q -k 'local_hf_model_id_uses_local_tokenizer_copy or qwen3_vl_writes_qwen3_vl_model_type_and_vision_fields or writes_processor_config_for_vision_language_model'

Copy tokenizer files directly for local model directories and emit Qwen3-VL-specific GenAI metadata, including model type and vision/video fields.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: Xiaoyu <xiaoyuzhang@microsoft.com>
@github-actions

github-actions Bot commented Jun 25, 2026

Copy link
Copy Markdown

🏗️ Architecture Diff

Comparing 95a33383e1b2fe

Model Sub-model Changes Status

No architecture changes detected.


Legend: ⚪ No change · 🔵 Minor (attrs/inits) · 🟡 Moderate (nodes added/removed) · 🔴 Major (interface changed)

@github-actions

github-actions Bot commented Jun 25, 2026

Copy link
Copy Markdown

Performance Comparison

Comparing 95a33383e1b2fe

Model Metric Baseline Current Delta
bert (feature-extraction) model_size_bytes 359 KB 359 KB +0.0%
bert (feature-extraction) num_nodes 60 60 +0.0%
falcon model_size_bytes 364 KB 364 KB +0.0%
falcon num_nodes 68 68 +0.0%
gemma2 model_size_bytes 428 KB 428 KB +0.0%
gemma2 num_nodes 107 107 +0.0%
gpt2 model_size_bytes 388 KB 388 KB +0.0%
gpt2 num_nodes 54 54 +0.0%
llama model_size_bytes 425 KB 425 KB +0.0%
llama num_nodes 62 62 +0.0%
llama (static-cache) model_size_bytes 425 KB 425 KB +0.0%
llama (static-cache) num_nodes 58 58 +0.0%
mamba (ssm-text-generation) model_size_bytes 296 KB 296 KB +0.0%
mamba (ssm-text-generation) num_nodes 98 98 +0.0%
phi3 model_size_bytes 421 KB 421 KB +0.0%
phi3 num_nodes 60 60 +0.0%
phi3 (static-cache) model_size_bytes 421 KB 421 KB +0.0%
phi3 (static-cache) num_nodes 56 56 +0.0%
qwen2 model_size_bytes 425 KB 425 KB +0.0%
qwen2 num_nodes 62 62 +0.0%
qwen2 (static-cache) model_size_bytes 425 KB 425 KB +0.0%
qwen2 (static-cache) num_nodes 58 58 +0.0%
qwen3_5_moe (hybrid-text-generation) model_size_bytes 506 KB 506 KB +0.0%
qwen3_5_moe (hybrid-text-generation) num_nodes 275 275 +0.0%
qwen3_5_text (hybrid-text-generation) model_size_bytes 458 KB 458 KB +0.0%
qwen3_5_text (hybrid-text-generation) num_nodes 129 129 +0.0%
qwen3_5_vl (hybrid-qwen-vl) model_size_bytes 977 KB 977 KB +0.0%
qwen3_5_vl (hybrid-qwen-vl) num_nodes 413 413 +0.0%
t5 (seq2seq) model_size_bytes 836 KB 836 KB +0.0%
t5 (seq2seq) num_nodes 166 166 +0.0%
whisper (speech-to-text) model_size_bytes 1008 KB 1008 KB +0.0%
whisper (speech-to-text) num_nodes 128 128 +0.0%

No performance regressions.

@codecov

codecov Bot commented Jun 25, 2026

Copy link
Copy Markdown

The author of this PR, xiaoyu-work, is not an activated member of this organization on Codecov.
Please activate this user on Codecov to display this PR comment.
Coverage data is still being uploaded to Codecov.io for purposes of overall coverage calculations.
Please don't hesitate to email us at support@codecov.io with any questions.

Copilot AI left a comment

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.

Pull request overview

This PR updates the ORT GenAI auto-export integration to generate more accurate export metadata for Qwen3-VL and to better handle tokenizer artifacts when the HuggingFace “model id” is actually a local directory path.

Changes:

  • Extend GenaiConfigGenerator.with_vision() to optionally emit Qwen3-VL vision metadata (tokens_per_second, patch_size, window_size).
  • Update ORT GenAI model-type mapping so Qwen3-VL exports emit qwen3_vl instead of reusing qwen2_5_vl.
  • Copy tokenizer files directly from disk when hf_model_id points to a local directory, and add unit tests for this behavior and the new Qwen3-VL fields.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
src/mobius/integrations/ort_genai/genai_config.py Adds optional Qwen3-VL vision metadata fields to the generated vision section.
src/mobius/integrations/ort_genai/auto_export.py Adjusts model-type mapping, writes Qwen3-VL vision/video metadata, and copies tokenizer files from local hf_model_id directories.
src/mobius/integrations/ort_genai/auto_export_test.py Adds/updates unit tests for local tokenizer copying and Qwen3-VL genai_config fields.

Comment thread src/mobius/integrations/ort_genai/auto_export.py
Comment thread src/mobius/integrations/ort_genai/auto_export.py
…PI change

In transformers 5.14, DynamicCache.layers[N].recurrent_states changed
from returning a tensor directly to returning a dict keyed by layer
index. Handle both forms so the test works with both old and new
transformers versions.
@xiaoyu-work

Copy link
Copy Markdown
Contributor Author

@copilot resolve the merge conflicts in this pull request

Copilot AI review requested due to automatic review settings July 30, 2026 17:59
@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
0 out of 2 committers have signed the CLA.

❌ Copilot
❌ xiaoyu-work
You have signed the CLA already but the status is still pending? Let us recheck it.

Comment thread tests/integration_test.py Fixed
- auto_export.py: add deepseek_v4 mapping from main; keep qwen3_vl->qwen3_vl; merge MTP config block from main alongside local tokenizer copy logic
- integration_test.py: keep transformers >=5.14 recurrent_states comment from our branch

Copilot AI commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

@copilot resolve the merge conflicts in this pull request

已解决合并冲突(commit 1cd238cResolve merge conflicts):

  • auto_export.py:从 main 合入 deepseek_v4: decoder 映射和 MTP config 写入块,保留本 PR 的 qwen3_vl → qwen3_vl 映射和本地 tokenizer 复制逻辑
  • tests/integration_test.py:保留本 PR 对 transformers ≥5.14 recurrent_states 兼容性的注释

Copilot AI left a comment

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.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

Comments suppressed due to low confidence (2)

src/mobius/integrations/ort_genai/auto_export.py:1141

  • Unresolved merge-conflict marker line (>>>>>>> origin/main) remains here; it must be removed or the module won't import.
            result[tf] = os.path.join(directory, tf)

src/mobius/integrations/ort_genai/auto_export.py:1110

  • Unresolved merge-conflict markers are present before the MTP config block, which will break parsing. Keep the tokenizer-copy comment and remove the conflict markers/selector line.
            json.dump(
                {
                    "model": {"filename": "mtp/model.onnx"},
                    "inputs": [

Comment thread tests/integration_test.py Outdated
Comment thread src/mobius/integrations/ort_genai/auto_export.py Outdated
Copilot AI review requested due to automatic review settings July 30, 2026 18:05

Copilot AI left a comment

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.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.

@xiaoyu-work
xiaoyu-work merged commit 94c2163 into main Jul 30, 2026
24 of 25 checks passed
@xiaoyu-work
xiaoyu-work deleted the xiaoyu/ort-genai-export-fixes branch July 30, 2026 22:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants