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]