Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
8 changes: 4 additions & 4 deletions python/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ dependencies = [
"blobfile==3.0.0",
"build",
"compressed-tensors",
"cuda-python>=13.1,<13.3",
"cuda-python>=13.0",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

Removing the upper bound for cuda-python might lead to compatibility issues with future versions. Since the goal is to support CUDA 13.0, it is recommended to keep the upper bound while lowering the minimum version to maintain environment stability.

Suggested change
"cuda-python>=13.0",
"cuda-python>=13.0,<13.3",

"decord2",
"datasets",
"einops",
Expand Down Expand Up @@ -64,11 +64,11 @@ dependencies = [
"tiktoken",
"timm==1.0.16",
"torch_memory_saver==0.0.9",
"torch>=2.10,<2.12",
"torch==2.9.1",
"torchao==0.9.0",
"torchaudio>=2.10,<2.12",
"torchaudio==2.9.1",
"torchcodec==0.8.0 ; sys_platform != 'linux' or (sys_platform == 'linux' and platform_machine != 'aarch64' and platform_machine != 'arm64' and platform_machine != 'armv7l')", # torchcodec does not exist in those systems. If not provided, transformer will use torchvision instead by default.
"torchvision>=0.25,<0.27",
"torchvision",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

Removing the version constraint for torchvision while pinning torch and torchaudio to specific versions can lead to an inconsistent environment. It should be constrained to a version compatible with torch 2.9.1 (likely 0.24.1 based on the project's versioning scheme seen in pyproject_cpu.toml).

Suggested change
"torchvision",
"torchvision==0.24.1",

"tqdm",
"transformers==4.57.1",
"uvicorn",
Expand Down
3 changes: 2 additions & 1 deletion python/sglang/srt/configs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from sglang.srt.configs.bailing_hybrid import BailingHybridConfig
from sglang.srt.configs.chatglm import ChatGLMConfig
from sglang.srt.configs.dbrx import DbrxConfig
from sglang.srt.configs.deepseekvl2 import DeepseekVL2Config
from sglang.srt.configs.deepseekvl2 import DeepseekVL2Config, GlmMoeDsaConfig
from sglang.srt.configs.dots_ocr import DotsOCRConfig
from sglang.srt.configs.dots_vlm import DotsVLMConfig
from sglang.srt.configs.exaone import ExaoneConfig
Expand Down Expand Up @@ -38,6 +38,7 @@
"ChatGLMConfig",
"DbrxConfig",
"DeepseekVL2Config",
"GlmMoeDsaConfig",
"LongcatFlashConfig",
"MultiModalityConfig",
"KimiVLConfig",
Expand Down
4 changes: 4 additions & 0 deletions python/sglang/srt/configs/deepseekvl2.py
Original file line number Diff line number Diff line change
Expand Up @@ -647,6 +647,10 @@ def __init__(
)


class GlmMoeDsaConfig(DeepseekV2Config):
model_type = "glm_moe_dsa"


class DeepseekVL2Config(PretrainedConfig):
model_type = "deepseek_vl_v2"
vision_config: DeepseekVL2VisionEncoderConfig
Expand Down
11 changes: 9 additions & 2 deletions python/sglang/srt/layers/moe/kt_ep_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -1646,7 +1646,14 @@ def create_kt_config_from_server_args(
if is_kt_ep_wrapper_disabled():
return None

if server_args.kt_weight_path is None:
kt_method = (server_args.kt_method or "").upper()
weight_path = (
server_args.pagedmoe_storage_root
if kt_method == "PAGEDMOE" and server_args.pagedmoe_storage_root is not None
else server_args.kt_weight_path
)

if weight_path is None:
return None

# Get GPU experts masks (initializes if needed)
Expand All @@ -1669,7 +1676,7 @@ def create_kt_config_from_server_args(
cpuinfer_threads=server_args.kt_cpuinfer,
threadpool_count=server_args.kt_threadpool_count,
numa_nodes=server_args.kt_numa_nodes,
weight_path=server_args.kt_weight_path,
weight_path=weight_path,
chunked_prefill_size=server_args.chunked_prefill_size,
method=server_args.kt_method,
max_deferred_experts_per_token=server_args.kt_max_deferred_experts_per_token,
Expand Down
6 changes: 6 additions & 0 deletions python/sglang/srt/server_args.py
Original file line number Diff line number Diff line change
Expand Up @@ -551,6 +551,7 @@ class ServerArgs:

# Ktransformers/AMX expert parallelism
kt_weight_path: Optional[str] = None
pagedmoe_storage_root: Optional[str] = None
kt_method: Optional[str] = None
kt_cpuinfer: Optional[int] = None
kt_threadpool_count: Optional[int] = None
Expand Down Expand Up @@ -4436,6 +4437,11 @@ def add_cli_args(parser: argparse.ArgumentParser):
type=str,
help="[ktransformers parameter] The path of the quantized expert weights for amx kernel. A local folder.",
)
parser.add_argument(
"--pagedmoe-storage-root",
type=str,
help="[pagedmoe parameter] The root directory containing pagedmoe manifest.json and layer storage.",
)
parser.add_argument(
"--kt-method",
type=str,
Expand Down
27 changes: 26 additions & 1 deletion python/sglang/srt/utils/hf_transformers_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
DotsVLMConfig,
ExaoneConfig,
FalconH1Config,
GlmMoeDsaConfig,
GraniteMoeHybridConfig,
JetNemotronConfig,
JetVLMConfig,
Expand Down Expand Up @@ -86,6 +87,7 @@
ChatGLMConfig,
DbrxConfig,
ExaoneConfig,
GlmMoeDsaConfig,
DeepseekVL2Config,
MultiModalityConfig,
KimiVLConfig,
Expand Down Expand Up @@ -541,9 +543,32 @@ def get_tokenizer(
)
raise RuntimeError(err_msg) from e
except ValueError as e:
tokenizer_json = Path(tokenizer_name) / "tokenizer.json"
tokenizer_config = Path(tokenizer_name) / "tokenizer_config.json"
if "TokenizersBackend" in str(e) and tokenizer_json.exists():
tokenizer_kwargs: Dict[str, Any] = {
"tokenizer_file": str(tokenizer_json),
"clean_up_tokenization_spaces": False,
}
if tokenizer_config.exists():
with tokenizer_config.open() as f:
tokenizer_config_data = json.load(f)
for key in (
"bos_token",
"eos_token",
"pad_token",
"unk_token",
"model_max_length",
):
if key in tokenizer_config_data:
tokenizer_kwargs[key] = tokenizer_config_data[key]
tokenizer = PreTrainedTokenizerFast(**tokenizer_kwargs)
logging.getLogger(tokenizer.__class__.__module__).addFilter(
TokenizerWarningsFilter()
)
# If the error pertains to the tokenizer class not existing or not
# currently being imported, suggest using the --trust-remote-code flag.
if not trust_remote_code and (
elif not trust_remote_code and (
"does not exist or is not currently imported." in str(e)
or "requires you to execute the tokenizer file" in str(e)
):
Expand Down
Loading