Fix external_models import path and migrate model loading tests (#16458)

This commit is contained in:
Alison Shao
2026-01-08 23:43:49 -08:00
committed by GitHub
parent 9d4d57dbfa
commit e46f79431b
8 changed files with 24 additions and 21 deletions

View File

@@ -45,7 +45,7 @@ _DEEPGEMM_ON_H20 = get_bool_env_var("SGLANG_DEEPGEMM_ON_H20")
# TODO(kaixih@nvidia): ideally we should merge this logic into
# `fill_gateup_input_triton_kernel` to directly generate e8m0 scale.
@torch.compile
@torch.compile(disable=_is_hip or _is_npu)
def _cast_to_e8m0_with_rounding_up(x: torch.Tensor) -> torch.Tensor:
temp = x.to(torch.float32).view(torch.int32)
exp = torch.bitwise_right_shift(temp, 23)

View File

@@ -0,0 +1,21 @@
from sglang.srt.models.qwen2_vl import (
Qwen2VLForConditionalGeneration as OriginalQwen2VLForConditionalGeneration,
)
from sglang.srt.multimodal.processors.qwen_vl import QwenVLImageProcessor
class Qwen2VLForConditionalGeneration(OriginalQwen2VLForConditionalGeneration):
def __init__(self, config, quant_config, prefix: str = "") -> None:
super().__init__(config, quant_config, prefix)
print("init custom model:", self.__class__.__name__)
class CustomProcessor(QwenVLImageProcessor):
models = [Qwen2VLForConditionalGeneration]
def __init__(self, hf_config, server_args, _processor, *args, **kwargs):
super().__init__(hf_config, server_args, _processor, *args, **kwargs)
print("init custom processor:", self.__class__.__name__)
EntryClass = Qwen2VLForConditionalGeneration