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] rename custom_hooks_config to custom_hooks #1427

Merged
merged 2 commits into from
Jun 15, 2022
Merged
Show file tree
Hide file tree
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
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
9 changes: 8 additions & 1 deletion mmpose/apis/train.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,14 +168,21 @@ 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.')

# 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