Repository navigation
[Bugfix] Hash zero multimodal limits into the model compile-cache key - #86
Merged
Merged
Conversation
ModelConfig.compute_hash ignored limit_mm_per_prompt. A zero limit changes the traced language-model graph (vision tower replaced when image and video are both zero; input IDs instead of embeddings when every modality is zero and precomputed embeddings are off), so a text-only config and a multimodal config sharing one cache root could load each other's compiled graphs. Upstream vLLM #54642 hashes every limit value. Non-zero values do not change the graph, so hash only the sorted set of zero-limit modalities together with enable_mm_embeds, and only when some limit is zero. Configs without a zero limit keep exactly the previous hash and existing compile caches. CPU tests: factor helper cases, and ModelConfig hashes on a local Qwen2-VL config (no zero limit equals the previous hash; text-only, image-off and embeds variants all differ). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Leonccaa <166551845+Leonccaa@users.noreply.github.com>
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.
Change
ModelConfig.compute_hashignoredlimit_mm_per_prompt. A zero limit changes the traced language-model graph (the vision tower is replaced when image and video are both zero; input IDs are fed instead of embeddings when every modality is zero and precomputed embeddings are off), so a text-only config and a multimodal config sharing one compile-cache root could load each other's compiled graphs.Upstream vLLM #54642 hashes every limit value. Non-zero values do not change the graph, so this change hashes only the sorted set of zero-limit modalities together with
enable_mm_embeds, and only when some limit is zero. Configs without a zero limit keep exactly the previous hash and their existing compile caches. A comment inmm_limit_hash_factorsnotes that a model which uses a non-zero limit value inside the compiled graph would have to be added there.No new switch.
Risk and rollback: configs with a zero limit get a new compile-cache key once (one cold compile). Revert this commit to return to the previous key.
Validation
tests/config/test_mm_limit_compute_hash.py: 9 passed: factor helper cases, andModelConfighashes on a local Qwen2-VL config (no zero limit gives exactly the previous hash; text-only, image-off and embeds variants all differ).pre-commiton the changed files, including mypy.Attribution
Adapted from upstream vLLM #54642 (conditional on zero limits, see above); upstream authorship credited. AI-assisted change (Claude); the submitter reviewed every changed line. Commits are signed off.
🤖 Generated with Claude Code