Skip to content

[Refactor] multimodal: Replace padding strategies with helpers - #44845

Merged
mickqian merged 3 commits into
mainfrom
codex/mm-padding-helpers
Oct 17, 2026
Merged

mickqian merged 3 commits into
mainfrom
codex/mm-padding-helpers

Conversation

@mickqian

@mickqian mickqian commented Oct 17, 2026 •

Copy link
Copy Markdown
Collaborator

Motivation

Multimodal token padding doesn't need a strategy object. Keep the model's pad_input_ids interface, but call the shared helpers directly.

Modifications

  • Add pad_mm_tokens and pad_mm_token_pairs, and migrate the model callers.
  • Keep the old classes, constructor signatures and attributes as thin wrappers. No deprecation warnings.
  • Cover token boundaries, slice reuse, input ownership, data_offsets and legacy configuration in the existing CPU tests.

Mechanical move — reproducible

The algorithm extraction is isolated in 36db17e4623. Reproduction scripts.

From a checkout containing this branch:

gh gist clone f6bda44e57abf4690861685d0f2dd43b mm-padding-proof
python3 mm-padding-proof/36db17e46.py

CI States

Latest PR Test (Base): ✅ Run #38999650666
Latest PR Test (Extra): ❌ Run #38999650608
Latest PR Test (AMD ROCm 10): ❌ Run #38999650630

@mickqian

Copy link
Copy Markdown
Collaborator Author

/rerun-test test/registered/unit/managers/test_mm_utils_split.py

@github-actions

github-actions Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

🚀 ubuntu-latest (1 test): ✅ View workflow run

cd test/ && python3 registered/unit/managers/test_mm_utils_split.py

@mickqian

Copy link
Copy Markdown
Collaborator Author

/tag-and-rerun-ci

@github-actions github-actions Bot added the run-ci CI: run the baseline test suite on this PR label Oct 17, 2026
@mickqian
mickqian merged commit e01dfd3 into main Oct 17, 2026
265 of 301 checks passed
@mickqian
mickqian deleted the codex/mm-padding-helpers branch October 17, 2026 12:43
adarshxs added a commit to adarshxs/sglang that referenced this pull request Oct 26, 2026
Resolve conflicts and port the transformers backend to current main:

- pyproject: keep main's transformers==5.19.0 and uvicorn>=0.51 pins
  (drop this branch's 5.15.0 bump).
- model_config: keep main's EmbeddingGemma2 context clamp and apply the
  transformers embedding-plan clamp on top of it.
- lora_manager.set_lora_module: keep main's **kwargs passthrough together
  with the transformers LoRA adapter wrap.
- Delete the old models/transformers.py and port main's two changes to it:
  the embedding_rowwise TP-style alias (sgl-project#39012) into layers.py, and the
  pad_mm_tokens helper (sgl-project#44845) into MultiModalMixin.pad_input_ids. Export
  _normalize_tp_style from the package for test_hf_transformers.
- trtllm_mha_backend: drop this branch's causal= kwarg; main added the
  identical line, and the auto-merge produced a repeated keyword.
- Parallel linear layers take parallel_group instead of tp_rank/tp_size
  (sgl-project#42588): the fused QKV projection partitions on "attn_tp" and unfused
  K/V shards use ReplicatedParallelGroup("attn_tp", tp_size // kv_heads).
  TP unit tests build group stubs via sglang.test.parallel_groups.
- test_transformers_graph: drop the TCPCG fullgraph compile test, since
  the backend is retired and its custom attention op removed
  (sgl-project#42287, sgl-project#42288); give the hand-built PrefillCudaGraphRunner the
  attributes main's replay path now reads.
- test_embedding_model_spec: the support matrix has 10 rows (ModernBert
  and Roberta from this branch plus main's EmbeddingGemma2).
- test_transformers_fallback: follow main's removal of the skip-substrs
  test (sgl-project#43503).

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

deepseek Multi-modal multi-modal language model run-ci CI: run the baseline test suite on this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant