(self, gate: torch.Tensor)
| 105 | self.proj = nn.Linear(dim_in, dim_out * 2, bias=bias) |
| 106 | |
| 107 | def gelu(self, gate: torch.Tensor) -> torch.Tensor: |
| 108 | if gate.device.type != "mps": |
| 109 | return F.gelu(gate) |
| 110 | # mps: gelu is not implemented for float16 |
| 111 | return F.gelu(gate.to(dtype=torch.float32)).to(dtype=gate.dtype) |
| 112 | |
| 113 | def forward(self, hidden_states, *args, **kwargs): |
| 114 | if len(args) > 0 or kwargs.get("scale", None) is not None: |