Change ProgressCallback to use dynamic_ncols=True (#24101)

* Change ProgressCallback to use dynamic_ncols=True

* style: make style

* Revert "style: make style"

This reverts commit dee484904c.

* run make style only trainer_callback
This commit is contained in:
AinL 2023-06-12 21:56:48 +09:00 committed by GitHub
parent 93f73a3848
commit ba64ec07bb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -473,7 +473,7 @@ class ProgressCallback(TrainerCallback):
def on_train_begin(self, args, state, control, **kwargs):
if state.is_local_process_zero:
self.training_bar = tqdm(total=state.max_steps)
self.training_bar = tqdm(total=state.max_steps, dynamic_ncols=True)
self.current_step = 0
def on_step_end(self, args, state, control, **kwargs):
@ -484,7 +484,9 @@ class ProgressCallback(TrainerCallback):
def on_prediction_step(self, args, state, control, eval_dataloader=None, **kwargs):
if state.is_local_process_zero and has_length(eval_dataloader):
if self.prediction_bar is None:
self.prediction_bar = tqdm(total=len(eval_dataloader), leave=self.training_bar is None)
self.prediction_bar = tqdm(
total=len(eval_dataloader), leave=self.training_bar is None, dynamic_ncols=True
)
self.prediction_bar.update(1)
def on_evaluate(self, args, state, control, **kwargs):