"examples/vscode:/vscode.git/clone" did not exist on "97f3beed3616d50c722fc9227205f8330048ca6c"
Unverified Commit 29c94808 authored by Chi's avatar Chi Committed by GitHub
Browse files

Successfully Resolved The ZeroDivisionError Exception. (#27524)

* Successfully resolved the ZeroDivisionError exception in the utils.notebook.y file.

* Now I update little code mentioned by Peter

* Using Black package to reformat my file

* Now I using ruff libary to reformated my file
parent c13a43aa
......@@ -161,7 +161,7 @@ class NotebookProgressBar:
self.update_bar(value)
self.last_value = value
self.last_time = current_time
if self.average_time_per_item is None:
if (self.average_time_per_item is None) or (self.average_time_per_item == 0):
self.wait_for = 1
else:
self.wait_for = max(int(self.update_every / self.average_time_per_item), 1)
......@@ -177,7 +177,11 @@ class NotebookProgressBar:
f"[{spaced_value}/{self.total} {format_time(self.elapsed_time)} <"
f" {format_time(self.predicted_remaining)}"
)
if self.average_time_per_item == 0:
self.label += ", +inf it/s"
else:
self.label += f", {1/self.average_time_per_item:.2f} it/s"
self.label += "]" if self.comment is None or len(self.comment) == 0 else f", {self.comment}]"
self.display()
......@@ -367,6 +371,8 @@ class NotebookProgressCallback(TrainerCallback):
def on_train_end(self, args, state, control, **kwargs):
self.training_tracker.update(
state.global_step, comment=f"Epoch {int(state.epoch)}/{state.num_train_epochs}", force_update=True
state.global_step,
comment=f"Epoch {int(state.epoch)}/{state.num_train_epochs}",
force_update=True,
)
self.training_tracker = None
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment