[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
parent
438c9da6eb
commit
d62f198d2b
|
@ -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())
|
||||
|
||||
|
|
Loading…
Reference in New Issue