MCPcopy Create free account
hub / github.com/GeWu-Lab/AnyTouch2 / load_model_from_multi_clip

Function load_model_from_multi_clip

scripts/quick_start.py:56–70  ·  view source on GitHub ↗
(ckpt, model)

Source from the content-addressed store, hash-verified

54 return img_list, img_list_transformed
55
56def load_model_from_multi_clip(ckpt, model):
57
58 new_ckpt = {}
59 for key,item in ckpt.items():
60 # print(key)
61 if "touch_mae_model" in key and 'decoder' not in key and 'mask_token' not in key:
62 new_ckpt[key.replace('touch_mae_model.','')] = copy.deepcopy(item)
63
64 for k,v in model.named_parameters():
65 if k not in new_ckpt.keys():
66 new_ckpt[k] = v
67
68 model.load_state_dict(new_ckpt, strict=True)
69
70 return model
71
72def random_seed(seed=0):
73 torch.manual_seed(seed)

Callers 1

mainFunction · 0.70

Calls 1

load_state_dictMethod · 0.80

Tested by

no test coverage detected