pminervini commited on
Commit
efa0391
1 Parent(s): be7e092
src/backend/envs.py CHANGED
@@ -51,8 +51,9 @@ class Tasks(Enum):
51
  task17 = Task("truefalse_cieacf", "acc", "TrueFalse", 8)
52
 
53
  task18 = Task("faithdial_hallu", "acc", "FaithDial", 8)
 
54
 
55
- task19 = Task("race", "acc", "RACE", 0)
56
 
57
  # NUM_FEWSHOT = 64 # Change with your few shot
58
 
 
51
  task17 = Task("truefalse_cieacf", "acc", "TrueFalse", 8)
52
 
53
  task18 = Task("faithdial_hallu", "acc", "FaithDial", 8)
54
+ task19 = Task("faithdial_hallu_v2", "acc", "FaithDial", 8)
55
 
56
+ task20 = Task("race", "acc", "RACE", 0)
57
 
58
  # NUM_FEWSHOT = 64 # Change with your few shot
59
 
src/backend/tasks/faithdial/faithdial_v2.yaml ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ group: faithdial
2
+ task: faithdial_hallu_v2
3
+ dataset_path: McGill-NLP/FaithDial
4
+ training_split: train
5
+ validation_split: validation
6
+ test_split: test
7
+ output_type: multiple_choice
8
+ doc_to_text: !function utils.doc_to_text_v2
9
+ doc_to_target: !function utils.doc_to_target
10
+ doc_to_choice: ["false", "true"]
11
+ metric_list:
12
+ - metric: acc
13
+ higher_is_better: True
14
+ metadata:
15
+ version: 0.0
src/backend/tasks/faithdial/utils.py CHANGED
@@ -5,12 +5,15 @@ ValueType = Union[str, List[str]]
5
  def doc_to_text(doc: dict[str, ValueType]) -> str:
6
  history_str = " ".join([f'[{"Human" if i % 2 == 0 else "Assistant"}] {m}' for i, m in enumerate(doc['history'])])
7
  doc_text = f'#Knowledge#: {doc["knowledge"]}\n#Dialogue History#: {history_str}\n#Response#: {doc["response"]}\n#Hallucinated#:'
8
- # breakpoint()
 
 
 
 
 
9
  return doc_text
10
 
11
 
12
  def doc_to_target(doc: dict[str, ValueType]) -> str:
13
  res = "true" if "Hallucination" in doc["BEGIN"] else "false"
14
- # breakpoint()
15
  return res
16
-
 
5
  def doc_to_text(doc: dict[str, ValueType]) -> str:
6
  history_str = " ".join([f'[{"Human" if i % 2 == 0 else "Assistant"}] {m}' for i, m in enumerate(doc['history'])])
7
  doc_text = f'#Knowledge#: {doc["knowledge"]}\n#Dialogue History#: {history_str}\n#Response#: {doc["response"]}\n#Hallucinated#:'
8
+ return doc_text
9
+
10
+
11
+ def doc_to_text_v2(doc: dict[str, ValueType]) -> str:
12
+ history_str = " ".join([f'[{"Human" if i % 2 == 0 else "Assistant"}] {m}' for i, m in enumerate(doc['history'])])
13
+ doc_text = f'#Knowledge#: {doc["knowledge"]}\n#Dialogue History#: {history_str}\n#Response#: {doc["original_response"]}\n#Hallucinated#:'
14
  return doc_text
15
 
16
 
17
  def doc_to_target(doc: dict[str, ValueType]) -> str:
18
  res = "true" if "Hallucination" in doc["BEGIN"] else "false"
 
19
  return res