Unverified Commit c7ba1f70 authored by Tong Gao's avatar Tong Gao Committed by GitHub
Browse files

add comments (#13)

parent cd1bec5f
...@@ -179,6 +179,9 @@ def main(): ...@@ -179,6 +179,9 @@ def main():
LarkReporter(cfg['lark_bot_url']).post(content) LarkReporter(cfg['lark_bot_url']).post(content)
if args.mode in ['all', 'infer']: if args.mode in ['all', 'infer']:
# When user have specified --slurm or --dlc, or have not set
# "infer" in config, we will provide a default configuration
# for infer
if (args.dlc or args.slurm) and cfg.get('infer', None): if (args.dlc or args.slurm) and cfg.get('infer', None):
logger.warning('You have set "infer" in the config, but ' logger.warning('You have set "infer" in the config, but '
'also specified --slurm or --dlc. ' 'also specified --slurm or --dlc. '
...@@ -193,6 +196,8 @@ def main(): ...@@ -193,6 +196,8 @@ def main():
tasks = partitioner(cfg) tasks = partitioner(cfg)
# execute the infer subtasks # execute the infer subtasks
exec_infer_runner(tasks, args, cfg) exec_infer_runner(tasks, args, cfg)
# If they have specified "infer" in config and haven't used --slurm
# or --dlc, just follow the config
else: else:
if args.partition is not None: if args.partition is not None:
if RUNNERS.get(cfg.infer.runner.type) == SlurmRunner: if RUNNERS.get(cfg.infer.runner.type) == SlurmRunner:
...@@ -214,6 +219,9 @@ def main(): ...@@ -214,6 +219,9 @@ def main():
# evaluate # evaluate
if args.mode in ['all', 'eval']: if args.mode in ['all', 'eval']:
# When user have specified --slurm or --dlc, or have not set
# "eval" in config, we will provide a default configuration
# for eval
if (args.dlc or args.slurm) and cfg.get('eval', None): if (args.dlc or args.slurm) and cfg.get('eval', None):
logger.warning('You have set "eval" in the config, but ' logger.warning('You have set "eval" in the config, but '
'also specified --slurm or --dlc. ' 'also specified --slurm or --dlc. '
...@@ -226,6 +234,8 @@ def main(): ...@@ -226,6 +234,8 @@ def main():
tasks = partitioner(cfg) tasks = partitioner(cfg)
# execute the eval tasks # execute the eval tasks
exec_eval_runner(tasks, args, cfg) exec_eval_runner(tasks, args, cfg)
# If they have specified "eval" in config and haven't used --slurm
# or --dlc, just follow the config
else: else:
if args.partition is not None: if args.partition is not None:
if RUNNERS.get(cfg.infer.runner.type) == SlurmRunner: if RUNNERS.get(cfg.infer.runner.type) == SlurmRunner:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment