Use the metadata config for domain-filtered token counts on OpenThoughts-style datasets
When a dataset task asks for domain-level token counts, do not assume the default config has the needed columns. Inspect the available configs and load the one that actually holds domain labels and reasoning/solution text.
Procedure:
- List configs before loading:
from datasets import get_dataset_config_names print(get_dataset_config_names("ryanmarten/OpenThoughts-1k-sample")) - Read the dataset card or README for documented configs and domain groupings.
- Load the config with the domain and token-text columns, often
metadata, instead ofdefault:from datasets import load_dataset ds = load_dataset("ryanmarten/OpenThoughts-1k-sample", "metadata") - Map README category names to the actual metadata domain values. For example, a
Sciencecategory usually corresponds tophysics,chemistry, andbiology; do not search for a literalsciencedomain value. - Validate before counting:
print(ds["train"].column_names) print(ds["train"].unique("domain"))
Why: on ryanmarten/OpenThoughts-1k-sample the default config only has system and conversations, while domain, deepseek_reasoning, and deepseek_solution live in the metadata config. Counting tokens by domain from default returns no domain labels and can silently count the wrong text.
Supporting evidence: count-dataset-tokens (this batch).