Skip to content

Confusing bare KeyError when LoRA config uses "alpha" instead of "scale" #1670

Description

@arjunneema09

Description
The LoRA config format (lora_parameters in the YAML, e.g. mlx_lm/examples/lora_config.yaml)
requires a key named scale. Many LoRA tutorials and other frameworks (e.g. PEFT) use
alpha for the equivalent concept, so it's an easy mistake to make. When alpha is
passed instead of scale, the failure is a bare KeyError: 'scale' raised deep in
mlx_lm/tuner/utils.py (to_lora), with no message pointing at the actual problem.

To reproduce

  1. Create a config with:
    lora_parameters:
      keys: ["self_attn.q_proj", "self_attn.v_proj"]
      rank: 8
      alpha: 16
      dropout: 0.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions