Skip to content
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion python/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ dependencies = [
"torchvision",
"torchao==0.9.0",
"tqdm",
"transformers==4.57.1",
"transformers==5.0.0rc0",
Comment thread
yhyang201 marked this conversation as resolved.
"uvicorn",
"uvloop",
"xgrammar==0.1.27",
Expand Down
2 changes: 1 addition & 1 deletion python/pyproject_cpu.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion python/pyproject_other.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion python/pyproject_xpu.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 0 additions & 4 deletions python/sglang/srt/configs/qwen3_omni.py
Original file line number Diff line number Diff line change
@@ -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

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down
21 changes: 21 additions & 0 deletions scripts/ci/ci_install_dependency.sh
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,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..."

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It will first install sgl-kernel from PyPI. After the installation, a flash_attn folder will remain, which needs to be cleaned up manually.

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)
Expand Down Expand Up @@ -147,3 +157,14 @@ python3 -c "import torch; print(torch.version.cuda)"

# Prepare the CI runner (cleanup HuggingFace cache, etc.)
bash "${SCRIPT_DIR}/prepare_runner.sh"

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 "181 Directory $FLASH_ATTN_PATH does not exist."
fi
39 changes: 35 additions & 4 deletions sgl-kernel/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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/"
DESTINATION "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()
Loading