From eedc0938f9336fb574c0e9d3c8a5167dc0e56dcc Mon Sep 17 00:00:00 2001 From: reaperhammer <87021961+reaperhammer@users.noreply.github.com> Date: Sat, 9 May 2026 19:04:41 +1200 Subject: [PATCH] Fix bare exceptions, silent HTTP failures, and resolution display - Replace bare except: with except Exception: in __del__ and reset() to avoid catching KeyboardInterrupt/SystemExit - Add response.raise_for_status() to fail clearly on HTTP errors - Fix resolution log output to show HxW instead of CHW shape Co-Authored-By: Claude Opus 4.7 --- trt_utilities.py | 12 ++++++------ utilities.py | 1 + vfi_utilities.py | 5 ++++- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/trt_utilities.py b/trt_utilities.py index 4a12561..23a66fe 100644 --- a/trt_utilities.py +++ b/trt_utilities.py @@ -143,12 +143,12 @@ class Engine: if hasattr(self, 'cuda_graph_instance') and self.cuda_graph_instance is not None: try: cudart.cudaGraphDestroy(self.cuda_graph_instance) - except: + except Exception: pass if hasattr(self, 'graph') and self.graph is not None: try: cudart.cudaGraphDestroy(self.graph) - except: + except Exception: pass if hasattr(self, 'engine'): @@ -171,13 +171,13 @@ class Engine: if hasattr(self, 'cuda_graph_instance') and self.cuda_graph_instance is not None: try: cudart.cudaGraphDestroy(self.cuda_graph_instance) - except: + except Exception: pass self.cuda_graph_instance = None if hasattr(self, 'graph') and self.graph is not None: try: cudart.cudaGraphDestroy(self.graph) - except: + except Exception: pass self.graph = None @@ -283,13 +283,13 @@ class Engine: if hasattr(self, 'cuda_graph_instance') and self.cuda_graph_instance is not None: try: cudart.cudaGraphDestroy(self.cuda_graph_instance) - except: + except Exception: pass self.cuda_graph_instance = None if hasattr(self, 'graph') and self.graph is not None: try: cudart.cudaGraphDestroy(self.graph) - except: + except Exception: pass self.graph = None diff --git a/utilities.py b/utilities.py index 0362ed6..f95e841 100644 --- a/utilities.py +++ b/utilities.py @@ -85,6 +85,7 @@ def download_file(url, save_path): GREEN = '\033[92m' RESET = '\033[0m' response = requests.get(url, stream=True) + response.raise_for_status() total_size = int(response.headers.get('content-length', 0)) with open(save_path, 'wb') as file, tqdm( diff --git a/vfi_utilities.py b/vfi_utilities.py index 34637ea..4cd3d33 100644 --- a/vfi_utilities.py +++ b/vfi_utilities.py @@ -74,7 +74,10 @@ def generate_frames_rife( # Append final frame output_frames[out_len] = frames[-1:] - logger(f"done! - {out_len} total frames output at resolution: {output_frames[0].shape}") + # Get actual frame shape from first interpolated frame (CHW format) + actual_frame = output_frames[0] + h, w = actual_frame.shape[1], actual_frame.shape[2] + logger(f"done! - {out_len} total frames output at resolution: {h}x{w}") out_len += 1 # clear cache for courtesy