From facbc1a824108825696d69a8fa689aade5e7ea12 Mon Sep 17 00:00:00 2001 From: lihaoyun6 Date: Tue, 19 Aug 2025 00:58:02 +0800 Subject: [PATCH] Fix FPS calculation --- src/interfaces/comfyui_node.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/interfaces/comfyui_node.py b/src/interfaces/comfyui_node.py index b8913a9..83d548e 100644 --- a/src/interfaces/comfyui_node.py +++ b/src/interfaces/comfyui_node.py @@ -375,8 +375,13 @@ class SeedVR2: """Progress callback for generation loop""" # Calculate batch FPS - _last_time = self.last_batch_time if self.last_batch_time is not None else self.debug.timers["generation_loop"] - batch_time = time.time() - _last_time + batch_time = 0 + if self.last_batch_time is not None: + batch_time = time.time() - self.last_batch_time + elif "generation_loop" in self.debug.timers: + batch_time = time.time() - self.debug.timers["generation_loop"] + else: + batch_time = self.debug.timer_durations.get("generation_loop", 0) batch_fps = current_batch_frames / batch_time if batch_time > 0 else 0.0 self.debug.log(f"Batch {batch_idx} - FPS: {batch_fps:.2f} frames/sec", category="timing") self.last_batch_time = time.time()