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

Method naive__call__

train/train.py:220–230  ·  view source on GitHub ↗
(self, instances: Sequence[Dict])

Source from the content-addressed store, hash-verified

218 tokenizer: transformers.PreTrainedTokenizer
219
220 def naive__call__(self, instances: Sequence[Dict]) -> Dict[str, torch.Tensor]:
221 input_ids, labels = tuple([instance[key] for instance in instances] for key in ("input_ids", "labels"))
222 input_ids = torch.nn.utils.rnn.pad_sequence(
223 input_ids, batch_first=True, padding_value=self.tokenizer.pad_token_id
224 )
225 labels = torch.nn.utils.rnn.pad_sequence(labels, batch_first=True, padding_value=IGNORE_INDEX)
226 return dict(
227 input_ids=input_ids,
228 labels=labels,
229 attention_mask=input_ids.ne(self.tokenizer.pad_token_id),
230 )
231
232 def __call__(self, instances: Sequence[Dict]) -> Dict[str, torch.Tensor]:
233 sources = []

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected