Implementing kernel
C++ engine symbols that back this Python API.An nn.Linear with a BEFT bias: .
Stackable: the bias reads nothing of the weight, so the layer may stand on another method's layer (and one may stand on it).
Parameters
base_ layernn.LinearThe layer to adapt; the other parameters are those of
BeftLayer.adapter_ namestrName of the first adapter.
configBeftConfiginit_weights chooses a zero start (the default) or a standard normal draw.Examples
>>> import lucid
>>> import lucid.nn as nn
>>> from lucid.peft import BeftConfig
>>> from lucid.peft.tuners.beft import Linear
>>> base = nn.Linear(8, 4)
>>> layer = Linear(base, "default", BeftConfig(target_modules=["x"]))
>>> tuple(layer.beft_bias["default"].shape)
(1, 4)
>>> x = lucid.randn(3, 8)
>>> bool((layer(x) == base(x)).all().item()) # the bias starts at zero
True