convert_to_lora(model: nn.Module, rank: int | float, adapter_name: str = 'default', progressbar: bool = False, compile_kwargs: dict[str, object] | None = None)Convert an additive PEFT adapter on model into a LoRA config and state dictionary.
Parameters
modelnn.ModuleA PEFT model (or module containing PEFT tuner layers) whose additive delta weights
can be decomposed into rank-
r LoRA factors.rankint or floatTarget LoRA rank (positive integer) or cumulative squared singular-value threshold
in
[0.0, 1.0] used to pick each layer's rank dynamically.adapter_ namestr= "default"Name of the adapter to convert.
progressbarbool= FalseAccepted for signature parity with the reference adapter library.
compile_ kwargsdict= NoneOptional keyword arguments forwarded to
lucid.compile around the per-layer
SVD conversion helper.Returns
tuple of (LoraConfig, dict of str to Tensor)The converted LoraConfig and a LoRA state dict ready to save or load.