MCPcopy Create free account
hub / github.com/pytorch/executorch / __init__

Method __init__

examples/models/llama/eval_llama_lib.py:41–56  ·  view source on GitHub ↗
(
        self,
        model: torch.fx.GraphModule,
        tokenizer: Union[SentencePieceTokenizer, Tiktoken],
        max_seq_length: Optional[int] = None,
        use_kv_cache: bool = False,
        generate_full_logits: bool = False,
        enable_dynamic_shape: bool = True,
    )

Source from the content-addressed store, hash-verified

39 """
40
41 def __init__(
42 self,
43 model: torch.fx.GraphModule,
44 tokenizer: Union[SentencePieceTokenizer, Tiktoken],
45 max_seq_length: Optional[int] = None,
46 use_kv_cache: bool = False,
47 generate_full_logits: bool = False,
48 enable_dynamic_shape: bool = True,
49 ):
50 super().__init__(
51 model=model, tokenizer=tokenizer, max_seq_length=max_seq_length
52 )
53 self._model = model.to(self.device)
54 self._use_kv_cache = use_kv_cache
55 self._generate_full_logits = generate_full_logits
56 self._enable_dynamic_shape = enable_dynamic_shape
57
58 def _model_call(self, inps):
59 if self._use_kv_cache:

Callers

nothing calls this directly

Calls 2

__init__Method · 0.45
toMethod · 0.45

Tested by

no test coverage detected