MCPcopy Create free account
hub / github.com/OpenSparseLLMs/Linear-MoE / __init__

Method __init__

linear_moe/lm_evaluate.py:42–61  ·  view source on GitHub ↗
(
        self,
        pretrained: Optional[Union[str, transformers.PreTrainedModel]] = "gpt2",
        max_length: Optional[int] = None,
        batch_size: Optional[Union[int, str]] = 1,
        trust_remote_code: Optional[bool] = False,
        **kwargs,
    )

Source from the content-addressed store, hash-verified

40class EvalHarnessAdaptor(HFLM):
41
42 def __init__(
43 self,
44 pretrained: Optional[Union[str, transformers.PreTrainedModel]] = "gpt2",
45 max_length: Optional[int] = None,
46 batch_size: Optional[Union[int, str]] = 1,
47 trust_remote_code: Optional[bool] = False,
48 **kwargs,
49 ) -> None:
50 self.args = get_args()
51 build_tokenizer(self.args)
52 self.tokenizer = get_tokenizer()
53 self.is_main = torch.distributed.get_rank() == 0
54 self.adaptive_seq_len = self.args.adaptive_seq_len
55 self.model_provider = kwargs['model_provider']
56
57 super().__init__(pretrained=pretrained,
58 batch_size=batch_size,
59 trust_remote_code=trust_remote_code,
60 max_length=max_length,
61 tokenizer=self.tokenizer)
62
63 def _create_model(
64 self,

Callers

nothing calls this directly

Calls 3

get_argsFunction · 0.90
build_tokenizerFunction · 0.90
get_tokenizerFunction · 0.90

Tested by

no test coverage detected