(
self,
input_ids: Optional[torch.LongTensor] = None,
attention_mask: Optional[torch.FloatTensor] = None,
)
| 289 | self.apply(init_weights) |
| 290 | |
| 291 | def forward( |
| 292 | self, |
| 293 | input_ids: Optional[torch.LongTensor] = None, |
| 294 | attention_mask: Optional[torch.FloatTensor] = None, |
| 295 | ): |
| 296 | x = self.token_embedding(input_ids) |
| 297 | x = self.dropout(x) |
| 298 | e = self.pos_embedding(x.size(1), |
| 299 | x.size(1)) if self.shared_pos else None |
| 300 | for block in self.blocks: |
| 301 | x = block(x, attention_mask, pos_bias=e) |
| 302 | x = self.norm(x) |
| 303 | x = self.dropout(x) |
| 304 | return (x, ) |
| 305 | |
| 306 | @classmethod |
| 307 | def from_pretrained(cls, pretrained_model_path, additional_kwargs={}, low_cpu_mem_usage=False, torch_dtype=torch.bfloat16): |
nothing calls this directly
no outgoing calls
no test coverage detected