[Enhancement] Support custom runner (#1923)

* support custom runner

* fix
This commit is contained in:
谢昕辰 2022-08-17 13:46:57 +08:00 committed by MeowZheng
parent 45b63c584f
commit 13b108dbc8

View File

@ -6,6 +6,7 @@ import os.path as osp
from mmengine.config import Config, DictAction
from mmengine.logging import print_log
from mmengine.registry import RUNNERS
from mmengine.runner import Runner
from mmseg.utils import register_all_modules
@ -97,7 +98,13 @@ def main():
cfg.load_from = args.resume
# build the runner from config
runner = Runner.from_cfg(cfg)
if 'runner_type' not in cfg:
# build the default runner
runner = Runner.from_cfg(cfg)
else:
# build customized runner from the registry
# if 'runner_type' is set in the cfg
runner = RUNNERS.build(cfg)
# start training
runner.train()