Skip to content

fix(data): correct keyword argument sample_idx to batch_idx in collator#10612

Open
GSCSD1 wants to merge 1 commit into
hiyouga:mainfrom
GSCSD1:GSCSD1/data/fix-collator-batch-idx-param
Open

fix(data): correct keyword argument sample_idx to batch_idx in collator#10612
GSCSD1 wants to merge 1 commit into
hiyouga:mainfrom
GSCSD1:GSCSD1/data/fix-collator-batch-idx-param

Conversation

@GSCSD1

@GSCSD1 GSCSD1 commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Fixes #10497


_slice_mm_inputs_for_sample 的第 4 个参数名为 batch_idx,但第 263 行调用时错用了 sample_idx=sample_idx,导致多模态训练在 num_sub_seqs <= 1 时抛出 TypeError

修复:sample_idx=sample_idxbatch_idx=sample_idx

This contribution was prepared with AI assistance.

…slice_mm_inputs_for_sample` call

The function signature uses `batch_idx` as the parameter name, but
the call at line 263 passed it as `sample_idx=sample_idx`, causing a
`TypeError` on multimodal training runs.

Closes hiyouga#10497

Co-Authored-By: Claude <noreply@anthropic.com>

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the argument name from sample_idx to batch_idx in the call to _slice_mm_inputs_for_sample within src/llamafactory/data/collator.py. There are no review comments, so I have no feedback to provide.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

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.

bug: TypeError in collator.py — _slice_mm_inputs_for_sample called with sample_idx= but param is batch_idx

1 participant