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

Function load_pkl

dataset/motion_package.py:9–25  ·  view source on GitHub ↗
(pkl_path)

Source from the content-addressed store, hash-verified

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

Callers 1

merge_motion_filesFunction · 0.85

Calls 1

loadMethod · 0.80

Tested by

no test coverage detected