{"record":{"id":"7d0c6067027f93a8","repo":"hiyouga/LlamaFactory","slug":"use-dora-is-only-valid-for-lora-training","errorCode":null,"errorMessage":"`use_dora` is only valid for LoRA training.","messagePattern":"`use_dora` is only valid for LoRA training\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"src/llamafactory/hparams/finetuning_args.py","lineNumber":632,"sourceCode":"\n        if self.finetuning_type == \"lora\" and (self.use_galore or self.use_apollo or self.use_badam):\n            raise ValueError(\"Cannot use LoRA with GaLore, APOLLO or BAdam together.\")\n\n        if int(self.use_galore) + int(self.use_apollo) + (self.use_badam) > 1:\n            raise ValueError(\"Cannot use GaLore, APOLLO or BAdam together.\")\n\n        if self.pissa_init and (self.stage in [\"ppo\", \"kto\"] or self.use_ref_model):\n            raise ValueError(\"Cannot use PiSSA for current training stage.\")\n\n        if self.finetuning_type != \"lora\":\n            if self.loraplus_lr_ratio is not None:\n                raise ValueError(\"`loraplus_lr_ratio` is only valid for LoRA training.\")\n\n            if self.use_rslora:\n                raise ValueError(\"`use_rslora` is only valid for LoRA training.\")\n\n            if self.use_dora:\n                raise ValueError(\"`use_dora` is only valid for LoRA training.\")\n\n            if self.pissa_init:\n                raise ValueError(\"`pissa_init` is only valid for LoRA training.\")\n\n    def to_dict(self) -> dict[str, Any]:\n        args = asdict(self)\n        args = {k: f\"<{k.upper()}>\" if k.endswith(\"api_key\") else v for k, v in args.items()}\n        return args\n","sourceCodeStart":614,"sourceCodeEnd":641,"githubUrl":"https://github.com/hiyouga/LlamaFactory/blob/f28afaf6355af515454dfb16c97d728307c93897/src/llamafactory/hparams/finetuning_args.py#L614-L641","documentation":"Weight-Decomposed Low-Rank Adaptation (DoRA) is a LoRA variant that decomposes weights into magnitude and direction; it only applies to LoRA adapters. FinetuningArguments.__post_init__ (src/llamafactory/hparams/finetuning_args.py:632) rejects use_dora: true when finetuning_type != lora.","triggerScenarios":"use_dora: true together with finetuning_type: full or freeze.","commonSituations":"Switching a DoRA recipe to full fine-tuning without cleaning flags; or assuming DoRA is a general optimizer that can stack on freeze training.","solutions":["Remove use_dora: true if fine-tuning fully or freezing.","Set finetuning_type: lora to use DoRA adapters.","Verify your PEFT/transformers version supports DoRA for the target model if you keep LoRA+DoRA."],"exampleFix":"# before (yaml)\nfinetuning_type: freeze\nuse_dora: true\n\n# after (yaml)\nfinetuning_type: lora\nuse_dora: true","handlingStrategy":"validation","validationCode":"def check_dora(finetuning_type: str, use_dora: bool) -> None:\n    if use_dora and finetuning_type != \"lora\":\n        raise ValueError(\"use_dora requires finetuning_type=lora\")","typeGuard":null,"tryCatchPattern":null,"preventionTips":["DoRA modifies LoRA adapters only; remove it for full/freeze runs.","Verify PEFT version supports DoRA for your model family when enabling it."],"tags":["config","lora","dora"],"backgroundTag":null,"analyzedSha":"f28afaf6355af515454dfb16c97d728307c93897","analyzedAt":"2026-08-14T21:57:28.298Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}