MCPcopy Create free account
hub / github.com/OpenBMB/ToolBench / maybe_zero_3

Function maybe_zero_3

toolbench/train/train_lora.py:55–62  ·  view source on GitHub ↗
(param)

Source from the content-addressed store, hash-verified

53
54
55def maybe_zero_3(param):
56 if hasattr(param, "ds_id"):
57 assert param.ds_status == ZeroParamStatus.NOT_AVAILABLE
58 with zero.GatheredParameters([param]):
59 param = param.data.detach().cpu().clone()
60 else:
61 param = param.detach().cpu().clone()
62 return param
63
64
65# Borrowed from peft.utils.get_peft_model_state_dict

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected