Implementing kernel
C++ engine symbols that back this Python API.An nn.Linear whose rows are split into subspaces, each with its own low-rank update.
Parameters
base_ layernn.LinearThe layer to adapt; the other parameters are those of
AdamssLayer.adapter_ namestrName of the first adapter.
configAdamssConfigThe rank, the number of subspaces and their rank, the initialisation and the seed.
Examples
>>> import lucid
>>> import lucid.nn as nn
>>> from lucid.peft import AdamssConfig
>>> from lucid.peft.tuners.adamss import Linear
>>> base = nn.Linear(8, 6)
>>> layer = Linear(base, "default", AdamssConfig(r=4, num_subspaces=2, target_modules=["x"]))
>>> layer.num_subspaces["default"], sum(b.shape[0] for b in layer.adamss_B["default"].parameters())
(2, 6)
>>> x = lucid.randn(3, 8)
>>> bool((layer(x) == base(x)).all().item()) # every B starts at zero
True