Called every step to update the progress bar UI.
(
self, step: int, loss: Optional[float] = None, lr: Optional[float] = None
)
| 64 | ) |
| 65 | |
| 66 | def update( |
| 67 | self, step: int, loss: Optional[float] = None, lr: Optional[float] = None |
| 68 | ): |
| 69 | """ |
| 70 | Called every step to update the progress bar UI. |
| 71 | """ |
| 72 | if self.progress_bar: |
| 73 | self.progress_bar.update(1) |
| 74 | |
| 75 | # Update real-time metrics on the progress bar itself |
| 76 | postfix = {} |
| 77 | if loss is not None: |
| 78 | postfix["loss"] = f"{loss:.4f}" |
| 79 | if lr is not None: |
| 80 | postfix["lr"] = f"{lr:.2e}" |
| 81 | |
| 82 | if postfix: |
| 83 | self.progress_bar.set_postfix(postfix) |
| 84 | |
| 85 | def log_metrics(self, step: int, metrics: Dict[str, Any]): |
| 86 | """ |
no outgoing calls
no test coverage detected