From b59019d0a1b5ed0d346ec81226d67f00cdd80e67 Mon Sep 17 00:00:00 2001 From: Ranran Haoran Zhang Date: Tue, 14 Jul 2026 09:52:18 -0500 Subject: [PATCH] feat(data): add When2Call single-turn tool-use dataset preset Register nvidia/When2Call (train_sft config) in the shared dataset registry. Since #777 that registry is the single source of presets, so the entry serves both pipelines: off-policy `prepare-data` and the on-policy regeneration script's `--dataset`. When2Call is a function-calling SFT dataset (CC-BY-4.0) that also teaches when NOT to call a tool. Every row is a single user/assistant exchange with no system turn; the conversation uses the OpenAI `messages` schema (normalized to `conversations`), and the tool schemas ride along in a parallel `tools` column. Co-Authored-By: Claude Opus 4.8 (1M context) Claude-Session: https://claude.ai/code/session_01LRRGNt2T9ktWyFRboNUZNU Signed-off-by: Ranran Haoran Zhang --- docs/cli/response_regeneration.md | 1 + src/speculators/data_generation/configs.py | 13 +++++++++++++ 2 files changed, 14 insertions(+) diff --git a/docs/cli/response_regeneration.md b/docs/cli/response_regeneration.md index 8df2be845..4db355f0c 100644 --- a/docs/cli/response_regeneration.md +++ b/docs/cli/response_regeneration.md @@ -124,6 +124,7 @@ The text presets from the shared dataset registry (`DATASET_CONFIGS` in `specula | `magpie` | `Magpie-Align/Magpie-Llama-3.1-Pro-300K-Filtered` | `train` | | `nemotron` | `nvidia/Llama-Nemotron-Post-Training-Dataset` | `chat` | | `open-perfectblend` | `mlabonne/open-perfectblend` | `train` | +| `when2call` | `nvidia/When2Call` | `train` | The registry's multimodal preset, `sharegpt4v_coco`, is **off-policy only** and `--dataset` rejects it. Its turns carry image content parts, which the Chat Completions API rejects, and the pre-tokenized output row has nowhere to keep pixel data. Use it with `prepare-data`. diff --git a/src/speculators/data_generation/configs.py b/src/speculators/data_generation/configs.py index 8cfc39e18..9e4de59b3 100644 --- a/src/speculators/data_generation/configs.py +++ b/src/speculators/data_generation/configs.py @@ -49,6 +49,12 @@ def _normalize_nemotron(example: dict) -> dict: } +def _normalize_when2call(example: dict) -> dict: + # When2Call already stores the dialogue as role/content ``messages``; + # the parallel ``tools`` column is preserved by the map for tool-aware runs. + return {"conversations": example["messages"]} + + def get_coco_dir(): return os.getenv("COCO_DIR") or "coco/" @@ -151,4 +157,11 @@ def _normalize_sharegpt4v_coco(example: dict) -> dict: hf_path="mlabonne/open-perfectblend", split="train", ), + "when2call": DatasetConfig( + name="when2call", + hf_path="nvidia/When2Call", + subset="train_sft", + split="train", + normalize_fn=_normalize_when2call, + ), }