huggingface/open-r1 · error

No datasets were loaded from the mixture configuration

Error message

No datasets were loaded from the mixture configuration

What it means

get_dataset raises ValueError('No datasets were loaded from the mixture configuration') when args.dataset_mixture is set but the resulting datasets_list is empty after iterating the mixture configs. In practice this fires when the mixture was configured but each load silently yielded nothing usable, or the loop never appended (datasets_list starts empty and concatenate only happens 'if datasets_list' — its else branch raises). It guards against producing an empty/malformed DatasetDict downstream.

Source

Thrown at src/open_r1/utils/data.py:62

            datasets_list.append(ds)

        if datasets_list:
            combined_dataset = concatenate_datasets(datasets_list)
            combined_dataset = combined_dataset.shuffle(seed=seed)
            logger.info(f"Created dataset mixture with {len(combined_dataset)} examples")

            if args.dataset_mixture.test_split_size is not None:
                combined_dataset = combined_dataset.train_test_split(
                    test_size=args.dataset_mixture.test_split_size, seed=seed
                )
                logger.info(
                    f"Split dataset into train and test sets with test size: {args.dataset_mixture.test_split_size}"
                )
                return combined_dataset
            else:
                return DatasetDict({"train": combined_dataset})
        else:
            raise ValueError("No datasets were loaded from the mixture configuration")

    else:
        raise ValueError("Either `dataset_name` or `dataset_mixture` must be provided")

View on GitHub (pinned to 1416fa0cf2)

Solutions

  1. Inspect the resolved ScriptArguments and ensure dataset_mixture.datasets is a non-empty list
  2. Check the YAML/CLI config key names (datasets, each with id/config/split)
  3. Log each dataset_config before load_dataset to confirm iteration occurs
  4. If a single dataset is intended, use dataset_name instead of dataset_mixture

Example fix

# before
dataset_mixture:
  datasets: []
# after
dataset_mixture:
  datasets:
    - id: HuggingFaceH4/ultrachat_200k
      config: default
      split: train_sft
Defensive patterns

Strategy: validation

Validate before calling

mixture = args.dataset_mixture
assert not (mixture and not mixture.datasets), (
    "dataset_mixture configured but contains no datasets"
) if mixture else True

Prevention

When it happens

Trigger: Calling get_dataset with args.dataset_mixture provided but datasets_list empty — e.g. dataset_mixture.datasets is an empty list, or the loading path didn't populate it (note: load_dataset failures would normally raise earlier; empty list is the direct trigger).

Common situations: YAML/CLI config where the `datasets:` key under dataset_mixture is empty or mis-named, so the list parses as empty; a templated config that expanded to nothing; refactor that removed entries.

Related errors


AI-assisted analysis of huggingface/open-r1@1416fa0cf2 (2026-08-30). Data as JSON: /api/errors/27e203da52ef43e1. Report an issue: GitHub.