Implementing kernel
C++ engine symbols that back this Python API.An nn.Linear with a task-routed mixture of low-rank skills.
Parameters
base_ layernn.LinearThe layer to adapt; kept as
base_layer, its parameters shared.adapter_ namestrName of the adapter, the key in
poly_lora_A and the other tables.configPolyConfigThe adapter's config.
Examples
>>> import lucid
>>> import lucid.nn as nn
>>> from lucid.peft import PolyConfig
>>> from lucid.peft.tuners.poly import Linear
>>> base = nn.Linear(8, 4)
>>> layer = Linear(base, "default", PolyConfig(r=2, n_tasks=2, target_modules=["x"]))
>>> x = lucid.randn(3, 5, 8)
>>> out = layer(x, task_ids=lucid.tensor([0, 1, 0]))
>>> bool((out == base(x)).all().item()) # B starts at zero
True