feat: use sgl-kernel 0.0.3 in sglang (#3179)

This commit is contained in:
Yineng Zhang
2025-01-27 21:39:52 +08:00
committed by GitHub
parent 8a96f74988
commit 2f79f58873
6 changed files with 20 additions and 24 deletions

View File

@@ -20,10 +20,10 @@ import torch
import torch.nn as nn
import torch.nn.functional as F
from sglang.srt.utils import is_flashinfer_available
from sglang.srt.utils import is_cuda_available
if is_flashinfer_available():
from flashinfer.activation import gelu_and_mul, gelu_tanh_and_mul, silu_and_mul
if is_cuda_available():
from sgl_kernel import gelu_and_mul, gelu_tanh_and_mul, silu_and_mul
from vllm.model_executor.custom_op import CustomOp
@@ -149,8 +149,8 @@ def get_act_fn(
return act_fn
if not is_flashinfer_available():
if not is_cuda_available():
logger.info(
"FlashInfer is not available on Non-NV platforms. Fallback to other kernel libraries."
"sgl-kernel is not available on Non-NV platforms. Fallback to other kernel libraries."
)
from vllm.model_executor.layers.activation import GeluAndMul, SiluAndMul