"lm_eval/__main__.py" did not exist on "4923a7ce7ccd5af07ced8fbe07a650b066dcf3ec"
wikitext.py 1.38 KB
Newer Older
Leo Gao's avatar
Leo Gao committed
1
2
# REMINDER: this code needs to be rewritten for the new framework. Remove this comment when the code is fully converted.

Anish Thite's avatar
Anish Thite committed
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import numpy as np
from scipy.stats import pearsonr, spearmanr
from sklearn.metrics import f1_score, matthews_corrcoef
from tqdm import auto as tqdm_lib
from . common import NLP_TASK, simple_accuracy_metric, yesno

class WikiText103(NLP_TASK):
    NLP_PATH = "wikitext"
    NLP_NAME = "wikitext-103-raw-v1"

    def fewshot_description(self):
        return ""

    def doc_to_text(self, doc, include_target=True):
        return doc['text']
18
19
20
21
22
23

    # TODO: Implement evaluation code

    # ***IMPORTANT***: this evaluation function needs to be written for the new framework. 
    # For more info, check out the interface in base.py and the example BoolQ implementation in superglue.py. 
    # Remove this comment when the evaluation code is implemented.
Anish Thite's avatar
Anish Thite committed
24
25
26
27
28
29
30
31
32
33
34


class WikiText2(NLP_TASK):
    NLP_PATH = "wikitext"
    NLP_NAME = "wikitext-2-raw-v1"

    def fewshot_description(self):
        return ""

    def doc_to_text(self, doc, include_target=True):
        return doc['text']
35
36
37
38
39
40

    # TODO: Implement evaluation code

    # ***IMPORTANT***: this evaluation function needs to be written for the new framework. 
    # For more info, check out the interface in base.py and the example BoolQ implementation in superglue.py. 
    # Remove this comment when the evaluation code is implemented.