[Easy] Add str repr for IterationStats (#26232)

Signed-off-by: 22quinn <33176974+22quinn@users.noreply.github.com>
This commit is contained in:
22quinn
2025-10-05 05:00:21 +00:00
committed by GitHub
parent 59a85c366e
commit 78c1d5bfd2
2 changed files with 26 additions and 0 deletions
+5
View File
@@ -111,6 +111,11 @@ class IterationStats:
self.waiting_lora_adapters: dict[str, int] = {}
self.running_lora_adapters: dict[str, int] = {}
def __repr__(self) -> str:
field_to_value_str = ", ".join(f"{k}={v}"
for k, v in vars(self).items())
return f"{self.__class__.__name__}({field_to_value_str})"
def _time_since(self, start: float) -> float:
"""Calculate an interval relative to this iteration's timestamp."""
return self.iteration_timestamp - start