A FlexBERT base class for type hints.
| 594 | |
| 595 | |
| 596 | class FlexBertEncoderBase(nn.Module): |
| 597 | """A FlexBERT base class for type hints.""" |
| 598 | |
| 599 | layers: nn.ModuleList |
| 600 | |
| 601 | def _init_weights(self, reset_params: bool = False): |
| 602 | if hasattr(self, "layers"): |
| 603 | for layer in self.layers: |
| 604 | layer._init_weights(reset_params=reset_params) |
| 605 | |
| 606 | def reset_parameters(self): |
| 607 | self._init_weights(reset_params=True) |
| 608 | |
| 609 | def forward(self, hidden_states: torch.Tensor, attention_mask: torch.Tensor) -> torch.Tensor: |
| 610 | raise NotImplementedError("This is a base class and should not be used directly.") |
| 611 | |
| 612 | |
| 613 | class FlexBertUnpadEncoder(FlexBertEncoderBase): |
nothing calls this directly
no outgoing calls
no test coverage detected