MCPcopy Create free account
hub / github.com/TeleHuman/PBHC / load_pkl

Function load_pkl

motion_source/motion_package.py:11–24  ·  view source on GitHub ↗
(pkl_path)

Source from the content-addressed store, hash-verified

9
10
11def load_pkl(pkl_path):
12 try:
13 with open(pkl_path, "rb") as f:
14 return pickle.load(f)
15 except Exception as e1:
16 try:
17 print(f"Pickle failed, trying joblib for {pkl_path}")
18 return joblib.load(pkl_path)
19 except Exception as e2:
20 try:
21 print(f"Joblib failed, trying torch.load for {pkl_path}")
22 return torch.load(pkl_path, map_location="cpu")
23 except Exception as e3:
24 raise RuntimeError(f"Failed to load {pkl_path} as pickle, joblib, or torch.\nErrors:\n- pickle: {e1}\n- joblib: {e2}\n- torch: {e3}")
25
26
27def merge_motion_files(pkl_paths, failed_list_path=None, min_len=None, max_len=None):

Callers 1

merge_motion_filesFunction · 0.85

Calls 1

loadMethod · 0.45

Tested by

no test coverage detected