get_peft_config(config_dict: dict[str, object])Build the adapter config a dict describes, of the class its peft_type names.
The dict is the shape PeftConfig.to_dict returns and adapter_config.json
holds. It is lucid.peft.PeftConfig.from_peft_type called on the dict, which looks
the class up in PEFT_TYPE_TO_CONFIG_MAPPING and reads the dict as
lucid.peft.PeftConfig.from_dict does, so a key from the reference's file
that this library has no field for is accepted at a value that turns its feature off.
Parameters
config_ dictdict of str to objectThe config's fields, by name, with the method under
"peft_type".Returns
PeftConfigThe validated config, of the method's own class.
Raises
KeyErrorconfig_dict has no "peft_type", or it names a method this library lacks.NotImplementedErrorThe dict turns on a feature the library does not implement.
Examples
>>> from lucid.peft import get_peft_config
>>> config = get_peft_config({"peft_type": "LORA", "r": 4, "target_modules": ["q"]})
>>> type(config).__name__, config.r
('LoraConfig', 4)