nvalchemi.training.peft.register_peft_method#
- nvalchemi.training.peft.register_peft_method(method, *, config_cls, build_peft_setup_hooks, apply_peft_from_checkpoint_metadata, merge_peft)[source]#
Register all behavior required to use one PEFT method.
- Parameters:
method (str) – Stable method name used in serialized PEFT metadata.
config_cls (type[PeftConfig]) – Configuration class associated with the method.
build_peft_setup_hooks (Callable[[PeftConfig, Mapping[str, Any]], list[Any]]) – Callable that builds the hooks needed to configure PEFT before training.
apply_peft_from_checkpoint_metadata (_ApplyPeftFromCheckpointMetadata) – Callable that recreates the PEFT structure described by checkpoint metadata on a model.
merge_peft (Callable[..., nn.Module]) – Callable that merges PEFT parameters into a model.
- Returns:
The installed registration.
- Return type:
- Raises:
ValueError – If
methodis empty or the method or configuration class is already registered.TypeError – If
config_clsis not aPeftConfigsubclass.