[Feature]Support custom hooks (#305)

* add mytrain.py for test

* test before layers

* test attr in layers

* test classifier

* delete mytrain.py

* register custom_hooks in runner

* set custom_hooks_config to cfg.get(custom_hooks, None)
pull/307/head
whcao 2021-06-15 21:09:58 +08:00 committed by GitHub
parent 438c9da6eb
commit d62f198d2b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 3 deletions

View File

@ -127,9 +127,13 @@ def train_model(model,
optimizer_config = cfg.optimizer_config
# register hooks
runner.register_training_hooks(cfg.lr_config, optimizer_config,
cfg.checkpoint_config, cfg.log_config,
cfg.get('momentum_config', None))
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', None))
if distributed:
runner.register_hook(DistSamplerSeedHook())