MCPcopy Create free account
hub / github.com/OpenSparseLLMs/MoM / __init__

Method __init__

evals/ppl.py:17–32  ·  view source on GitHub ↗
(
        self,
        model: PreTrainedModel,
        tokenizer: PreTrainedTokenizer,
        device: str = "cuda",
        block_size: int = 32768,
        bucket_size: int = 2048,
        batch_size: int = 1
    )

Source from the content-addressed store, hash-verified

15
16class PerplexityEvaluator:
17 def __init__(
18 self,
19 model: PreTrainedModel,
20 tokenizer: PreTrainedTokenizer,
21 device: str = "cuda",
22 block_size: int = 32768,
23 bucket_size: int = 2048,
24 batch_size: int = 1
25 ):
26 self.model = model
27 self.tokenizer = tokenizer
28 self.device = device
29 self.block_size = block_size
30 self.bucket_size = bucket_size
31 self.batch_size = batch_size
32 self.loss_fct = FusedCrossEntropyLoss(reduction='sum')
33
34
35 @staticmethod

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected