Implementing kernel
C++ engine symbols that back this Python API.An nn.Linear with a PEANuT update: .
Parameters
base_ layernn.LinearThe layer to adapt; the other parameters are those of
PeanutLayer.adapter_ namestrName of the first adapter.
configPeanutConfigr, depth, act_fn, scaling and init_weights.Examples
>>> import lucid
>>> import lucid.nn as nn
>>> from lucid.peft import PeanutConfig
>>> from lucid.peft.tuners.peanut import Linear
>>> base = nn.Linear(8, 4)
>>> layer = Linear(base, "default", PeanutConfig(r=2, depth=1, target_modules=["x"]))
>>> sorted(layer.peanut_A["default"].state_dict()), tuple(layer.peanut_B["default"].weight.shape)
(['weight'], (4, 2))
>>> x = lucid.randn(3, 8)
>>> bool((layer(x) == base(x)).all().item()) # B starts at zero
True