Skip to content

"name 'bias' is not defined" in kernels\utils.py get_lora_parameters_bias #1893

Closed

Description

@xandrmoro

After update to 2025.3.1

def get_lora_parameters_bias(proj):
    # For DPO or disabled adapters
    base_layer = getattr(proj, "base_layer", proj) # (proj.base_layer if hasattr(proj, "base_layer") else proj)
    W = base_layer.weight

    # if not hasattr(proj, "disable_adapters") or proj.disable_adapters or proj.merged:
    if getattr(proj, "disable_adapters", True) or proj.merged:
        return W, getattr(W, "quant_state", None), None, None, None, bias
    pass

    adapter = getattr(proj, "active_adapters", None)
    if adapter is None: adapter = getattr(proj, "active_adapter", ("default"))
    adapter = adapter[0]

    return (
        W,
        getattr(W, "quant_state", None),
        proj.lora_A [adapter].weight,
        proj.lora_B [adapter].weight,
        proj.scaling[adapter],
        base_layer.bias,
    )

And, well, bias is, indeed, not defined in the first return. Replacing it with base_layer.bias seems to do the trick (at least it no longer crashes), but not sure if its what supposed to be there.

Activity

  1. Xisikka commented on Mar 4, 2025

    @Xisikka

    having same issues here,this was not an issue one day ago.

  2. danielhanchen commented on Mar 4, 2025

    @danielhanchen
    Member

    Just fixed - apologies! For Colab, Kaggle, please restart and run all again. For local machines, do: pip install --force-reinstall --no-deps --no-cache-dir unsloth unsloth_zoo

  3. added
    fixed - pending confirmation
    on Mar 4, 2025
  4. xandrmoro commented on Mar 4, 2025

    @xandrmoro
    Author

    Yup, works now, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    fixed - pending confirmation

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions