Fix external_models import path and migrate model loading tests (#16458)
This commit is contained in:
@@ -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)
|
||||
|
||||
21
python/sglang/test/external_models/custom_qwen2_vl.py
Normal file
21
python/sglang/test/external_models/custom_qwen2_vl.py
Normal 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
|
||||
Reference in New Issue
Block a user