Skip to content

Commit

Permalink
[Fix] rename custom_hooks_config to custom_hooks (#1427)
Browse files Browse the repository at this point in the history
* rename custom_hooks_config to custom_hooks
  • Loading branch information
ly015 authored Jun 15, 2022
1 parent 07cd4b2 commit 8890aa3
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
total_epochs = 75
log_config = dict(interval=10)

custom_hooks_config = [dict(type='ModelSetEpochHook')]
custom_hooks = [dict(type='ModelSetEpochHook')]

model = dict(
type='GestureRecognizer',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
total_epochs = 130
log_config = dict(interval=10)

custom_hooks_config = [dict(type='ModelSetEpochHook')]
custom_hooks = [dict(type='ModelSetEpochHook')]

model = dict(
type='GestureRecognizer',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
total_epochs = 130
log_config = dict(interval=10)

custom_hooks_config = [dict(type='ModelSetEpochHook')]
custom_hooks = [dict(type='ModelSetEpochHook')]

model = dict(
type='GestureRecognizer',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
total_epochs = 75
log_config = dict(interval=10)

custom_hooks_config = [dict(type='ModelSetEpochHook')]
custom_hooks = [dict(type='ModelSetEpochHook')]

model = dict(
type='GestureRecognizer',
Expand Down
10 changes: 9 additions & 1 deletion mmpose/apis/train.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,14 +168,22 @@ def train_model(model,
else:
optimizer_config = cfg.optimizer_config

custom_hooks_cfg = cfg.get('custom_hooks', None)
if custom_hooks_cfg is None:
custom_hooks_cfg = cfg.get('custom_hooks_config', None)
if custom_hooks_cfg is not None:
warnings.warn(
'"custom_hooks_config" is deprecated, please use '
'"custom_hooks" instead.', DeprecationWarning)

# register hooks
runner.register_training_hooks(
cfg.lr_config,
optimizer_config,
cfg.checkpoint_config,
cfg.log_config,
cfg.get('momentum_config', None),
custom_hooks_config=cfg.get('custom_hooks_config', None))
custom_hooks_config=custom_hooks_cfg)

if distributed:
runner.register_hook(DistSamplerSeedHook())
Expand Down

0 comments on commit 8890aa3

Please sign in to comment.