xnn.common.finetune.lora.LoRAEquivariantLinear#
- class xnn.common.finetune.lora.LoRAEquivariantLinear(base, rank=4, alpha=1.0, *, init_std=0.001)[source]#
Bases:
ModuleBlock-wise low-rank update of an
e3nn.o3.Linear.An
o3.Linearholds one weight blockW_pof shape(mul_in, mul_out)per pathp(an input irrep block connected to an output block of the same irrep), applied aspath_weight * W_pon the irrep’s channels. Each block gets its own rank-rupdate acting on the effective map:path_weight * W_p + scaling * A_p B_p, withA_pof shape(mul_in, r)Gaussian andB_pof shape(r, mul_out)zero at the start. Every block stays a scalar matrix on one irrep, so the adapted layer is equivariant. The base linear is evaluated with the adapted flat weight through its externalweightargument. Bias terms (scalar outputs) are left unchanged.- Parameters:
base (e3nn.o3.Linear) – The layer to adapt (internal, shared weights).
rank (int, optional) – Rank of every block’s update, by default 4.
alpha (float, optional) – Scaling numerator, by default 1.0.
init_std (float, optional) – Standard deviation of the input factors at initialization, by default 1e-3.
- Variables: