Enhance Dockerfile.ci to synchronize flashinfer runtime package versions with installed flashinfer-python, ensuring compatibility across components. Additionally, improve error handling in ring_globals.py for flashinfer import failures, logging warnings for fallback scenarios.
Signed-off-by: tzhouam <tzhouam@connect.ust.hk>
This commit is contained in:
1 parent
670240ccd4
commit
e0f540fe98
2 files changed
+19
-1
No files matched your search
@@ -20,6 +20,17 @@ RUN apt-get update && \
|
||||
# causing it to fall back to the older stable release from PyPI.
|
||||
RUN uv pip install --system --upgrade --force-reinstall --prerelease=allow vllm --extra-index-url https://wheels.vllm.ai/f97ca671766c5201404e9fc812e35bf2c4e95a01
|
||||
|
||||
# Keep flashinfer runtime packages in version sync.
|
||||
# We derive the version from installed flashinfer-python (pulled by vllm)
|
||||
# and enforce the same version for flashinfer-cubin / flashinfer-jit-cache.
|
||||
RUN FLASHINFER_VERSION="$(python3 -c 'import importlib.metadata as m; print(m.version(\"flashinfer-python\"))')" && \
|
||||
FLASHINFER_CUDA_TAG="$(python3 -c 'import torch; print((torch.version.cuda or \"12.4\").replace(\".\", \"\"))')" && \
|
||||
uv pip install --system --upgrade --force-reinstall \
|
||||
"flashinfer-cubin==${FLASHINFER_VERSION}" \
|
||||
"flashinfer-jit-cache==${FLASHINFER_VERSION}" \
|
||||
--extra-index-url "https://flashinfer.ai/whl/cu${FLASHINFER_CUDA_TAG}" && \
|
||||
flashinfer show-config
|
||||
|
||||
# Install vllm-omni into the same uv-managed Python environment used by the base image.
|
||||
RUN uv pip install --python "$(python3 -c 'import sys; print(sys.executable)')" --no-cache-dir ".[dev]"
|
||||
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
# Copyright (c) 2024, Jiarui Fang.
|
||||
# Adapted from https://github.com/feifeibear/long-context-attention
|
||||
|
||||
import logging
|
||||
|
||||
# test if flash_attn (FA2) is available
|
||||
try:
|
||||
import flash_attn # noqa: F401
|
||||
@@ -45,12 +47,17 @@ HAS_FLASH_ATTN_HOPPER = HAS_FA3
|
||||
flash_attn_forward_hopper = fa3_fwd_func
|
||||
flash3_attn_func = fa3_attn_func
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
try:
|
||||
from flashinfer.prefill import single_prefill_with_kv_cache # noqa: F401
|
||||
|
||||
HAS_FLASHINFER = True
|
||||
except (ImportError, ModuleNotFoundError):
|
||||
except Exception as e:
|
||||
# flashinfer may raise RuntimeError at import-time for version/binary mismatches.
|
||||
# Treat it as unavailable so the runtime can gracefully fall back to other backends.
|
||||
HAS_FLASHINFER = False
|
||||
logger.warning("FlashInfer is unavailable; falling back to other attention backends. Reason: %s", e)
|
||||
|
||||
try:
|
||||
import aiter # noqa: F401
|
||||
|
||||
Reference in new issue
Block a user