Skip to content

Replace hasattr with isinstance in SHM feature helpers - #29549

Merged
merrymercy merged 1 commit into
mainfrom
refactor/mm-utils-replace-hasattr-with-isinstance
Jun 29, 2026
Merged

merrymercy merged 1 commit into
mainfrom
refactor/mm-utils-replace-hasattr-with-isinstance

Conversation

@merrymercy

@merrymercy merrymercy commented Jun 28, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Replace hasattr probes with explicit isinstance checks against BaseBatchReq, TokenizedGenerateReqInput, and TokenizedEmbeddingReqInput in wrap_shm_features, unwrap_shm_features, and has_shm_features.
  • Access MultimodalDataItem fields (feature, precomputed_embeddings, hash) directly since they are declared dataclass fields, removing unnecessary hasattr/getattr guards.

Test plan

  • Existing multimodal CI tests pass (no behavioral change, pure refactor)

CI States

Latest PR Test (Base): ✅ Run #28318059857
Latest PR Test (Extra): 🚫 Run #28318266897

Use explicit isinstance checks against BaseBatchReq,
TokenizedGenerateReqInput, and TokenizedEmbeddingReqInput instead of
hasattr probes in wrap_shm_features, unwrap_shm_features, and
has_shm_features. Access MultimodalDataItem fields (feature,
precomputed_embeddings, hash) directly since they are declared
dataclass fields.
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@merrymercy
merrymercy force-pushed the refactor/mm-utils-replace-hasattr-with-isinstance branch from 1fdb433 to 8e9e781 Compare June 28, 2026 09:35

@merrymercy merrymercy left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

approved, ready for merge

@merrymercy merrymercy added run-ci CI: run the baseline test suite on this PR run-ci-extra CI: also run the extra suite (requires run-ci) labels Jun 28, 2026
@merrymercy
merrymercy merged commit bb74ed4 into main Jun 29, 2026
364 of 437 checks passed
@merrymercy
merrymercy deleted the refactor/mm-utils-replace-hasattr-with-isinstance branch June 29, 2026 04:31
vstone-w pushed a commit to ClownBin/sglang that referenced this pull request Jul 2, 2026
Chronostasys pushed a commit to MindLab-Research/sglang that referenced this pull request Aug 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

run-ci CI: run the baseline test suite on this PR run-ci-extra CI: also run the extra suite (requires run-ci)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant