Skip to content

Commit

Permalink
fixes to input inversion tagging
Browse files Browse the repository at this point in the history
  • Loading branch information
Shayne13 committed Mar 10, 2023
1 parent a49c8a0 commit 1bcace3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
1 change: 0 additions & 1 deletion flan/v2/few_shot.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@ def add_delimiter_after_x(ex):
eval_preprocessors=single_ex_preprocessors,
train_split='train',
train_feature_keys=('inputs', 'targets', '_template_idx'),
# '_template_type', '_task_source', '_task_name'),
)
# These are the preprocessors we run *after* we have formed few-shot examples.
# Note that we re-introduce the tokenization steps here.
Expand Down
15 changes: 8 additions & 7 deletions flan/v2/task_configs.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

import functools
import os
import copy

from flan.v2 import constants
from flan.v2 import constants_niv2
Expand Down Expand Up @@ -97,7 +98,7 @@ def _process_lambada(example):
)
# '_input_inversion' will get mapped to an inverted template
cot_ii_tname = f"{cot_type}_input_inversion_{dataset_name}"
COT_II_TASK_CONFIGS[cot_ii_tname] = COT_TASK_CONFIGS[f"{cot_type}_{dataset_name}"]
COT_II_TASK_CONFIGS[cot_ii_tname] = copy.deepcopy(COT_TASK_CONFIGS[f"{cot_type}_{dataset_name}"])
cot_ii_prep_fn = functools.partial(prep.add_source_info,
task_name=f"{cot_type}_{dataset_name}_ii", task_source="CoT")
COT_II_TASK_CONFIGS[cot_ii_tname].preprocessors = COT_II_TASK_CONFIGS[cot_ii_tname].preprocessors[:-1] + [cot_ii_prep_fn]
Expand Down Expand Up @@ -133,10 +134,10 @@ def _process_lambada(example):
)
# '_input_inversion' will get mapped to an inverted template
wd_ii_tname = "wiki_dialog_input_inversion"
DIALOG_II_TASK_CONFIGS[wd_ii_tname] = DIALOG_TASK_CONFIGS["wiki_dialog"]
wikidialog_prep_fn = functools.partial(prep.add_source_info,
DIALOG_II_TASK_CONFIGS[wd_ii_tname] = copy.deepcopy(DIALOG_TASK_CONFIGS["wiki_dialog"])
wikidialog_ii_prep_fn = functools.partial(prep.add_source_info,
task_name=f"wiki_dialog_ii", task_source="Dialog")
DIALOG_II_TASK_CONFIGS[wd_ii_tname].preprocessors = DIALOG_II_TASK_CONFIGS[wd_ii_tname].preprocessors[:-1] + [wikidialog_prep_fn]
DIALOG_II_TASK_CONFIGS[wd_ii_tname].preprocessors = DIALOG_II_TASK_CONFIGS[wd_ii_tname].preprocessors[:-1] + [wikidialog_ii_prep_fn]


# ================================== QReCC ====================================
Expand All @@ -150,10 +151,10 @@ def _process_lambada(example):
)
# '_input_inversion' will get mapped to an inverted template
qrecc_ii_tname = "qrecc_input_inversion"
DIALOG_II_TASK_CONFIGS[qrecc_ii_tname] = DIALOG_TASK_CONFIGS["qrecc"]
wikidialog_prep_fn = functools.partial(prep.add_source_info,
DIALOG_II_TASK_CONFIGS[qrecc_ii_tname] = copy.deepcopy(DIALOG_TASK_CONFIGS["qrecc"])
qrecc_ii_prep_fn = functools.partial(prep.add_source_info,
task_name=f"qrecc_ii", task_source="Dialog")
DIALOG_II_TASK_CONFIGS[qrecc_ii_tname].preprocessors = DIALOG_II_TASK_CONFIGS[qrecc_ii_tname].preprocessors[:-1] + [qrecc_prep_fn]
DIALOG_II_TASK_CONFIGS[qrecc_ii_tname].preprocessors = DIALOG_II_TASK_CONFIGS[qrecc_ii_tname].preprocessors[:-1] + [qrecc_ii_prep_fn]

# ========================= T0 (P3) Training Sets ===========================
for task_name in constants_t0.T0_TRAIN_TASK_SPLITS:
Expand Down

0 comments on commit 1bcace3

Please sign in to comment.