(pkl_path)
| 9 | |
| 10 | |
| 11 | def 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 | |
| 27 | def merge_motion_files(pkl_paths, failed_list_path=None, min_len=None, max_len=None): |
no test coverage detected