Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Fix] fix loss smooth when loss name doesn't start with loss #539

Merged
merged 2 commits into from
Oct 8, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions mmengine/runner/log_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ def get_log_after_iter(self, runner, batch_idx: int,
log_str = (f'Iter({mode}) '
f'[{cur_iter}/{runner.max_iters}] ')
else:
log_str = (f'Iter({mode}) [{batch_idx+1}'
log_str = (f'Iter({mode}) [{batch_idx + 1}'
f'/{len(current_loop.dataloader)}] ')
# Concatenate lr, momentum string with log header.
log_str += f'{lr_str} '
Expand Down Expand Up @@ -265,8 +265,7 @@ def _collect_scalars(self, custom_cfg: List[dict], runner,
mode_history_scalars[key] = log_buffer
for key in mode_history_scalars:
# Update the latest learning rate and smoothed time logs.
if key.startswith('loss') or key in ('time', 'data_time',
'grad_norm'):
if ('loss' in key) or key in ('time', 'data_time', 'grad_norm'):
liuyanyi marked this conversation as resolved.
Show resolved Hide resolved
tag[key] = mode_history_scalars[key].mean(self.window_size)
else:
# Default statistic method is current.
Expand Down