Add support for auxiliary "tools" column in data processing pipelines#3559
Open
kryvokhyzha wants to merge 7 commits intoAI-Hypercomputer:mainfrom
Open
Add support for auxiliary "tools" column in data processing pipelines#3559kryvokhyzha wants to merge 7 commits intoAI-Hypercomputer:mainfrom
kryvokhyzha wants to merge 7 commits intoAI-Hypercomputer:mainfrom
Conversation
…nput pipeline utilities
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.
Description
Add support for a
toolscolumn in the SFT data pipeline, enabling function-calling / tool-use training.When
train_data_columns: ['messages', 'tools']is set, the pipeline extracts thetoolscolumn and forwards it astools=to everytokenizer.apply_chat_template()call. This lets the chat template render tool definitions into the prompt - required for training on tool-use datasets.Config
Why do we need deserialization?
Parquet (Arrow) requires a fixed schema for nested columns. But
messageshas varying structure - some messages containtool_calls, others don't; tools has varying parameter schemas per function. Arrow can't represent that as a native nested type.So I serialize them as JSON strings when writing to Parquet. On the read side, the pipeline gets plain strings like
"[{\"role\": \"user\", ...}]"instead of Python lists/dicts.apply_chat_templateexpects actual Python objects, so wejson.loads()them before passing to the template.Dataset Example
Checklist
Before submitting this PR, please make sure (put X in square brackets):
gemini-reviewlabel.