MCPcopy Create free account
hub / github.com/OpenDriveLab/ReSim / copy_nested_list

Function copy_nested_list

SwissArmyTransformer/sat/model/finetune/lora2.py:38–45  ·  view source on GitHub ↗
(src, dst)

Source from the content-addressed store, hash-verified

36try:
37 from bitsandbytes.nn import LinearNF4
38 def copy_nested_list(src, dst):
39 for i in range(len(dst)):
40 if type(dst[i]) is torch.Tensor:
41 dst[i].copy_(src[i])
42 elif type(dst[i]) is list:
43 copy_nested_list(src[i], dst[i])
44 else:
45 dst[i] = src[i]
46 class HackLinearNF4(LinearNF4):
47 def _load_from_state_dict(self, state_dict, prefix, local_metadata, strict, missing_keys, unexpected_keys, error_msgs):
48 if prefix + 'weight' in state_dict:

Callers 1

_load_from_state_dictMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected