get_model_status(model: nn.Module)The state of model's adapters as a whole, folded from its layers.
A field the layers disagree on reads "irregular" (see
lucid.peft.TunerModelStatus): one layer enabled and another
not, an adapter merged on one layer and not on another that holds it,
an adapter that trains in some layers and is frozen in others.
Parameters
modelnn.ModuleA
lucid.peft.PeftModel, or a model adapted in place.Returns
TunerModelStatusThe model's state.
Raises
ValueErrormodel holds no adapter layer.Examples
>>> from lucid.peft import LoraConfig, get_model_status, get_peft_model
>>> import lucid.nn as nn
>>> net = nn.Sequential(nn.Linear(4, 4), nn.Linear(4, 2))
>>> config = LoraConfig(r=2, target_modules=["0", "1"])
>>> peft = get_peft_model(net, config)
>>> peft.add_adapter("other", config)
>>> status = get_model_status(peft)
>>> status.adapter_model_type, status.peft_types, status.num_adapter_layers
('LoraModel', {'default': 'LORA', 'other': 'LORA'}, 2)
>>> status.active_adapters, status.requires_grad, status.merged_adapters
(['default'], {'default': True, 'other': False}, [])