{"record":{"id":"4ee7edd4fedf6745","repo":"unslothai/unsloth","slug":"active-0-requires-an-adapter-method-lora-qlora","errorCode":null,"errorMessage":"{active[0]} requires an adapter method (LoRA/QLoRA or Continued Pretraining); it has no effect under Full Finetuning.","messagePattern":"(.+?) requires an adapter method \\(LoRA/QLoRA or Continued Pretraining\\); it has no effect under Full Finetuning\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"studio/backend/models/training.py","lineNumber":628,"sourceCode":"        # clear error instead of a silently-ignored flag.\n        active = [\n            name\n            for name, enabled in (\n                (\"use_rslora\", self.use_rslora),\n                (\"use_loftq\", self.use_loftq),\n                (\"use_dora\", self.use_dora),\n            )\n            if enabled\n        ]\n        if len(active) > 1:\n            raise ValueError(\n                f\"Only one LoRA variant may be enabled at a time; got {active}. \"\n                \"use_rslora, use_loftq, and use_dora are mutually exclusive.\"\n            )\n        # getattr, not self.training_type: model_construct() (used by single-field tests) leaves\n        # required fields unset, and this mode=\"after\" validator still runs on that partial instance.\n        if getattr(self, \"training_type\", None) == \"Full Finetuning\" and active:\n            raise ValueError(\n                f\"{active[0]} requires an adapter method (LoRA/QLoRA or \"\n                \"Continued Pretraining); it has no effect under Full Finetuning.\"\n            )\n        return self\n\n\nclass TrainingJobResponse(BaseModel):\n    \"\"\"Immediate response when training is initiated\"\"\"\n\n    job_id: str = Field(..., description = \"Unique training job identifier\")\n    status: Literal[\"pending\", \"queued\", \"error\"] = Field(..., description = \"Initial job status\")\n    message: str = Field(..., description = \"Human-readable status message\")\n    error: Optional[str] = Field(None, description = \"Error details if status is 'error'\")\n    error_code: Optional[str] = Field(None, description = \"Stable error code if status is 'error'\")\n\n\nclass TrainingStartRequestStatus(BaseModel):\n    start_request_id: str","sourceCodeStart":610,"sourceCodeEnd":646,"githubUrl":"https://github.com/unslothai/unsloth/blob/203007d19051dcd2ae33876786d117c99f6b0368/studio/backend/models/training.py#L610-L646","documentation":"Pydantic model validator that rejects LoRA variant flags when training_type is 'Full Finetuning'. Flags like use_rslora/use_loftq/use_dora only modify adapter training (LoRA/QLoRA or Continued Pretraining); under full finetuning there is no adapter, so the flag would be silently ignored — the model raises instead so the caller knows their config is contradictory. Note it reads training_type via getattr because model_construct() partial instances (used by single-field tests) still run this mode='after' validator.","triggerScenarios":"POSTing a TrainingStartRequest with training_type='Full Finetuning' and any of use_rslora/use_loftq/use_dora true; e.g. a config flipped from LoRA to full finetuning without removing adapter flags.","commonSituations":"Reusing a LoRA recipe config but changing only training_type; YAML defaults that set a variant flag globally; experimenting with DoRA then switching to full finetuning for comparison.","solutions":["Set training_type to 'LoRA' or 'QLoRA' (or Continued Pretraining) if you want the variant flag to apply.","Or remove the variant flag (set it false/omit it) if full finetuning is intended — it had no effect anyway.","Sweep your config for leftover adapter flags whenever you switch training_type."],"exampleFix":"# before\nreq = TrainingStartRequest(training_type=\"Full Finetuning\", use_dora=True, ...)\n\n# after\nreq = TrainingStartRequest(training_type=\"LoRA\", use_dora=True, ...)","handlingStrategy":"validation","validationCode":"LORA_VARIANT_FLAGS = (\"use_rslora\", \"use_loftq\", \"use_dora\")\n\ndef variant_flags_consistent(payload: dict) -> bool:\n    if payload.get(\"training_type\") == \"Full Finetuning\":\n        return not any(payload.get(f) for f in LORA_VARIANT_FLAGS)\n    return True","typeGuard":null,"tryCatchPattern":null,"preventionTips":["When switching training_type, diff the config and strip adapter-specific flags.","Add a config schema in your repo that forbids variant flags under Full Finetuning."],"tags":["pydantic","lora","fine-tuning","validation"],"backgroundTag":null,"analyzedSha":"203007d19051dcd2ae33876786d117c99f6b0368","analyzedAt":"2026-08-15T02:48:39.846Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}