MCPcopy Create free account
hub / github.com/OpenBitSys/BitDistiller / _model_call

Method _model_call

test/general/lm_eval/models/gpt2.py:160–169  ·  view source on GitHub ↗

inps: a torch tensor of shape [batch, sequence] the size of sequence may vary from call to call returns: a torch tensor of shape [batch, sequence, vocab] with the logits returned from the model

(self, inps)

Source from the content-addressed store, hash-verified

158 return self.tokenizer.decode(tokens)
159
160 def _model_call(self, inps):
161 """
162 inps: a torch tensor of shape [batch, sequence]
163 the size of sequence may vary from call to call
164
165 returns: a torch tensor of shape [batch, sequence, vocab] with the
166 logits returned from the model
167 """
168 with torch.no_grad():
169 return self.model(inps)[0]
170
171 def _model_generate(self, context, max_length, eos_token_id):
172 generation_kwargs = {"do_sample": False, "max_length": max_length}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected