"configs/datasets/MMLUArabic/README.md" did not exist on "862044fb7db7371ace8b068f493da1dcc55562f6"
dummy.py 800 Bytes
Newer Older
1
import random
2

3
4
from lm_eval.api.model import LM
from lm_eval.api.registry import register_model
Jason Phang's avatar
checkin  
Jason Phang committed
5
6


7
@register_model("dummy")
Jason Phang's avatar
checkin  
Jason Phang committed
8
class DummyLM(LM):
Ethan Smith's avatar
Ethan Smith committed
9
    def __init__(self) -> None:
baberabb's avatar
baberabb committed
10
        super().__init__()
11
12

    @classmethod
13
    def create_from_arg_string(cls, arg_string, additional_config=None):
14
15
16
17
        return cls()

    def loglikelihood(self, requests):
        res = []
18

19
20
        for _ in requests:
            res.append((-random.random(), False))
Jason Phang's avatar
checkin  
Jason Phang committed
21

22
        return res
23

24
    def generate_until(self, requests):
Leo Gao's avatar
Leo Gao committed
25
        res = []
26

Leo Gao's avatar
Leo Gao committed
27
        for ctx, _ in requests:
Leo Gao's avatar
Leo Gao committed
28
            res.append("lol")
29
            assert ctx.strip() != ""
Leo Gao's avatar
Leo Gao committed
30
31

        return res
Leo Gao's avatar
Leo Gao committed
32

Leo Gao's avatar
Leo Gao committed
33
    def loglikelihood_rolling(self, requests):
Leo Gao's avatar
Leo Gao committed
34
        res = []
35

Leo Gao's avatar
Leo Gao committed
36
37
38
        for _ in requests:
            res.append(-random.random())

39
        return res