Shortcuts

get_adapter_state_dict

torchtune.modules.peft.get_adapter_state_dict(state_dict: Dict[str, Any], device: Optional[str] = 'cpu') Dict[str, Any][source]

Return the subset of the full state_dict from a model that correspond to an adapter. Assumes that “lora” and “magnitude” are unique names for adapter parameters, and that the state_dict is not sharded. All returned parameters are moved to CPU.

Parameters:
  • state_dict (Dict[str, Any]) – Full model state dict.

  • device (Optional[str]) – device to move adapter parameters to. Default: ‘cpu’

Returns:

the subset of model’s state dict containing only adapter parameters.

Return type:

Dict[str, Any]

Docs

Access comprehensive developer documentation for PyTorch

View Docs

Tutorials

Get in-depth tutorials for beginners and advanced developers

View Tutorials

Resources

Find development resources and get your questions answered

View Resources