Skip to content

Commit

Permalink
[XS] Updating console progress_bar logger to use max_duration units (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
Moin Nadeem authored and Bandish Shah committed Jul 1, 2022
1 parent ef9d1d2 commit 80d3293
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion composer/loggers/progress_bar_logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,23 @@ def log_data(self, state: State, log_level: LogLevel, data: Dict[str, Any]) -> N
# log to console
if self.should_log(state, log_level):
data_str = format_log_data_value(data)
log_str = f'[{log_level.name}][batch={int(state.timestamp.batch)}]: {data_str}'
if state.max_duration is None:
training_progress = ''
elif state.max_duration.unit == TimeUnit.EPOCH:
if state.dataloader_len is None:
curr_progress = f'[batch={int(state.timestamp.batch_in_epoch)}]'
else:
total = int(state.dataloader_len)
curr_progress = f'[batch={int(state.timestamp.batch_in_epoch)}/{total}]'

training_progress = f'[epoch={int(state.timestamp.epoch)}]{curr_progress}'
else:
unit = state.max_duration.unit
curr_duration = int(state.timestamp.get(unit))
total = state.max_duration.value
training_progress = f'[{unit.name.lower()}={curr_duration}/{total}]'

log_str = f'[{log_level.name}]{training_progress}: {data_str}'
self.log_to_console(log_str)

def log_to_console(self, log_str: str):
Expand Down

0 comments on commit 80d3293

Please sign in to comment.