Fix mutable default arguments and remove duplicate line in VLM models#130
Open
jashshah999 wants to merge 1 commit into
Open
Fix mutable default arguments and remove duplicate line in VLM models#130jashshah999 wants to merge 1 commit into
jashshah999 wants to merge 1 commit into
Conversation
- Replace mutable dict default `data_batch={}` with `data_batch=None` in `forward()` across VLM models. Mutable defaults are shared across all calls, which can lead to unexpected shared state if the dict is ever modified in-place.
- Remove duplicate `attention_mask = data_batch.get("padding_mask", None)` line in `vlm_qwen_omni.py`.
Signed-off-by: Jash Shah <jashshah.999@gmail.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.
Summary
data_batch={}withdata_batch=None(+ guard) inforward()across 4 VLM model files. Mutable defaults in Python are shared across all calls to the function, which can lead to unexpected shared state if the dict is ever modified in-place.attention_mask = data_batch.get("padding_mask", None)assignment invlm_qwen_omni.py.Files changed:
cosmos_predict2/_src/reason1/models/vlm_base.pycosmos_predict2/_src/reason1/models/vlm_qwen.pycosmos_predict2/_src/reason1/models/vlm_qwen_omni.pycosmos_predict2/_src/predict2/text_encoders/reason1.py