Implementing kernel
C++ engine symbols that back this Python API.An nn.Linear with a PSOFT update: .
Parameters
base_ layernn.LinearThe layer to adapt; the other parameters are those of
PsoftLayer.adapter_ namestrName of the first adapter.
configPsoftConfigThe rank, scale, SVD options, the options of the rotation and
init_weights.Examples
>>> import lucid
>>> import lucid.nn as nn
>>> from lucid.peft import PsoftConfig
>>> from lucid.peft.tuners.psoft import Linear
>>> base = nn.Linear(8, 6)
>>> layer = Linear(base, "default", PsoftConfig(r=3, target_modules=["x"]))
>>> sorted(layer.psoft_R["default"].state_dict()), tuple(layer.psoft_R["default"].weight.shape)
(['vector_a', 'vector_b', 'weight'], (3,))
>>> x = lucid.randn(4, 8)
>>> bool((layer(x) == base(x)).all().item()) # R = I and the vectors are one
True