Implementing kernel
C++ engine symbols that back this Python API.An nn.Linear with a PVeRA update: , the Gaussian latent.
Parameters
base_ layernn.LinearThe layer to adapt; the other parameters are those of
PveraLayer.adapter_ namestrName of the adapter created at once.
configPveraConfigThe adapter's config.
Examples
>>> import lucid
>>> import lucid.nn as nn
>>> from lucid.peft import PveraConfig
>>> from lucid.peft.tuners.pvera import Linear
>>> base = nn.Linear(8, 4)
>>> layer = Linear(base, "default", PveraConfig(r=3, target_modules=["x"]))
>>> tuple(layer.pvera_lambda_d["default"].shape), tuple(layer.pvera_lambda_b["default"].shape)
((6,), (4,))
>>> x = lucid.randn(2, 8)
>>> bool((layer(x) == base(x)).all().item()) # lambda_b starts at zero
True