Skip to content

Commit

Permalink
modify ips (PaddlePaddle#432)
Browse files Browse the repository at this point in the history
  • Loading branch information
wangna11BD authored Sep 24, 2021
1 parent 392d231 commit 181d9f8
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions ppgan/engine/trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,9 +186,9 @@ def train(self):
self.model.setup_input(data)
self.model.train_iter(self.optimizers)

batch_cost_averager.record(time.time() - step_start_time,
num_samples=self.cfg.get(
'batch_size', 1))
batch_cost_averager.record(
time.time() - step_start_time,
num_samples=self.cfg['dataset']['train'].get('batch_size', 1))

step_start_time = time.time()

Expand Down Expand Up @@ -233,7 +233,8 @@ def test(self):
for i in range(self.max_eval_steps):
if self.max_eval_steps < self.log_interval or i % self.log_interval == 0:
self.logger.info('Test iter: [%d/%d]' %
(i * self.world_size, self.max_eval_steps * self.world_size))
(i * self.world_size,
self.max_eval_steps * self.world_size))

data = next(iter_loader)
self.model.setup_input(data)
Expand Down Expand Up @@ -268,7 +269,6 @@ def test(self):
step=self.batch_id,
is_save_image=True)


if self.metrics:
for metric_name, metric in self.metrics.items():
self.logger.info("Metric {}: {:.4f}".format(
Expand Down Expand Up @@ -441,4 +441,4 @@ def close(self):
when finish the training need close file handler or other.
"""
if self.enable_visualdl:
self.vdl_logger.close()
self.vdl_logger.close()

0 comments on commit 181d9f8

Please sign in to comment.