nvalchemi.training.peft.PeftMethodRegistration#

class nvalchemi.training.peft.PeftMethodRegistration(peft_method, config_cls, build_peft_setup_hooks, apply_peft_from_checkpoint_metadata, merge_peft)[source]#

Operations and configuration type associated with one PEFT method.

Parameters:
  • peft_method (str)

  • config_cls (type[PeftConfig])

  • build_peft_setup_hooks (Callable[[PeftConfig, Mapping[str, Any]], list[Any]])

  • apply_peft_from_checkpoint_metadata (_ApplyPeftFromCheckpointMetadata)

  • merge_peft (Callable[..., nn.Module])

peft_method#

Stable and unique PEFT method discriminator stored in serialized metadata.

Type:

str

config_cls#

Configuration class associated with the method.

Type:

type[PeftConfig]

build_peft_setup_hooks#

Callable that builds the hooks needed to configure PEFT before training.

Type:

Callable[[PeftConfig, Mapping[str, Any]], list[Any]]

apply_peft_from_checkpoint_metadata#

Callable that recreates the PEFT structure described by checkpoint metadata on a model.

Type:

_ApplyPeftFromCheckpointMetadata

merge_peft#

Callable that merges PEFT parameters into a model.

Type:

Callable[…, nn.Module]