{"record":{"id":"d2038e9ffa50b5d1","repo":"hiyouga/LlamaFactory","slug":"unknown-mixing-strategy-data-args-mix-strategy","errorCode":null,"errorMessage":"Unknown mixing strategy: {data_args.mix_strategy}.","messagePattern":"Unknown mixing strategy: (.+?)\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"src/llamafactory/data/data_utils.py","lineNumber":82,"sourceCode":"    elif data_args.mix_strategy.startswith(\"interleave\"):\n        if not data_args.streaming:\n            logger.warning_rank0_once(\"We recommend using `mix_strategy=concat` in non-streaming mode.\")\n\n        strategy_map: str = {\n            \"interleave_under\": \"first_exhausted\",\n            \"interleave_over\": \"all_exhausted\",\n            \"interleave_once\": \"all_exhausted_without_replacement\",\n        }[data_args.mix_strategy]\n\n        return interleave_datasets(\n            datasets=all_datasets,\n            probabilities=data_args.interleave_probs,\n            seed=seed,\n            stopping_strategy=strategy_map,  # type: ignore\n        )\n\n    else:\n        raise ValueError(f\"Unknown mixing strategy: {data_args.mix_strategy}.\")\n\n\ndef split_dataset(\n    dataset: Optional[Union[\"Dataset\", \"IterableDataset\"]],\n    eval_dataset: Optional[Union[\"Dataset\", \"IterableDataset\", dict[str, \"Dataset\"]]],\n    data_args: \"DataArguments\",\n    seed: int,\n) -> tuple[dict, dict]:\n    r\"\"\"Split the dataset and returns two dicts containing train set and validation set.\n\n    Support both map dataset and iterable dataset.\n\n    Returns:\n        train_dict: Dictionary containing training data with key \"train\"\n        eval_dict: Dictionary containing evaluation data with keys \"validation\" or \"validation_{name}\"\n    \"\"\"\n    if eval_dataset is not None and data_args.val_size > 1e-6:\n        raise ValueError(\"Cannot specify `val_size` if `eval_dataset` is not None.\")","sourceCodeStart":64,"sourceCodeEnd":100,"githubUrl":"https://github.com/hiyouga/LlamaFactory/blob/f28afaf6355af515454dfb16c97d728307c93897/src/llamafactory/data/data_utils.py#L64-L100","documentation":"In the dataset-mixing helper, only mix_strategy values 'concat' (implicit else-branch) and the interleave strategies mapped to HF stopping strategies are accepted; anything else reaches the final else and raises ValueError with the offending value. data_args.mix_strategy comes from the training YAML.","triggerScenarios":"Setting mix_strategy: undersample / random / any typo (e.g. 'interleave-over') in the training config; the only valid values are concat, interleave_under, interleave_over, interleave_once.","commonSituations":"Copy-pasted YAML from other frameworks whose mixing vocabularies differ; guessing a strategy name instead of checking DataArguments docs; casing/typo errors.","solutions":["Use one of the supported values: concat (default), interleave_under, interleave_over, interleave_once.","For interleave strategies also set interleave_probs matching the number of datasets.","Check DataArguments.mix_strategy docstring/source for the authoritative list on your version."],"exampleFix":"# before (yaml)\nmix_strategy: random\n\n# after (yaml)\nmix_strategy: interleave_under\ninterleave_probs: [0.7, 0.3]","handlingStrategy":"validation","validationCode":"VALID = {\"concat\", \"interleave_under\", \"interleave_over\", \"interleave_once\"}\nassert data_args.mix_strategy in VALID, f\"mix_strategy must be one of {sorted(VALID)}\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Check the DataArguments docs of your installed version for supported mix_strategy values.","Lint YAML configs against a schema before runs."],"tags":["dataset","mixing","config","validation"],"backgroundTag":null,"analyzedSha":"f28afaf6355af515454dfb16c97d728307c93897","analyzedAt":"2026-08-14T21:57:28.298Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}