Commit 6285b3ae authored by ingyuseong's avatar ingyuseong
Browse files

Modify KLUE-NLI prompt

parent 5a213c78
...@@ -163,7 +163,7 @@ class NLI(Task): ...@@ -163,7 +163,7 @@ class NLI(Task):
return self.dataset["validation"] return self.dataset["validation"]
def doc_to_text(self, doc): def doc_to_text(self, doc):
return "{}\n질문: {} 참, 거짓, 혹은 무관?\n정답:".format( return "{}\n질문: {} 참, 거짓, 중립 중 무엇인가요?\n정답:".format(
doc["premise"], doc["premise"],
doc["hypothesis"].strip() doc["hypothesis"].strip()
+ ("" if doc["hypothesis"].strip().endswith(".") else "."), + ("" if doc["hypothesis"].strip().endswith(".") else "."),
...@@ -173,11 +173,11 @@ class NLI(Task): ...@@ -173,11 +173,11 @@ class NLI(Task):
# 참 = entailment # 참 = entailment
# 거짓 = contradiction # 거짓 = contradiction
# 무관 = neutral # 무관 = neutral
return " {}".format({0: "참", 1: "무관", 2: "거짓"}[doc["label"]]) return " {}".format({0: "참", 1: "중립", 2: "거짓"}[doc["label"]])
def construct_requests(self, doc, ctx): def construct_requests(self, doc, ctx):
ll_true, _ = rf.loglikelihood(ctx, " 참") ll_true, _ = rf.loglikelihood(ctx, " 참")
ll_neither, _ = rf.loglikelihood(ctx, " 무관") ll_neither, _ = rf.loglikelihood(ctx, " 중립")
ll_false, _ = rf.loglikelihood(ctx, " 거짓") ll_false, _ = rf.loglikelihood(ctx, " 거짓")
return ll_true, ll_neither, ll_false return ll_true, ll_neither, ll_false
...@@ -190,4 +190,4 @@ class NLI(Task): ...@@ -190,4 +190,4 @@ class NLI(Task):
return {"acc": True} return {"acc": True}
def aggregation(self): def aggregation(self):
return {"acc": mean} return {"acc": mean}
\ No newline at end of file
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