(self)
| 627 | precision: Optional[Union[jax.lax.Precision, str]]=None |
| 628 | |
| 629 | def setup(self) -> None: |
| 630 | config = self.config |
| 631 | |
| 632 | self.w1 = nn.Dense( |
| 633 | config.intermediate_size, |
| 634 | dtype=self.dtype, |
| 635 | param_dtype=self.param_dtype, |
| 636 | use_bias=False, |
| 637 | kernel_init=jax.nn.initializers.normal(self.config.initializer_range), |
| 638 | precision=self.precision, |
| 639 | ) |
| 640 | self.w2 = nn.Dense( |
| 641 | config.hidden_size, |
| 642 | dtype=self.dtype, |
| 643 | param_dtype=self.param_dtype, |
| 644 | use_bias=False, |
| 645 | kernel_init=jax.nn.initializers.normal(self.config.initializer_range), |
| 646 | precision=self.precision, |
| 647 | ) |
| 648 | self.w3 = nn.Dense( |
| 649 | config.intermediate_size, |
| 650 | dtype=self.dtype, |
| 651 | param_dtype=self.param_dtype, |
| 652 | use_bias=False, |
| 653 | kernel_init=jax.nn.initializers.normal(self.config.initializer_range), |
| 654 | precision=self.precision, |
| 655 | ) |
| 656 | self.dropout = nn.Dropout(rate=self.config.resid_pdrop) |
| 657 | |
| 658 | def __call__(self, x: jnp.ndarray, deterministic: bool = True) -> jnp.ndarray: |
| 659 | x = self.w2(nn.silu(self.w1(x)) * self.w3(x)) |
nothing calls this directly
no outgoing calls
no test coverage detected