-
Notifications
You must be signed in to change notification settings - Fork 525
Add 7 nvidia/Nemotron-* calibration datasets to SUPPORTED_DATASET_CONFIG #1498
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,6 +17,7 @@ | |
|
|
||
| import pytest | ||
| import torch | ||
| from huggingface_hub import get_token | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Avoid module-level import of optional test dependency. Importing 🤖 Prompt for AI Agents |
||
| from torch.utils.data import DataLoader | ||
|
|
||
| from modelopt.torch.utils.dataset_utils import ( | ||
|
|
@@ -689,3 +690,57 @@ def test_dataloader_mixing_hf_and_local_jsonl(self, tmp_path, pad_tokenizer): | |
| ) | ||
| batches = list(loader) | ||
| assert sum(b["input_ids"].shape[0] for b in batches) == 5 | ||
|
|
||
|
|
||
| _NEW_NEMOTRON_KEYS = [ | ||
| "nemotron-sft-instruction-following-chat-v2", | ||
| "nemotron-science-v1", | ||
| "nemotron-competitive-programming-v1", | ||
| "nemotron-sft-agentic-v2", | ||
| "nemotron-math-v2", | ||
| "nemotron-sft-swe-v2", | ||
| "nemotron-sft-multilingual-v1", | ||
| ] | ||
|
|
||
|
|
||
| @pytest.mark.parametrize("dataset_key", _NEW_NEMOTRON_KEYS) | ||
| def test_new_nemotron_registry_shape(dataset_key): | ||
| """Always-on shape check on the 7 newly registered nvidia/Nemotron-* entries. | ||
|
|
||
| Complements the gated smoke test below — catches typos in dataset paths or | ||
| split names even when the runner has no HF credentials. | ||
| """ | ||
| from modelopt.torch.utils.dataset_utils import SUPPORTED_DATASET_CONFIG | ||
|
|
||
| assert dataset_key in SUPPORTED_DATASET_CONFIG | ||
| entry = SUPPORTED_DATASET_CONFIG[dataset_key] | ||
| config = entry["config"] | ||
| assert config["path"].startswith("nvidia/Nemotron-") | ||
| splits = config["split"] | ||
| assert isinstance(splits, list) and splits | ||
| assert all(isinstance(s, str) and s for s in splits) | ||
| assert len(set(splits)) == len(splits) | ||
| assert callable(entry["preprocess"]) | ||
| assert entry["chat_key"] == "messages" | ||
|
|
||
|
|
||
| @pytest.mark.integration | ||
| @pytest.mark.parametrize("dataset_key", _NEW_NEMOTRON_KEYS) | ||
| def test_get_dataset_samples_new_nemotron(dataset_key): | ||
| """Smoke-test the 7 newly registered nvidia/Nemotron-* calibration datasets. | ||
|
|
||
| Skipped when no HF token is available because these datasets live behind the HF Hub. | ||
| ``huggingface_hub.get_token()`` covers both the ``HF_TOKEN`` env var and tokens | ||
| cached by ``hf auth login``. | ||
| """ | ||
| pytest.importorskip("datasets") | ||
| if not get_token(): | ||
| pytest.skip( | ||
| "No HF token (env HF_TOKEN or `hf auth login`); skipping gated Nemotron smoke test" | ||
| ) | ||
|
|
||
| samples = get_dataset_samples(dataset_key, num_samples=2) | ||
|
|
||
| assert isinstance(samples, list) | ||
| assert len(samples) == 2 | ||
| assert all(isinstance(s, str) and len(s) > 0 for s in samples) | ||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have you tried directly trying these datasets (e.g.
get_dataset_dataloader("nvidia/Nemotron-SFT-Instruction-Following-Chat-v2", ...)) without adding to this dictionary? We have a fallback logic that auto-detects dataset type and parses it if not present in the dictionaryThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tried it on main for nvidia/Nemotron-SFT-Instruction-Following-Chat-v2 — the fallback hits three issues:
get_dataset_samples(path, num_samples=2) → ValueError: Bad split: train. Available splits: ['reasoning_off', 'reasoning_on'].Auto-detect defaults to
split=["train"] (dataset_utils.py:415);none of the 7 Nemotron datasets has atrainsplit.ValueError: Dataset '…' has a 'messages' column but no tokenizer with apply_chat_template was provided (dataset_utils.py:256-260).apply_chat_template=False→ the fallback still callsapply_chat_templateunconditionally, which fails on tokenizers without a chat template (e.g. gpt2).We can think about more of improving the fallback pass.
As a background, we are evaluating if these dataset should be the default calibration dataset instead. So adding them in this PR