MCPcopy Create free account
hub / github.com/M-Nauta/ProtoTree / load_state

Function load_state

util/init.py:7–12  ·  view source on GitHub ↗
(directory_path: str, device)

Source from the content-addressed store, hash-verified

5import pickle
6
7def load_state(directory_path: str, device):
8 with open(directory_path + '/tree.pkl', 'rb') as f:
9 tree = pickle.load(f)
10 state = torch.load(directory_path + '/model_state.pth', map_location=device)
11 tree.load_state_dict(state)
12 return tree
13
14def init_tree(tree: ProtoTree, optimizer, scheduler, device, args: argparse.Namespace):
15 epoch = 1

Callers

nothing calls this directly

Calls 1

loadMethod · 0.80

Tested by

no test coverage detected