@@ -45,12 +45,14 @@ def run_pytorch_test(video_file: str, display: bool = False):
4545 super_animal = TORCH_CONFIG ["super_animal" ],
4646 model_name = TORCH_MODEL ,
4747 )
48- assert TORCH_CONFIG ["checkpoint" ].exists (), (
49- f"Failed to export { TORCH_CONFIG ['super_animal' ]} model"
50- )
51- assert TORCH_CONFIG ["checkpoint" ].stat ().st_size > 0 , (
48+ if not TORCH_CONFIG ["checkpoint" ].exists ():
49+ raise FileNotFoundError (
50+ f"Failed to export { TORCH_CONFIG ['super_animal' ]} model"
51+ )
52+ if TORCH_CONFIG ["checkpoint" ].stat ().st_size == 0 :
53+ raise ValueError (
5254 f"Exported { TORCH_CONFIG ['super_animal' ]} model is empty"
53- )
55+ )
5456 benchmark_videos (
5557 model_path = str (TORCH_CONFIG ["checkpoint" ]),
5658 model_type = "pytorch" ,
@@ -139,7 +141,8 @@ def main():
139141 print (f"Video file already exists at { video_file } , skipping download." )
140142
141143 # assert these things exist so we can give informative error messages
142- assert Path (video_file ).exists (), f"Missing video file { video_file } "
144+ if not Path (video_file ).exists ():
145+ raise FileNotFoundError (f"Missing video file { video_file } " )
143146 backend_failures = {}
144147 any_backend_succeeded = False
145148
@@ -197,7 +200,7 @@ def main():
197200 shutil .rmtree (tmp_dir )
198201 except PermissionError :
199202 warnings .warn (
200- f"Could not delete temporary directory { str (tmp_dir )} due to a permissions error, but otherwise dlc-live seems to be working fine! "
203+ f"Could not delete temporary directory { str (tmp_dir )} due to a permissions error. "
201204 )
202205
203206
0 commit comments