(
self,
input_ids: Optional[torch.Tensor] = None,
position_ids: Optional[torch.Tensor] = None,
attention_mask: Optional[torch.Tensor] = None,
past_key_values: Optional[Tuple[torch.FloatTensor]] = None,
**kw_args
)
| 107 | } |
| 108 | |
| 109 | def forward( |
| 110 | self, |
| 111 | input_ids: Optional[torch.Tensor] = None, |
| 112 | position_ids: Optional[torch.Tensor] = None, |
| 113 | attention_mask: Optional[torch.Tensor] = None, |
| 114 | past_key_values: Optional[Tuple[torch.FloatTensor]] = None, |
| 115 | **kw_args |
| 116 | ): |
| 117 | outputs = self.model( |
| 118 | input_ids=input_ids, |
| 119 | position_ids=position_ids, |
| 120 | attention_mask=attention_mask, |
| 121 | past_key_values=past_key_values, |
| 122 | ) |
| 123 | |
| 124 | lm_logits = outputs[0] |
| 125 | past_key_values = [x['past_key_values'] for x in outputs[1:]] |
| 126 | |
| 127 | return CausalLMOutputWithPast( |
| 128 | logits=lm_logits, |
| 129 | past_key_values=past_key_values |
| 130 | ) |
| 131 | |
| 132 | @staticmethod |
| 133 | def _reorder_cache( |
nothing calls this directly
no outgoing calls
no test coverage detected