Find the motion .pt file in a folder, prioritizing motion-conditioned results.
(folder_path: Path)
| 90 | |
| 91 | |
| 92 | def find_motion_file(folder_path: Path) -> Path: |
| 93 | """Find the motion .pt file in a folder, prioritizing motion-conditioned results.""" |
| 94 | motion_files = [ |
| 95 | 'motion_gen_condition_on_motion.pt', |
| 96 | 'motion_gen_condition_on_text.pt', |
| 97 | ] |
| 98 | |
| 99 | for motion_file in motion_files: |
| 100 | file_path = folder_path / motion_file |
| 101 | if file_path.exists(): |
| 102 | return file_path |
| 103 | |
| 104 | # Fallback: find any .pt file |
| 105 | pt_files = list(folder_path.glob('*.pt')) |
| 106 | if pt_files: |
| 107 | return pt_files[0] |
| 108 | |
| 109 | return None |
| 110 | |
| 111 | |
| 112 | def main(): |