{"record":{"id":"5a5a7886d6a50c16","repo":"hiyouga/LlamaFactory","slug":"please-provide-model-name-or-path","errorCode":null,"errorMessage":"Please provide `model_name_or_path`.","messagePattern":"Please provide `model_name_or_path`\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"critical","filePath":"src/llamafactory/hparams/model_args.py","lineNumber":208,"sourceCode":"        default=None,\n        metadata={\"help\": \"Auth token to log in with ModelScope Hub.\"},\n    )\n    om_hub_token: str | None = field(\n        default=None,\n        metadata={\"help\": \"Auth token to log in with Modelers Hub.\"},\n    )\n    print_param_status: bool = field(\n        default=False,\n        metadata={\"help\": \"For debugging purposes, print the status of the parameters in the model.\"},\n    )\n    trust_remote_code: bool = field(\n        default=False,\n        metadata={\"help\": \"Whether to trust the execution of code from datasets/models defined on the Hub or not.\"},\n    )\n\n    def __post_init__(self):\n        if self.model_name_or_path is None:\n            raise ValueError(\"Please provide `model_name_or_path`.\")\n\n        if self.adapter_name_or_path is not None:  # support merging multiple lora weights\n            self.adapter_name_or_path = [path.strip() for path in self.adapter_name_or_path.split(\",\")]\n\n        if self.add_tokens is not None:  # support multiple tokens\n            self.add_tokens = [token.strip() for token in self.add_tokens.split(\",\")]\n\n        # Process special tokens with priority: new_special_tokens_config > add_special_tokens\n        if self.new_special_tokens_config is not None:\n            # Priority 1: Load from YAML config (extracts both tokens and descriptions)\n            try:\n                cfg = OmegaConf.load(self.new_special_tokens_config)\n                token_descriptions = OmegaConf.to_container(cfg)\n\n                if not isinstance(token_descriptions, dict):\n                    raise ValueError(\n                        f\"YAML config must be a dictionary mapping tokens to descriptions. \"\n                        f\"Got: {type(token_descriptions)}\"","sourceCodeStart":190,"sourceCodeEnd":226,"githubUrl":"https://github.com/hiyouga/LlamaFactory/blob/f28afaf6355af515454dfb16c97d728307c93897/src/llamafactory/hparams/model_args.py#L190-L226","documentation":"Raised in ModelArguments.__post_init__ (src/llamafactory/hparams/model_args.py:208) when model_name_or_path is None. Every LlamaFactory workflow (train/chat/api/export) needs a base model or tokenizer location; this is the first sanity check executed when the dataclass is constructed from the YAML/JSON config or CLI args.","triggerScenarios":"Launching train/chat/export with a config that omits model_name_or_path; providing it under a misspelled key (model_name_or_paths, model_path); an empty string is accepted, but None from a missing key is not; programmatic get_model_args calls with no model key.","commonSituations":"Quick test configs copied from examples with the model line deleted; template rendering that drops the field when a variable is undefined; merging YAML files where an anchor overrides the model key to null.","solutions":["Add model_name_or_path (a Hub repo id, local dir, or checkpoint path) to the top level of your training/chat/export YAML","Check exact spelling: the key is model_name_or_path","If templating, ensure undefined variables render to a real default instead of dropping the key"],"exampleFix":"# before\n### model\n# model_name_or_path: meta-llama/Llama-3-8B-Instruct\n\n# after\nmodel_name_or_path: meta-llama/Llama-3-8B-Instruct","handlingStrategy":"validation","validationCode":"assert cfg.get('model_name_or_path'), 'model_name_or_path is required before launching'\n# optionally verify early:\n# from huggingface_hub import model_info; model_info(cfg['model_name_or_path'])","typeGuard":"def has_model(cfg: dict) -> bool:\n    return bool(cfg.get('model_name_or_path'))","tryCatchPattern":null,"preventionTips":["Make model_name_or_path the first line of every config template with no default","Fail in your wrapper script before GPU allocation if the key is missing"],"tags":["hparams","required-field","config-validation","quickstart"],"backgroundTag":null,"analyzedSha":"f28afaf6355af515454dfb16c97d728307c93897","analyzedAt":"2026-08-14T21:57:28.298Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}