hiyouga/LlamaFactory · error · NotImplementedError

Unknown finetuning type: {finetuning_args.finetuning_type}.

Error message

Unknown finetuning type: {finetuning_args.finetuning_type}.

What it means

Raised as NotImplementedError at the end of setup_adapter when finetuning_args.finetuning_type matches none of full, freeze, lora, oft. The value is a free string from the config, so any typo or unsupported method falls through to this branch.

Source

Thrown at src/llamafactory/model/adapter.py:360

        pass
    elif finetuning_args.pure_bf16 or finetuning_args.use_badam:
        logger.info_rank0("Pure bf16 / BAdam detected, remaining trainable params in half precision.")
    elif model_args.quantization_bit is None and is_deepspeed_zero3_enabled():
        logger.info_rank0("DeepSpeed ZeRO3 detected, remaining trainable params in float32.")
    else:
        logger.info_rank0("Upcasting trainable params to float32.")
        cast_trainable_params_to_fp32 = True

    if finetuning_args.finetuning_type == "full":
        _setup_full_tuning(model, finetuning_args, is_trainable, cast_trainable_params_to_fp32)
    elif finetuning_args.finetuning_type == "freeze":
        _setup_freeze_tuning(model, finetuning_args, is_trainable, cast_trainable_params_to_fp32)
    elif finetuning_args.finetuning_type in ["lora", "oft"]:
        model = _setup_lora_tuning(
            config, model, model_args, finetuning_args, is_trainable, cast_trainable_params_to_fp32
        )
    else:
        raise NotImplementedError(f"Unknown finetuning type: {finetuning_args.finetuning_type}.")

    return model

View on GitHub (pinned to f28afaf635)

Solutions

  1. Set finetuning_type to one of: full, freeze, lora, oft (lowercase).
  2. Check for stray whitespace/quotes in the YAML value.

Example fix

# before
finetuning_type: LoRA

# after
finetuning_type: lora
Defensive patterns

Strategy: type-guard

Validate before calling

VALID = {"full", "freeze", "lora", "oft"}
ft = cfg["finetuning_args"]["finetuning_type"]
assert ft in VALID, f"finetuning_type must be one of {sorted(VALID)}, got {ft!r}"

Type guard

def is_valid_finetuning_type(ft: str) -> bool:
    return ft in {"full", "freeze", "lora", "oft"}

Prevention

When it happens

Trigger: Setting finetuning_type to a misspelling ('lor', 'Lora'), a case variant ('LoRA'), or a method this version does not implement.

Common situations: YAML typos; assuming a newer method name (e.g. from another framework) is available in the installed version.

Related errors


AI-assisted analysis of hiyouga/LlamaFactory@f28afaf635 (2026-08-14). Data as JSON: /api/errors/91ea5e180bf3e01d. Report an issue: GitHub.