"vscode:/vscode.git/clone" did not exist on "bed386f7593f555da7797614aed4775d7a786705"
Unverified Commit e8e4873a authored by Stella Biderman's avatar Stella Biderman Committed by GitHub
Browse files

Merge pull request #239 from bigscience-workshop/thomas/fix_wnli

FIX wnli
parents df5d7cf0 a48e3cf2
...@@ -227,7 +227,7 @@ class QNLI(HFTask): ...@@ -227,7 +227,7 @@ class QNLI(HFTask):
class WNLI(HFTask): class WNLI(HFTask):
VERSION = 0 VERSION = 1
DATASET_PATH = "glue" DATASET_PATH = "glue"
DATASET_NAME = "wnli" DATASET_NAME = "wnli"
...@@ -241,26 +241,25 @@ class WNLI(HFTask): ...@@ -241,26 +241,25 @@ class WNLI(HFTask):
return False return False
def doc_to_text(self, doc): def doc_to_text(self, doc):
return "{}\nQuestion: {} True, False or Neither?\nAnswer:".format( return "{}\nQuestion: {} True or False?\nAnswer:".format(
doc["sentence1"], doc["sentence1"],
doc["sentence2"], doc["sentence2"],
) )
def doc_to_target(self, doc): def doc_to_target(self, doc):
# True = entailment # True = entailment
# False = contradiction # False = not_entailment
# Neither = neutral return " {}".format({0: "False", 1: "True"}[doc["label"]])
return " {}".format({0: "True", 1: "Neither", 2: "False"}[doc["label"]])
def construct_requests(self, doc, ctx): def construct_requests(self, doc, ctx):
ll_true, _ = rf.loglikelihood(ctx, " True") ll_true, _ = rf.loglikelihood(ctx, " True")
ll_neither, _ = rf.loglikelihood(ctx, " Neither")
ll_false, _ = rf.loglikelihood(ctx, " False") ll_false, _ = rf.loglikelihood(ctx, " False")
return ll_true, ll_neither, ll_false return ll_true, ll_false
def process_results(self, doc, results): def process_results(self, doc, results):
ll_true, ll_false = results
pred = ll_true > ll_false
gold = doc["label"] gold = doc["label"]
pred = np.argmax(results)
return { return {
"acc": pred == gold "acc": pred == 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