Skip to content

Commit 192d6b5

Browse files
author
Harsh Trivedi
authored
Namespace default cache dir by model_type. (#1246)
The default cache directory should be namespaced by model-type so that when 2 different models are sequentially run on the same task, the latter doesn't use cached inputs from previous model.
1 parent 3bd801c commit 192d6b5

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

jiant/proj/simple/runscript.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ def run_simple(args: RunConfiguration, with_continue: bool = False):
139139
phases_to_do = []
140140
for phase, phase_task_list in phase_task_dict.items():
141141
if task_name in phase_task_list and not os.path.exists(
142-
os.path.join(args.exp_dir, "cache", task_name, phase)
142+
os.path.join(args.exp_dir, "cache", args.model_type, task_name, phase)
143143
):
144144
phases_to_do.append(phase)
145145
if not phases_to_do:
@@ -152,7 +152,7 @@ def run_simple(args: RunConfiguration, with_continue: bool = False):
152152
model_tokenizer_path=os.path.join(
153153
model_cache_path, args.model_type, "tokenizer"
154154
),
155-
output_dir=os.path.join(args.exp_dir, "cache", task_name),
155+
output_dir=os.path.join(args.exp_dir, "cache", args.model_type, task_name),
156156
phases=phases_to_do,
157157
# TODO: Need a strategy for task-specific max_seq_length issues (issue #1176)
158158
max_seq_length=args.max_seq_length,
@@ -166,7 +166,7 @@ def run_simple(args: RunConfiguration, with_continue: bool = False):
166166
# number of moving parts.
167167
jiant_task_container_config = configurator.SimpleAPIMultiTaskConfigurator(
168168
task_config_base_path=os.path.join(args.data_dir, "configs"),
169-
task_cache_base_path=os.path.join(args.exp_dir, "cache"),
169+
task_cache_base_path=os.path.join(args.exp_dir, "cache", args.model_type),
170170
train_task_name_list=args.train_tasks,
171171
val_task_name_list=args.val_tasks,
172172
test_task_name_list=args.test_tasks,

0 commit comments

Comments
 (0)