Skip to content

fix(data): pass per-sample tools list for preformatted batches#668

Open
curnane-lab wants to merge 1 commit into
sgl-project:mainfrom
curnane-lab:fix_bug
Open

fix(data): pass per-sample tools list for preformatted batches#668
curnane-lab wants to merge 1 commit into
sgl-project:mainfrom
curnane-lab:fix_bug

Conversation

@curnane-lab

@curnane-lab curnane-lab commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Motivation

preprocess_conversations defaults tools=[[]], expecting a list-of-lists with one entry per conversation so that zip(conversations, tools) pairs each conversation with its tool list.

In the is_preformatted=True branch of preprocess_function, however, the code previously passed a single empty list [] instead of a per-sample list. This caused zip(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.py
    • In the is_preformatted branch of preprocess_function, pass tools=[[] for _ in range(len(examples["text"]))] so that every sample in the batch gets its own (empty) tools entry.
    • No changes to the non-preformatted path or to preprocess_conversations itself.

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

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

@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 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.

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] Pre-formatted data not working

2 participants