Skip to content

Commit

Permalink
update metrics2str in tabular_logger.py
Browse files Browse the repository at this point in the history
  • Loading branch information
npurson authored Apr 26, 2023
1 parent 37f830a commit 2e041e1
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions tmpl/utils/tabular_logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ def log_metrics(self, metrics_dict: Dict[str, float], step: Optional[int] = None

def metrics2str(metrics: dict) -> str:
return ', '.join([
'{}: {{{}}}'.format(x, metrics2str(y)) if isinstance(y, dict) else
'{}: {:.5f}'.format(x, y) if isinstance(y, float) else '{}: {}'.format(x, y)
for x, y in metrics.items()
f'{x}: {{{metrics2str(y)}}}' if isinstance(y, dict) else
(f'{x}: {y:.4f}' if y >= 1e-4 else f'{x}: {y:.5f}')
if isinstance(y, float) else f'{x}: {y}' for x, y in metrics.items()
])

log_str = metrics2str(metrics)
Expand Down

0 comments on commit 2e041e1

Please sign in to comment.