Unverified Commit 4bab5137 authored by Jiwung Hyun's avatar Jiwung Hyun Committed by GitHub
Browse files

Modify prompt and add citation (#338)

parent 10c61137
......@@ -3,15 +3,15 @@ NSMC:
"""
import numpy as np
from lm_eval.base import rf, Task
from lm_eval.metrics import mean, matthews_corrcoef, f1_score, yesno
from lm_eval.metrics import mean
from lm_eval.utils import general_detokenize
_CITATION = """
@inproceedings{zellers2019hellaswag,
title={NSMC: Can a Machine Really Finish Your Sentence?},
author={Zellers, Rowan and Holtzman, Ari and Bisk, Yonatan and Farhadi, Ali and Choi, Yejin},
booktitle ={Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics},
year={2019}
@InProceedings{Park:2016,
title = "Naver Sentiment Movie Corpus",
author = "Lucy Park",
year = "2016",
howpublished = {\\url{https://github.com/e9t/nsmc}}
}
"""
......@@ -39,16 +39,14 @@ class NSMC(Task):
return self.dataset["test"]
def doc_to_text(self, doc):
return "다음 문장은 긍정일까요 부정일까요?\n{}\n정답:".format(
general_detokenize(doc["document"]),
)
return "{}".format(general_detokenize(doc["document"]))
def doc_to_target(self, doc):
return " {}".format({1: "긍정", 0: "부정"}[doc["label"]])
return " ({})".format({1: "긍정", 0: "부정"}[doc["label"]])
def construct_requests(self, doc, ctx):
ll_positive, _ = rf.loglikelihood(ctx, " 긍정")
ll_negative, _ = rf.loglikelihood(ctx, " 부정")
ll_positive, _ = rf.loglikelihood(ctx, " (긍정)")
ll_negative, _ = rf.loglikelihood(ctx, " (부정)")
return ll_positive, ll_negative
def process_results(self, doc, results):
......
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