From 817c49e225838af4fec495b2447d74fbb8e2805a Mon Sep 17 00:00:00 2001 From: Mr-Neutr0n <64578610+Mr-Neutr0n@users.noreply.github.com> Date: Sun, 15 Feb 2026 20:55:58 +0530 Subject: [PATCH] fix tqdm progress bar using refresh() instead of update() The _update_n helper was directly setting bar.n and calling bar.refresh(), which bypasses tqdm's update() logic. This meant EMA-based rate estimation and dynamic miniters were never updated, breaking things like custom smoothing values. Switched to bar.update(value - bar.n) so that tqdm's internal bookkeeping runs properly. Fixes #21320 --- src/lightning/pytorch/callbacks/progress/tqdm_progress.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/lightning/pytorch/callbacks/progress/tqdm_progress.py b/src/lightning/pytorch/callbacks/progress/tqdm_progress.py index 74abb8ecd850c..2030c207a0489 100644 --- a/src/lightning/pytorch/callbacks/progress/tqdm_progress.py +++ b/src/lightning/pytorch/callbacks/progress/tqdm_progress.py @@ -463,5 +463,4 @@ def convert_inf(x: Optional[Union[int, float]]) -> Optional[Union[int, float]]: def _update_n(bar: _tqdm, value: int) -> None: if not bar.disable: - bar.n = value - bar.refresh() + bar.update(value - bar.n)