fix(data): pass per-sample tools list for preformatted batches#668
Open
curnane-lab wants to merge 1 commit into
Open
fix(data): pass per-sample tools list for preformatted batches#668curnane-lab wants to merge 1 commit into
curnane-lab wants to merge 1 commit into
Conversation
preprocess_conversations defaults tools=[[]]. In the is_preformatted branch we only passed a single empty list, so zip(conversations, tools) iterated once and dropped every sample after the first in a batch. Pass tools=[[] for _ in range(len(examples['text']))] to keep all samples, matching the non-preformatted path. Fixes sgl-project#555
Contributor
There was a problem hiding this comment.
Code Review
This pull request updates the preprocessing function in specforge/data/preprocessing.py to pass an empty list of tools for each text example when handling preformatted data. 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.
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.
Motivation
preprocess_conversationsdefaultstools=[[]], expecting a list-of-lists with one entry per conversation so thatzip(conversations, tools)pairs each conversation with its tool list.In the
is_preformatted=Truebranch ofpreprocess_function, however, the code previously passed a single empty list[]instead of a per-sample list. This causedzip(conversations, tools)to stop after the first sample, silently dropping every remaining sample in the batch. As a result, preformatted datasets were effectively truncated to one sample per batch during training data preparation.This PR fixes the mismatch and keeps the preformatted path consistent with the non-preformatted path.
Modifications
specforge/data/preprocessing.pyis_preformattedbranch ofpreprocess_function, passtools=[[] for _ in range(len(examples["text"]))]so that every sample in the batch gets its own (empty) tools entry.preprocess_conversationsitself.Related Issues
Fixes #555
Accuracy Test
N/A — this is a data-preprocessing bug fix; no model architecture or kernel code is changed.
Benchmark & Profiling
N/A — the change only restores the intended batch size for preformatted datasets. No throughput or latency impact is expected.
Checklist