Skip to content

fix: filter_long_prompt crashes on chat-templated multimodal prompts - #2449

Open
annika-modal wants to merge 1 commit into
THUDM:mainfrom
annika-modal:fix/multimodal-prompt-filter
Open

annika-modal wants to merge 1 commit into
THUDM:mainfrom
annika-modal:fix/multimodal-prompt-filter

Conversation

@annika-modal

Copy link
Copy Markdown
Contributor

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 at load time with AttributeError: 'str' object has no attribute 'get'. This reuses sample.multimodal_inputs instead.

The existing tests stubbed process_vision_info to 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 real Dataset and a Qwen3-VL processor on CPU.

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

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant