Skip to content

Commit 9d3853b

Browse files
committed
Less invasive logging on training
1 parent 38c4b93 commit 9d3853b

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

tianshou/highlevel/experiment.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -501,6 +501,7 @@ def run(
501501
launcher = RegisteredExpLauncher[launcher.upper()]
502502
if isinstance(launcher, RegisteredExpLauncher):
503503
launcher = launcher.create_launcher()
504+
log.info(f"Running {len(self.experiments)} experiments using launcher {launcher}")
504505
return launcher.launch(experiments=self.experiments)
505506

506507

tianshou/trainer/trainer.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1070,11 +1070,13 @@ def _update_step(
10701070
)
10711071

10721072
update_stat = None
1073+
disable_pbar = n_gradient_steps < 20 # only show progress bar if there are many steps
10731074
for _ in self._pbar(
10741075
range(n_gradient_steps),
10751076
desc="Offpolicy gradient update",
10761077
position=0,
10771078
leave=False,
1079+
disable=disable_pbar
10781080
):
10791081
update_stat = self._sample_and_update(self.params.training_collector.buffer)
10801082
self._policy_update_time += update_stat.train_time
@@ -1107,7 +1109,7 @@ def _update_step(
11071109
) -> TrainingStats:
11081110
"""Perform one on-policy update by passing the entire buffer to the algorithm's update method."""
11091111
assert self.params.training_collector is not None
1110-
log.info(
1112+
log.debug(
11111113
f"Performing on-policy update on buffer of length {len(self.params.training_collector.buffer)}",
11121114
)
11131115
training_stat = self.algorithm.update(

0 commit comments

Comments
 (0)