[Fix] Fix ProfilerHook when using IterBasedRunner (#1755)

pull/1776/head
Tan SU 2022-03-06 20:13:32 +08:00 committed by GitHub
parent 466a6c829c
commit d69d985abd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -142,7 +142,7 @@ class ProfilerHook(Hook):
raise ValueError('on_trace_ready should be handler, dict or None, '
f'but got {type(self.on_trace_ready)}')
if runner.max_epochs > 1:
if self.by_epoch and runner.max_epochs > 1:
warnings.warn(f'profiler will profile {runner.max_epochs} epochs '
'instead of 1 epoch. Since profiler will slow down '
'the training, it is recommended to train 1 epoch '