Commit c5ac5cf7 authored by zhuwenwen's avatar zhuwenwen
Browse files

back to forward_native

parent 424fa81f
...@@ -85,10 +85,10 @@ class SiluAndMul(CustomOp): ...@@ -85,10 +85,10 @@ class SiluAndMul(CustomOp):
@staticmethod @staticmethod
def forward_native(x: torch.Tensor) -> torch.Tensor: def forward_native(x: torch.Tensor) -> torch.Tensor:
"""PyTorch-native implementation equivalent to forward().""" """PyTorch-native implementation equivalent to forward()."""
if not torch.compiler.is_compiling() and envs.VLLM_USE_OPT_OP: # if not torch.compiler.is_compiling() and envs.VLLM_USE_OPT_OP:
return self.forward_cuda(x) # return self.forward_cuda(x)
else: # else:
d = x.shape[-1] // 2 d = x.shape[-1] // 2
return F.silu(x[..., :d]) * x[..., d:] return F.silu(x[..., :d]) * x[..., d:]
def forward_cuda(self, x: torch.Tensor) -> torch.Tensor: def forward_cuda(self, x: torch.Tensor) -> torch.Tensor:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment