LoKr
7 memberslucid.peft.tuners.lokrlucid.peft.tuners.lokr — LoKr: a weight update that is a Kronecker product.
LoKr (Yeh et al., 2023, arXiv:2309.14859 — LyCORIS) learns , with each dimension of the weight factored into two near-equal parts, one per Kronecker factor; a factor is a full matrix or, past a size, a low-rank product. The Kronecker structure gives a high-rank update from very few parameters, and the first factor starts at zero so the adapted model starts as the base. Pick it when LoRA's rank is the limit and parameters are scarce.
Where the reference library keeps them, so isinstance(m, LoKrLayer) and from lucid.peft.tuners.lokr import Linear read as they do there. One layer type per module the method
adapts: Linear, Conv1d and Conv2d; factorization is the split of a dimension into
the two Kronecker factors. LoKrConfig and LoKrModel are here and exported from
lucid.peft. Importing the package registers the method (its config under PeftType.LOKR, its
tuner and layers), which is what makes get_peft_model and PeftModel.from_pretrained know it.
Yeh, Shih-Ying, et al. "Navigating Text-To-Image Customization: From LyCORIS Fine-Tuning to Model Evaluation." [arXiv:2309.14859](https://arxiv.org/abs/2309.14859), 2023.
LoKr (Yeh et al., 2023, arXiv:2309.14859 — LyCORIS) learns a weight-shaped update as a Kronecker product,
Classes
Conv1dAn nn.Conv1d with a LoKr update: the Kronecker kernel is convolved with the base's stride, padding and groups.
Conv2dAn nn.Conv2d with a LoKr update: the Kronecker kernel is convolved with the base's stride, padding and groups.
Linear1 methodsAn nn.Linear with a LoKr update: .
LoKrLayer18 methodsAdapter bookkeeping and the update shared by the LoKr layers.
LoKrConfig9 methodsHow lucid.peft.get_peft_model adapts a model with LoKr.
LoKrModel15 methodsA model whose chosen modules carry a Kronecker-product update, and the tools to undo it.