File size: 991 Bytes
cd0431b |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
import random
from tqdm import tqdm
from lm_eval.api.model import LM
from lm_eval.api.registry import register_model
@register_model("dummy")
class DummyLM(LM):
def __init__(self) -> None:
super().__init__()
@classmethod
def create_from_arg_string(cls, arg_string, additional_config=None):
return cls()
def loglikelihood(self, requests, disable_tqdm: bool = False):
res = []
for _ in tqdm(requests, disable=disable_tqdm):
res.append((-random.random(), False))
return res
def generate_until(self, requests, disable_tqdm: bool = False):
res = []
for ctx, _ in tqdm(requests, disable=disable_tqdm):
res.append("lol")
assert ctx.strip() != ""
return res
def loglikelihood_rolling(self, requests, disable_tqdm: bool = False):
res = []
for _ in tqdm(requests, disable=disable_tqdm):
res.append(-random.random())
return res
|