Repository navigation
fix: filter_long_prompt crashes on chat-templated multimodal prompts - #2449
Open
annika-modal wants to merge 1 commit into
Open
annika-modal wants to merge 1 commit into
annika-modal wants to merge 1 commit into
Conversation
With apply_chat_template, Dataset.__init__ stores the templated string in sample.prompt and the parsed media in sample.multimodal_inputs. The multimodal branch of filter_long_prompt re-ran process_vision_info on that string, which expects a list of messages, so any image dataset with --rollout-max-prompt-len (or --rollout-max-context-len) set failed with AttributeError: 'str' object has no attribute 'get'. Reuse sample.multimodal_inputs instead.
This branch has not been deployed
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.
With
apply_chat_template,Dataset.__init__stores the templated string insample.promptand the parsed media insample.multimodal_inputs. The multimodal branch offilter_long_promptre-ranprocess_vision_infoon that string, which expects a list of messages, so any image dataset with--rollout-max-prompt-len(or--rollout-max-context-len) set failed at load time withAttributeError: 'str' object has no attribute 'get'. This reusessample.multimodal_inputsinstead.The existing tests stubbed
process_vision_infoto ignore its input, which hid the bug, so I removed that stub and added a test that fails if the filter re-parses the prompt and checks the parsed media reach the processor. I also reproduced the crash and the fix with the realDatasetand a Qwen3-VL processor on CPU.