Skip to content

fix: preserve text-only rows in multimodal datasets - #2277

Open
VanyMo wants to merge 1 commit into
THUDM:mainfrom
VanyMo:agent/preserve-text-only-multimodal-content
Open

fix: preserve text-only rows in multimodal datasets#2277
VanyMo wants to merge 1 commit into
THUDM:mainfrom
VanyMo:agent/preserve-text-only-multimodal-content

Conversation

@VanyMo

@VanyMo VanyMo commented Aug 16, 2026

Copy link
Copy Markdown

Problem

When multimodal_keys is configured for a mixed dataset, a text-only row can have no multimodal values. In that case _build_messages builds the regular expression () from an empty placeholder mapping.

Python treats that as an empty capturing group, so re.split("()", "hello") splits the text into individual characters. The row is then passed to the chat template and processor as many one-character text blocks instead of its original string content.

This is separate from #2237, which preserves sample order while filtering mixed text and multimodal rows.

Change

Return the conversation unchanged when the current row contains no multimodal values. Rows with actual multimodal placeholders continue through the existing expansion path.

Add CPU regressions for both the text-only case and the existing image-placeholder behavior.

Validation

  • .venv/bin/python -m pytest tests/test_filter_long_prompt.py -q — 7 passed
  • ruff check slime/utils/data.py tests/test_filter_long_prompt.py — passed
  • black --check slime/utils/data.py tests/test_filter_long_prompt.py — passed
  • git diff --check — passed

@VanyMo
VanyMo marked this pull request as ready for review August 16, 2026 17:30
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