快捷方式

get_adapter_state_dict

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

返回模型完整 state_dict 中对应于适配器的子集。假设 “lora” 和 “magnitude” 是适配器参数的唯一名称,并且 state_dict 未分片。所有返回的参数都将移动到 CPU。

参数:
  • state_dict (Dict[str, Any]) – 完整模型状态字典。

  • device (Optional[str]) – 将适配器参数移动到的设备。默认值: ‘cpu’

返回:

模型的 state_dict 子集,仅包含适配器参数。

返回类型:

Dict[str, Any]

文档

访问 PyTorch 的综合开发者文档

查看文档

教程

获取面向初学者和高级开发者的深入教程

查看教程

资源

查找开发资源并获得问题解答

查看资源