From fe64a6829c5a799e5bbf7930327b08c583ce67b8 Mon Sep 17 00:00:00 2001 From: Alex Kogan Date: Fri, 9 Apr 2021 18:24:15 -0400 Subject: [PATCH 1/2] improve robustness of the simple runscript Skip task phases (e.g., "test") not specified in the config of a task (e.g., "squad_v1") --- jiant/proj/simple/runscript.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/jiant/proj/simple/runscript.py b/jiant/proj/simple/runscript.py index b8bdae151..0aaa4eb6e 100644 --- a/jiant/proj/simple/runscript.py +++ b/jiant/proj/simple/runscript.py @@ -13,6 +13,7 @@ import jiant.utils.zconf as zconf import jiant.utils.python.io as py_io from jiant.utils.python.logic import replace_none +from jiant.utils.python.io import read_json @zconf.run_config @@ -140,11 +141,16 @@ def run_simple(args: RunConfiguration, with_continue: bool = False): } for task_name in full_task_name_list: phases_to_do = [] + config = None for phase, phase_task_list in phase_task_dict.items(): if task_name in phase_task_list and not os.path.exists( os.path.join(args.exp_dir, "cache", hf_config.model_type, task_name, phase) ): - phases_to_do.append(phase) + config = config or read_json(task_config_path_dict[task_name]) + if phase in config["paths"]: + phases_to_do.append(phase) + else: + phase_task_list.remove(task_name) if not phases_to_do: continue print(f"Tokenizing Task '{task_name}' for phases '{','.join(phases_to_do)}'") From bd488a8f226b98e70757cbc2060d466fb97981d7 Mon Sep 17 00:00:00 2001 From: jeswan <57466294+jeswan@users.noreply.github.com> Date: Tue, 13 Apr 2021 21:49:40 -0400 Subject: [PATCH 2/2] Slight syntax change for simple runscript phases fix --- jiant/proj/simple/runscript.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/jiant/proj/simple/runscript.py b/jiant/proj/simple/runscript.py index 0aaa4eb6e..e7bace5fd 100644 --- a/jiant/proj/simple/runscript.py +++ b/jiant/proj/simple/runscript.py @@ -141,12 +141,11 @@ def run_simple(args: RunConfiguration, with_continue: bool = False): } for task_name in full_task_name_list: phases_to_do = [] - config = None for phase, phase_task_list in phase_task_dict.items(): if task_name in phase_task_list and not os.path.exists( os.path.join(args.exp_dir, "cache", hf_config.model_type, task_name, phase) ): - config = config or read_json(task_config_path_dict[task_name]) + config = read_json(task_config_path_dict[task_name]) if phase in config["paths"]: phases_to_do.append(phase) else: