Skip to content
module

LoHa

6 members
lucid.peft.tuners.loha

lucid.peft.tuners.loha — LoHa: a Hadamard product of low-rank products as the update.

LoHa (Hyeon-Woo et al., 2021, arXiv:2108.06098 — the FedPara parameterisation, in the LyCORIS form) learns ΔW=αr(W1aW1b)⊙(W2aW2b)\Delta W = \frac{\alpha}{r}(W_{1a}W_{1b})\odot(W_{2a}W_{2b}). Two rank-rr factors multiplied elementwise reach rank r2r^2 for twice LoRA's parameters, and one of them starts at zero so the adapted model starts as the base. Pick it over LoRA when a higher-rank update is worth the extra parameters (the LyCORIS family is mostly used for diffusion models).

Where the reference library keeps them, so isinstance(m, LoHaLayer) and from lucid.peft.tuners.loha import Linear read as they do there. One layer type per module the method adapts: Linear, Conv1d and Conv2d. LoHaConfig and LoHaModel are here and exported from lucid.peft. Importing the package registers the method (its config under PeftType.LOHA, its tuner and layers), which is what makes get_peft_model and PeftModel.from_pretrained know it.

Paper

Hyeon-Woo, Nam, et al. "FedPara: Low-Rank Hadamard Product for Communication-Efficient Federated Learning." [arXiv:2108.06098](https://arxiv.org/abs/2108.06098), 2021.

Overview

LoHa (Hyeon-Woo et al., 2021, arXiv:2108.06098 — the FedPara parameterisation, in the LyCORIS form) learns a weight-shaped update as the Hadamard product of two low-rank products,

Classes