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