From 9c001e9769116cba36261eb06e50a579cafc785a Mon Sep 17 00:00:00 2001 From: yhyang201 Date: Sun, 7 Dec 2025 09:17:59 +0000 Subject: [PATCH 1/8] upd --- python/pyproject.toml | 2 +- python/pyproject_cpu.toml | 2 +- python/pyproject_other.toml | 2 +- python/pyproject_xpu.toml | 2 +- python/sglang/srt/configs/qwen3_omni.py | 4 ---- scripts/ci/ci_install_dependency.sh | 8 ++++++++ sgl-kernel/CMakeLists.txt | 2 +- sgl-kernel/python/sgl_kernel/_fa4_interface.py | 6 +++--- 8 files changed, 16 insertions(+), 12 deletions(-) diff --git a/python/pyproject.toml b/python/pyproject.toml index 85428cba02d8..2bf00e5dbb33 100755 --- a/python/pyproject.toml +++ b/python/pyproject.toml @@ -69,7 +69,7 @@ dependencies = [ "torchvision", "torchao==0.9.0", "tqdm", - "transformers==4.57.1", + "transformers==5.0.0rc0", "uvicorn", "uvloop", "xgrammar==0.1.27", diff --git a/python/pyproject_cpu.toml b/python/pyproject_cpu.toml index a537bc3607ef..5421f2b7cfbf 100644 --- a/python/pyproject_cpu.toml +++ b/python/pyproject_cpu.toml @@ -59,7 +59,7 @@ dependencies = [ "timm==1.0.16", "torchao==0.9.0", "tqdm", - "transformers==4.57.1", + "transformers==5.0.0rc0", "uvicorn", "uvloop", "xgrammar==0.1.27", diff --git a/python/pyproject_other.toml b/python/pyproject_other.toml index 3e854caa726a..ae1622363c41 100755 --- a/python/pyproject_other.toml +++ b/python/pyproject_other.toml @@ -59,7 +59,7 @@ runtime_common = [ "timm==1.0.16", "torchao==0.9.0", "tqdm", - "transformers==4.57.1", + "transformers==5.0.0rc0", "uvicorn", "uvloop", "xgrammar==0.1.27", diff --git a/python/pyproject_xpu.toml b/python/pyproject_xpu.toml index a058e6f48a82..3d7dc969a4b5 100644 --- a/python/pyproject_xpu.toml +++ b/python/pyproject_xpu.toml @@ -63,7 +63,7 @@ dependencies = [ "timm==1.0.16", "torchao==0.9.0", "tqdm", - "transformers==4.57.1", + "transformers==5.0.0rc0", "uvicorn", "uvloop", # "xgrammar==0.1.24", , xgrammar depends on CUDA PyTorch and Triton only diff --git a/python/sglang/srt/configs/qwen3_omni.py b/python/sglang/srt/configs/qwen3_omni.py index d42e98a9a07b..8baea892335d 100644 --- a/python/sglang/srt/configs/qwen3_omni.py +++ b/python/sglang/srt/configs/qwen3_omni.py @@ -1,6 +1,5 @@ from transformers import PretrainedConfig from transformers.configuration_utils import layer_type_validation -from transformers.modeling_rope_utils import rope_config_validation from sglang.utils import logger @@ -168,7 +167,6 @@ def __init__( # BC: if there is a 'type' field, move it to 'rope_type'. if self.rope_scaling is not None and "type" in self.rope_scaling: self.rope_scaling["rope_type"] = self.rope_scaling["type"] - rope_config_validation(self) # MoE arguments self.decoder_sparse_step = decoder_sparse_step @@ -311,7 +309,6 @@ def __init__( # BC: if there is a 'type' field, move it to 'rope_type'. if self.rope_scaling is not None and "type" in self.rope_scaling: self.rope_scaling["rope_type"] = self.rope_scaling["type"] - rope_config_validation(self) self.layer_types = layer_types if self.layer_types is None: @@ -405,7 +402,6 @@ def __init__( # BC: if there is a 'type' field, move it to 'rope_type'. if self.rope_scaling is not None and "type" in self.rope_scaling: self.rope_scaling["rope_type"] = self.rope_scaling["type"] - rope_config_validation(self) # MoE arguments self.decoder_sparse_step = decoder_sparse_step diff --git a/scripts/ci/ci_install_dependency.sh b/scripts/ci/ci_install_dependency.sh index 7d0735602452..96dc3a2410f2 100755 --- a/scripts/ci/ci_install_dependency.sh +++ b/scripts/ci/ci_install_dependency.sh @@ -147,3 +147,11 @@ python3 -c "import torch; print(torch.version.cuda)" # Prepare the CI runner (cleanup HuggingFace cache, etc.) bash "${SCRIPT_DIR}/prepare_runner.sh" + +if [ -d "/usr/local/lib/python3.10/dist-packages/flash_attn" ]; then + echo "Directory /usr/local/lib/python3.10/dist-packages/flash_attn exists." +else + echo "Directory /usr/local/lib/python3.10/dist-packages/flash_attn does not exist." +fi + +rm -rf /usr/local/lib/python3.10/dist-packages/flash_attn diff --git a/sgl-kernel/CMakeLists.txt b/sgl-kernel/CMakeLists.txt index 079eb2f45a3e..c4b6172690ea 100644 --- a/sgl-kernel/CMakeLists.txt +++ b/sgl-kernel/CMakeLists.txt @@ -595,7 +595,7 @@ install(DIRECTORY "${repo-triton_SOURCE_DIR}/python/triton_kernels/triton_kernel if ("${CUDA_VERSION}" VERSION_GREATER_EQUAL "12.8" OR SGL_KERNEL_ENABLE_SM100A) # flash_attn/cute install(DIRECTORY "${repo-flash-attention_SOURCE_DIR}/flash_attn/cute/" - DESTINATION "flash_attn/cute" + DESTINATION "flash_attn_origin/cute" PATTERN ".git*" EXCLUDE PATTERN "__pycache__" EXCLUDE) endif() diff --git a/sgl-kernel/python/sgl_kernel/_fa4_interface.py b/sgl-kernel/python/sgl_kernel/_fa4_interface.py index 5411cfe16bb0..ffd0563f56dc 100644 --- a/sgl-kernel/python/sgl_kernel/_fa4_interface.py +++ b/sgl-kernel/python/sgl_kernel/_fa4_interface.py @@ -19,9 +19,9 @@ import cutlass.cute as cute import torch from cutlass.cute.runtime import from_dlpack -from flash_attn.cute import utils -from flash_attn.cute.flash_fwd import FlashAttentionForwardSm90 -from flash_attn.cute.flash_fwd_sm100 import FlashAttentionForwardSm100 +from flash_attn_origin.cute import utils +from flash_attn_origin.cute.flash_fwd import FlashAttentionForwardSm90 +from flash_attn_origin.cute.flash_fwd_sm100 import FlashAttentionForwardSm100 def maybe_contiguous(x): From fd57e5b247127920f2c55a0160bb4a5dd16435c4 Mon Sep 17 00:00:00 2001 From: yhyang201 Date: Mon, 8 Dec 2025 04:11:20 +0000 Subject: [PATCH 2/8] upd --- sgl-kernel/CMakeLists.txt | 37 +++++++++++++++++-- .../python/sgl_kernel/_fa4_interface.py | 6 +-- 2 files changed, 37 insertions(+), 6 deletions(-) diff --git a/sgl-kernel/CMakeLists.txt b/sgl-kernel/CMakeLists.txt index c4b6172690ea..9a438591a7aa 100644 --- a/sgl-kernel/CMakeLists.txt +++ b/sgl-kernel/CMakeLists.txt @@ -593,9 +593,40 @@ install(DIRECTORY "${repo-triton_SOURCE_DIR}/python/triton_kernels/triton_kernel # ============================ Extra Install: FA4 ============================= # # TODO: find a better install condition. if ("${CUDA_VERSION}" VERSION_GREATER_EQUAL "12.8" OR SGL_KERNEL_ENABLE_SM100A) - # flash_attn/cute - install(DIRECTORY "${repo-flash-attention_SOURCE_DIR}/flash_attn/cute/" + + set(FLASH_ATTN_CUTE_SRC "${repo-flash-attention_SOURCE_DIR}/flash_attn/cute") + set(FLASH_ATTN_CUTE_DST "${CMAKE_CURRENT_BINARY_DIR}/flash_attn_origin/cute") + + file(MAKE_DIRECTORY "${FLASH_ATTN_CUTE_DST}") + + file(COPY "${FLASH_ATTN_CUTE_SRC}/" + DESTINATION "${FLASH_ATTN_CUTE_DST}" + PATTERN ".git*" EXCLUDE + PATTERN "__pycache__" EXCLUDE) + + file(GLOB_RECURSE FLASH_ATTN_CUTE_DST_PY + "${FLASH_ATTN_CUTE_DST}/*.py") + + foreach(FILE_PATH IN LISTS FLASH_ATTN_CUTE_DST_PY) + file(READ "${FILE_PATH}" FILE_CONTENT) + + set(MODIFIED_CONTENT "${FILE_CONTENT}") + + # The main goal is to avoid using "flash_attn" so that other libraries (such as transformers) do not mistakenly assume that "flash_attn" is already installed. + + string(REPLACE "flash_attn.cute" + "flash_attn_origin.cute" + MODIFIED_CONTENT "${MODIFIED_CONTENT}") + + if (NOT FILE_CONTENT STREQUAL MODIFIED_CONTENT) + file(WRITE "${FILE_PATH}" "${MODIFIED_CONTENT}") + message(STATUS " - [FA4 Patch] Patched: ${FILE_PATH}") + endif() + endforeach() + + install(DIRECTORY "${FLASH_ATTN_CUTE_DST}/" DESTINATION "flash_attn_origin/cute" PATTERN ".git*" EXCLUDE PATTERN "__pycache__" EXCLUDE) - endif() + +endif() diff --git a/sgl-kernel/python/sgl_kernel/_fa4_interface.py b/sgl-kernel/python/sgl_kernel/_fa4_interface.py index ffd0563f56dc..5411cfe16bb0 100644 --- a/sgl-kernel/python/sgl_kernel/_fa4_interface.py +++ b/sgl-kernel/python/sgl_kernel/_fa4_interface.py @@ -19,9 +19,9 @@ import cutlass.cute as cute import torch from cutlass.cute.runtime import from_dlpack -from flash_attn_origin.cute import utils -from flash_attn_origin.cute.flash_fwd import FlashAttentionForwardSm90 -from flash_attn_origin.cute.flash_fwd_sm100 import FlashAttentionForwardSm100 +from flash_attn.cute import utils +from flash_attn.cute.flash_fwd import FlashAttentionForwardSm90 +from flash_attn.cute.flash_fwd_sm100 import FlashAttentionForwardSm100 def maybe_contiguous(x): From 48351837c7765a4b6a06222a9add7a5c46fe4327 Mon Sep 17 00:00:00 2001 From: yhyang201 Date: Mon, 8 Dec 2025 05:14:28 +0000 Subject: [PATCH 3/8] update --- scripts/ci/ci_install_dependency.sh | 45 +++++++++++++++++++++++++---- 1 file changed, 40 insertions(+), 5 deletions(-) diff --git a/scripts/ci/ci_install_dependency.sh b/scripts/ci/ci_install_dependency.sh index 96dc3a2410f2..371761d3e53c 100755 --- a/scripts/ci/ci_install_dependency.sh +++ b/scripts/ci/ci_install_dependency.sh @@ -1,5 +1,18 @@ #!/bin/bash # Install the dependency in CI. + +PYTHON_LIB_PATH=$(python3 -c "import site; print(site.getsitepackages()[0])") +FLASH_ATTN_PATH="${PYTHON_LIB_PATH}/flash_attn" + +if [ -d "$FLASH_ATTN_PATH" ]; then + echo "8 Directory $FLASH_ATTN_PATH exists. Removing..." + rm -rf "$FLASH_ATTN_PATH" +else + echo "11 Directory $FLASH_ATTN_PATH does not exist." +fi + +rm -rf $FLASH_ATTN_PATH + set -euxo pipefail IS_BLACKWELL=${IS_BLACKWELL:-0} @@ -80,6 +93,7 @@ if [ "$IS_BLACKWELL" = "1" ]; then # Clean up existing installations $PIP_CMD uninstall -y sgl-kernel sglang $PIP_INSTALL_SUFFIX || true $PIP_CMD uninstall -y flashinfer-python flashinfer-cubin flashinfer-jit-cache $PIP_INSTALL_SUFFIX || true + $PIP_CMD install "importlib-metadata>=4.7" $PIP_INSTALL_SUFFIX else # In normal cases, we use uv, which is much faster than pip. pip install --upgrade pip @@ -106,6 +120,16 @@ $PIP_CMD install -e "python[${EXTRAS}]" --extra-index-url https://download.pytor # Install router for pd-disagg test $PIP_CMD install sglang-router $PIP_INSTALL_SUFFIX +PYTHON_LIB_PATH=$(python3 -c "import site; print(site.getsitepackages()[0])") +FLASH_ATTN_PATH="${PYTHON_LIB_PATH}/flash_attn" + +if [ -d "$FLASH_ATTN_PATH" ]; then + echo "126 Directory $FLASH_ATTN_PATH exists. Removing..." + rm -rf "$FLASH_ATTN_PATH" +else + echo "129 Directory $FLASH_ATTN_PATH does not exist." +fi + # Install sgl-kernel SGL_KERNEL_VERSION_FROM_KERNEL=$(grep -Po '(?<=^version = ")[^"]*' sgl-kernel/pyproject.toml) SGL_KERNEL_VERSION_FROM_SRT=$(grep -Po -m1 '(?<=sgl-kernel==)[0-9A-Za-z\.\-]+' python/pyproject.toml) @@ -119,6 +143,14 @@ if [ "${CUSTOM_BUILD_SGL_KERNEL:-}" = "true" ]; then else WHEEL_ARCH="x86_64" fi + + WHEEL_PATH="sgl-kernel/dist/sgl_kernel-${SGL_KERNEL_VERSION_FROM_KERNEL}-cp310-abi3-manylinux2014_${WHEEL_ARCH}.whl" + if [ -f "$WHEEL_PATH" ]; then + echo "147 Wheel file $WHEEL_PATH exists." + else + echo "149 Error: Wheel file $WHEEL_PATH does not exist." + fi + $PIP_CMD install sgl-kernel/dist/sgl_kernel-${SGL_KERNEL_VERSION_FROM_KERNEL}-cp310-abi3-manylinux2014_${WHEEL_ARCH}.whl --force-reinstall $PIP_INSTALL_SUFFIX else $PIP_CMD install sgl-kernel==${SGL_KERNEL_VERSION_FROM_SRT} --force-reinstall $PIP_INSTALL_SUFFIX @@ -148,10 +180,13 @@ python3 -c "import torch; print(torch.version.cuda)" # Prepare the CI runner (cleanup HuggingFace cache, etc.) bash "${SCRIPT_DIR}/prepare_runner.sh" -if [ -d "/usr/local/lib/python3.10/dist-packages/flash_attn" ]; then - echo "Directory /usr/local/lib/python3.10/dist-packages/flash_attn exists." +PYTHON_LIB_PATH=$(python3 -c "import site; print(site.getsitepackages()[0])") +FLASH_ATTN_PATH="${PYTHON_LIB_PATH}/flash_attn" + +if [ -d "$FLASH_ATTN_PATH" ]; then + echo "178 Directory $FLASH_ATTN_PATH exists. Removing..." + rm -rf "$FLASH_ATTN_PATH" + echo "Bug this should not happen" else - echo "Directory /usr/local/lib/python3.10/dist-packages/flash_attn does not exist." + echo "181 Directory $FLASH_ATTN_PATH does not exist." fi - -rm -rf /usr/local/lib/python3.10/dist-packages/flash_attn From d39f49382c4850091138684da7a145fb7b53f305 Mon Sep 17 00:00:00 2001 From: yhyang201 Date: Mon, 8 Dec 2025 05:16:22 +0000 Subject: [PATCH 4/8] update --- scripts/ci/ci_install_dependency.sh | 8 -------- 1 file changed, 8 deletions(-) diff --git a/scripts/ci/ci_install_dependency.sh b/scripts/ci/ci_install_dependency.sh index 371761d3e53c..92b8d570194b 100755 --- a/scripts/ci/ci_install_dependency.sh +++ b/scripts/ci/ci_install_dependency.sh @@ -143,14 +143,6 @@ if [ "${CUSTOM_BUILD_SGL_KERNEL:-}" = "true" ]; then else WHEEL_ARCH="x86_64" fi - - WHEEL_PATH="sgl-kernel/dist/sgl_kernel-${SGL_KERNEL_VERSION_FROM_KERNEL}-cp310-abi3-manylinux2014_${WHEEL_ARCH}.whl" - if [ -f "$WHEEL_PATH" ]; then - echo "147 Wheel file $WHEEL_PATH exists." - else - echo "149 Error: Wheel file $WHEEL_PATH does not exist." - fi - $PIP_CMD install sgl-kernel/dist/sgl_kernel-${SGL_KERNEL_VERSION_FROM_KERNEL}-cp310-abi3-manylinux2014_${WHEEL_ARCH}.whl --force-reinstall $PIP_INSTALL_SUFFIX else $PIP_CMD install sgl-kernel==${SGL_KERNEL_VERSION_FROM_SRT} --force-reinstall $PIP_INSTALL_SUFFIX From bdddf7b7bc566e4ce7bab8a66f3883d40966a888 Mon Sep 17 00:00:00 2001 From: yhyang201 Date: Mon, 8 Dec 2025 05:18:26 +0000 Subject: [PATCH 5/8] updatee --- scripts/ci/ci_install_dependency.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/ci/ci_install_dependency.sh b/scripts/ci/ci_install_dependency.sh index 92b8d570194b..0140d98b1405 100755 --- a/scripts/ci/ci_install_dependency.sh +++ b/scripts/ci/ci_install_dependency.sh @@ -93,7 +93,6 @@ if [ "$IS_BLACKWELL" = "1" ]; then # Clean up existing installations $PIP_CMD uninstall -y sgl-kernel sglang $PIP_INSTALL_SUFFIX || true $PIP_CMD uninstall -y flashinfer-python flashinfer-cubin flashinfer-jit-cache $PIP_INSTALL_SUFFIX || true - $PIP_CMD install "importlib-metadata>=4.7" $PIP_INSTALL_SUFFIX else # In normal cases, we use uv, which is much faster than pip. pip install --upgrade pip From f0f147fa58b876f388fcb583334a2ba6ffed405f Mon Sep 17 00:00:00 2001 From: yhyang201 Date: Mon, 8 Dec 2025 05:19:39 +0000 Subject: [PATCH 6/8] update --- scripts/ci/ci_install_dependency.sh | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/scripts/ci/ci_install_dependency.sh b/scripts/ci/ci_install_dependency.sh index 0140d98b1405..549659a15243 100755 --- a/scripts/ci/ci_install_dependency.sh +++ b/scripts/ci/ci_install_dependency.sh @@ -1,18 +1,5 @@ #!/bin/bash # Install the dependency in CI. - -PYTHON_LIB_PATH=$(python3 -c "import site; print(site.getsitepackages()[0])") -FLASH_ATTN_PATH="${PYTHON_LIB_PATH}/flash_attn" - -if [ -d "$FLASH_ATTN_PATH" ]; then - echo "8 Directory $FLASH_ATTN_PATH exists. Removing..." - rm -rf "$FLASH_ATTN_PATH" -else - echo "11 Directory $FLASH_ATTN_PATH does not exist." -fi - -rm -rf $FLASH_ATTN_PATH - set -euxo pipefail IS_BLACKWELL=${IS_BLACKWELL:-0} From bb72126490c9993658bef5e103b4dbcadbdd9b83 Mon Sep 17 00:00:00 2001 From: yhyang201 Date: Mon, 8 Dec 2025 06:12:36 +0000 Subject: [PATCH 7/8] upd --- sgl-kernel/python/sgl_kernel/_fa4_interface.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sgl-kernel/python/sgl_kernel/_fa4_interface.py b/sgl-kernel/python/sgl_kernel/_fa4_interface.py index 5411cfe16bb0..ffd0563f56dc 100644 --- a/sgl-kernel/python/sgl_kernel/_fa4_interface.py +++ b/sgl-kernel/python/sgl_kernel/_fa4_interface.py @@ -19,9 +19,9 @@ import cutlass.cute as cute import torch from cutlass.cute.runtime import from_dlpack -from flash_attn.cute import utils -from flash_attn.cute.flash_fwd import FlashAttentionForwardSm90 -from flash_attn.cute.flash_fwd_sm100 import FlashAttentionForwardSm100 +from flash_attn_origin.cute import utils +from flash_attn_origin.cute.flash_fwd import FlashAttentionForwardSm90 +from flash_attn_origin.cute.flash_fwd_sm100 import FlashAttentionForwardSm100 def maybe_contiguous(x): From dfb66260b56e4bff62f7c3d6b8923216d6643df1 Mon Sep 17 00:00:00 2001 From: Yuhao Yang <47235274+yhyang201@users.noreply.github.com> Date: Mon, 8 Dec 2025 16:06:54 +0800 Subject: [PATCH 8/8] Improve echo messages in ci_install_dependency.sh --- scripts/ci/ci_install_dependency.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/scripts/ci/ci_install_dependency.sh b/scripts/ci/ci_install_dependency.sh index 549659a15243..09fdb4104a7e 100755 --- a/scripts/ci/ci_install_dependency.sh +++ b/scripts/ci/ci_install_dependency.sh @@ -110,10 +110,10 @@ PYTHON_LIB_PATH=$(python3 -c "import site; print(site.getsitepackages()[0])") FLASH_ATTN_PATH="${PYTHON_LIB_PATH}/flash_attn" if [ -d "$FLASH_ATTN_PATH" ]; then - echo "126 Directory $FLASH_ATTN_PATH exists. Removing..." + echo "Directory $FLASH_ATTN_PATH exists. Removing..." rm -rf "$FLASH_ATTN_PATH" else - echo "129 Directory $FLASH_ATTN_PATH does not exist." + echo "Directory $FLASH_ATTN_PATH does not exist." fi # Install sgl-kernel @@ -162,9 +162,9 @@ PYTHON_LIB_PATH=$(python3 -c "import site; print(site.getsitepackages()[0])") FLASH_ATTN_PATH="${PYTHON_LIB_PATH}/flash_attn" if [ -d "$FLASH_ATTN_PATH" ]; then - echo "178 Directory $FLASH_ATTN_PATH exists. Removing..." + echo "Directory $FLASH_ATTN_PATH exists. Removing..." rm -rf "$FLASH_ATTN_PATH" - echo "Bug this should not happen" + echo "error: this should not happen" else - echo "181 Directory $FLASH_ATTN_PATH does not exist." + echo "Directory $FLASH_ATTN_PATH does not exist." fi