{"record":{"id":"2680050f76fdf2cd","repo":"hiyouga/LlamaFactory","slug":"please-specify-dataset-for-training","errorCode":null,"errorMessage":"Please specify dataset for training.","messagePattern":"Please specify dataset for training\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"src/llamafactory/hparams/parser.py","lineNumber":478,"sourceCode":"        if finetuning_args.reward_model_type == \"lora\" and model_args.use_unsloth:\n            raise ValueError(\"Unsloth does not support lora reward model.\")\n\n        if training_args.report_to and any(\n            logger not in (\"wandb\", \"tensorboard\", \"trackio\", \"none\") for logger in training_args.report_to\n        ):\n            raise ValueError(\"PPO only accepts wandb, tensorboard, or trackio logger.\")\n\n    if not model_args.use_kt and training_args.parallel_mode == ParallelMode.NOT_DISTRIBUTED:\n        raise ValueError(\"Please launch distributed training with `llamafactory-cli` or `torchrun`.\")\n\n    if training_args.deepspeed and training_args.parallel_mode != ParallelMode.DISTRIBUTED:\n        raise ValueError(\"Please use `FORCE_TORCHRUN=1` to launch DeepSpeed training.\")\n\n    if training_args.max_steps == -1 and data_args.streaming:\n        raise ValueError(\"Please specify `max_steps` in streaming mode.\")\n\n    if training_args.do_train and data_args.dataset is None:\n        raise ValueError(\"Please specify dataset for training.\")\n\n    if (training_args.do_eval or training_args.do_predict or training_args.predict_with_generate) and (\n        data_args.eval_dataset is None and data_args.val_size < 1e-6\n    ):\n        raise ValueError(\"Please make sure eval_dataset be provided or val_size >1e-6\")\n\n    if training_args.predict_with_generate:\n        if is_deepspeed_zero3_enabled():\n            raise ValueError(\"`predict_with_generate` is incompatible with DeepSpeed ZeRO-3.\")\n\n        if finetuning_args.compute_accuracy:\n            raise ValueError(\"Cannot use `predict_with_generate` and `compute_accuracy` together.\")\n\n    if training_args.do_train and model_args.quantization_device_map == \"auto\":\n        raise ValueError(\"Cannot use device map for quantized models in training.\")\n\n    if finetuning_args.pissa_init and is_deepspeed_zero3_enabled():\n        raise ValueError(\"Please use scripts/pissa_init.py to initialize PiSSA in DeepSpeed ZeRO-3.\")","sourceCodeStart":460,"sourceCodeEnd":496,"githubUrl":"https://github.com/hiyouga/LlamaFactory/blob/f28afaf6355af515454dfb16c97d728307c93897/src/llamafactory/hparams/parser.py#L460-L496","documentation":"Raised in parser.py:478 when training_args.do_train is true but data_args.dataset is None. LlamaFactory trains purely from dataset names registered in data/dataset_info.json, so an empty dataset list leaves the trainer with nothing to consume.","triggerScenarios":"`llamafactory-cli train` with a config missing the `dataset:` key (or dataset: null) while do_train is set; also calling get_train_args on a dict without \"dataset\" then running run_sft.","commonSituations":"Typos like `datasets:` or `dataset_name:` instead of `dataset:`; a WebUI-generated YAML where the dataset field was left blank; template variables (e.g. ${DATASET}) expanding to empty in CI.","solutions":["Add `dataset: <name>` matching an entry in data/dataset_info.json to the config","Check spelling of the key — it must be exactly `dataset` (list or string)","If the dataset is not registered yet, add its definition to dataset_info.json first, then reference it"],"exampleFix":"# before (YAML)\n### dataset\n# do_train: true, no dataset key\n\n# after\ndo_train: true\ndataset: alpaca_gpt4_zh","handlingStrategy":"validation","validationCode":"if config.get(\"do_train\") and not config.get(\"dataset\"):\n    raise SystemExit(\"do_train: true requires dataset: <name from dataset_info.json>\")","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Assert required keys (dataset, do_train pairs) right after loading the YAML","Register datasets in dataset_info.json before referencing them","Fail fast on empty template variables (e.g. ${DATASET}) in generated configs"],"tags":["dataset","training","config-validation","yaml"],"backgroundTag":null,"analyzedSha":"f28afaf6355af515454dfb16c97d728307c93897","analyzedAt":"2026-08-14T21:57:28.298Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}