Use is_flashinfer_available to replace is_hip for flashinfer check (#1596)

Co-authored-by: Zhang Liangang <liangang.zhang@intel.com>
This commit is contained in:
Lianmin Zheng
2024-10-06 22:54:05 -07:00
committed by GitHub
parent 565b05f02f
commit 6a5b352aaf
9 changed files with 29 additions and 28 deletions

View File

@@ -20,9 +20,9 @@ import torch
import torch.nn as nn
import torch.nn.functional as F
from sglang.srt.utils import is_hip
from sglang.srt.utils import is_flashinfer_available
if not is_hip():
if is_flashinfer_available():
from flashinfer.activation import gelu_and_mul, gelu_tanh_and_mul, silu_and_mul
from vllm.distributed import (
@@ -146,8 +146,8 @@ def get_act_fn(
return act_fn
if is_hip():
if not is_flashinfer_available():
logger.info(
"FlashInfer is not available on AMD GPUs. Fallback to other kernel libraries."
"FlashInfer is not available on Non-NV GPUs. Fallback to other kernel libraries."
)
from vllm.model_executor.layers.activation import GeluAndMul, SiluAndMul