Commit 42401fa2 authored by lintangsutawika's avatar lintangsutawika
Browse files

revert parts back to main

parent eb9f6788
......@@ -256,7 +256,7 @@ def mcc_fn(items): # This is a passthrough function
@register_metric(
metric="f1",
higher_is_better=True,
output_type=["multiple_choice"],
output_type="multiple_choice",
aggregation="f1",
)
def f1_fn(items): # This is a passthrough function
......
......@@ -1190,6 +1190,7 @@ class ConfigurableTask(Task):
eval_logger.warning("Applied prompt returns empty string")
return self.config.fewshot_delimiter
else:
print(type(doc_to_text))
raise TypeError
def doc_to_target(self, doc: Mapping) -> Union[int, str, list]:
......@@ -1279,6 +1280,7 @@ class ConfigurableTask(Task):
else:
# Otherwise they are placed in the continuation
arguments = [(ctx, f"{target_delimiter}{cont}") for cont in choices]
request_list = [
Instance(
request_type="loglikelihood",
......@@ -1432,6 +1434,7 @@ class ConfigurableTask(Task):
]
acc_mutual_info = 1.0 if np.argmax(lls_mutual_info) == gold else 0.0
result_dict["acc_mutual_info"] = acc_mutual_info
elif self.OUTPUT_TYPE == "generate_until":
gold = self.doc_to_target(doc)
result = results[0]
......@@ -1455,6 +1458,7 @@ class ConfigurableTask(Task):
scores = []
if not isinstance(gold, list):
# sometimes, a multiple_target dataset has exceptions where one doc has only one string answer
# print(gold)
gold = [gold]
if metric == "exact_match":
result = [result for _ in range(len(gold))]
......
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