repo stringclasses 454
values | file_path stringlengths 5 201 | extension stringclasses 1
value | content stringlengths 8 509k | num_lines int64 3 16.9k | size_bytes int64 8 511k |
|---|---|---|---|---|---|
sglang | python/sglang/srt/managers/scheduler_components/output_sender.py | .py | from typing import Optional, Union
import zmq
from sglang.srt.managers.io_struct import BaseBatchReq, BaseReq, sock_send
class SenderWrapper:
def __init__(self, socket: zmq.Socket):
self.socket = socket
def send_output(
self,
output: Union[BaseReq, BaseBatchReq],
recv_obj: O... | 30 | 800 |
sglang | python/sglang/srt/managers/scheduler_components/new_token_ratio_tracker.py | .py | from __future__ import annotations
from dataclasses import dataclass
from typing import TYPE_CHECKING, Sequence
from sglang.srt.environ import envs
from sglang.srt.server_args import ServerArgs
if TYPE_CHECKING:
from sglang.srt.managers.schedule_batch import Req
@dataclass(slots=True, kw_only=True)
class NewTo... | 52 | 1,629 |
sglang | python/sglang/srt/managers/scheduler_components/ipc_channels.py | .py | from dataclasses import dataclass
from typing import TYPE_CHECKING, Optional, Union
import zmq
from sglang.srt.managers.scheduler_components.output_sender import SenderWrapper
from sglang.srt.server_args import PortArgs
from sglang.srt.utils.network import get_zmq_socket
if TYPE_CHECKING:
from sglang.test.script... | 89 | 3,192 |
sglang | python/sglang/srt/managers/scheduler_components/load_inquirer.py | .py | from __future__ import annotations
import logging
import time
from dataclasses import dataclass
from typing import TYPE_CHECKING, Callable
from sglang.srt.disaggregation.utils import DisaggregationMode
from sglang.srt.managers.load_snapshot import (
DisaggregationMetrics,
LoadSnapshot,
LoRAMetrics,
Me... | 232 | 9,947 |
sglang | python/sglang/srt/managers/scheduler_components/recv_skipper.py | .py | from __future__ import annotations
from typing import TYPE_CHECKING, List, Optional
from sglang.srt.environ import envs
from sglang.srt.model_executor.forward_batch_info import ForwardMode
from sglang.srt.server_args import ServerArgs
if TYPE_CHECKING:
from sglang.srt.managers.schedule_batch import ScheduleBatch... | 71 | 2,852 |
sglang | python/sglang/srt/managers/scheduler_components/dp_attn.py | .py | from __future__ import annotations
from dataclasses import dataclass
from typing import TYPE_CHECKING, Callable, Optional
import torch
from sglang.srt.batch_overlap.two_batch_overlap import TboDPAttentionPreparer
from sglang.srt.configs.model_config import ModelConfig
from sglang.srt.distributed.parallel_state impor... | 450 | 16,834 |
sglang | python/sglang/srt/managers/scheduler_components/kv_events_publisher.py | .py | from __future__ import annotations
import time
from dataclasses import dataclass
from typing import (
TYPE_CHECKING,
Any,
Callable,
Optional,
)
import msgspec
import zmq
from sglang.srt.disaggregation.kv_events import (
EventPublisherFactory,
KVEventBatch,
select_kv_publisher_dp_rank,
)
f... | 108 | 3,333 |
sglang | python/sglang/srt/managers/scheduler_components/idle_sleeper.py | .py | from __future__ import annotations
from typing import TYPE_CHECKING
import zmq
from sglang.srt.environ import envs
from sglang.srt.observability.req_time_stats import real_time
from sglang.srt.platforms import current_platform
if TYPE_CHECKING:
from sglang.srt.managers.rust_server import RustServer
class Idle... | 69 | 2,398 |
sglang | python/sglang/srt/managers/scheduler_components/pool_stats_observer.py | .py | from __future__ import annotations
import dataclasses
from dataclasses import dataclass
from typing import (
TYPE_CHECKING,
Any,
Callable,
List,
Optional,
Tuple,
)
if TYPE_CHECKING:
from sglang.srt.mem_cache.allocator import BaseTokenToKVPoolAllocator
from sglang.srt.mem_cache.base_pre... | 322 | 12,947 |
sglang | python/sglang/srt/batch_overlap/operations.py | .py | from __future__ import annotations
from contextlib import nullcontext
from dataclasses import dataclass, replace
from typing import (
TYPE_CHECKING,
Any,
Callable,
Dict,
Generator,
List,
Optional,
Sequence,
Union,
)
from sglang.srt.layers.dp_attention import set_dp_buffer_len
from ... | 259 | 7,990 |
sglang | python/sglang/srt/batch_overlap/two_batch_overlap.py | .py | from __future__ import annotations
import copy
import dataclasses
import logging
from dataclasses import replace
from typing import TYPE_CHECKING, Dict, List, Optional, Sequence
import torch
from sglang.srt.batch_overlap.operations import (
execute_operations,
execute_overlapped_operations,
)
from sglang.srt... | 1,151 | 40,441 |
sglang | python/sglang/srt/batch_overlap/operations_strategy.py | .py | from dataclasses import dataclass
from typing import List, Optional
import torch
from sglang.srt.batch_overlap import operations
from sglang.srt.batch_overlap.operations import Operation
from sglang.srt.layers.moe.token_dispatcher import DeepEPConfig
from sglang.srt.model_executor.forward_batch_info import ForwardMod... | 379 | 13,190 |
sglang | python/sglang/srt/batch_overlap/single_batch_overlap.py | .py | # Copyright 2025 SGLang Team
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, so... | 145 | 4,810 |
sglang | python/sglang/srt/multimodal/internvl_utils.py | .py | # copy from https://huggingface.co/OpenGVLab/InternVL3-1B
import math
import torch
import torchvision.transforms as T
from PIL import Image
from torchvision.transforms.functional import InterpolationMode
IMAGENET_MEAN = (0.485, 0.456, 0.406)
IMAGENET_STD = (0.229, 0.224, 0.225)
def build_transform(
input_size,
... | 355 | 11,197 |
sglang | python/sglang/srt/multimodal/kimi_k3_vit_cuda_graph_runner.py | .py | """Bounded full-tower CUDA graph runner for Kimi K3 vision."""
from __future__ import annotations
import logging
from collections import OrderedDict
from dataclasses import dataclass
from typing import TYPE_CHECKING, Any, Hashable, List, Tuple
import torch
from sglang.srt.model_executor.runner_utils.pool import (
... | 212 | 7,548 |
sglang | python/sglang/srt/multimodal/vit_cuda_graph_runner.py | .py | # Copyright 2023-2025 SGLang Team
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... | 421 | 16,782 |
sglang | python/sglang/srt/multimodal/kimi_k3_image_processing.py | .py | import functools
import math
from dataclasses import dataclass
from typing import Literal, Optional, Union
import numpy as np
import torch
from PIL import Image
DEFERRED_PREPROCESSING_KEY = "kimi_k3_deferred_preprocessing"
@dataclass(frozen=True)
class KimiK3DeferredPreprocessing:
"""Parameters the vision-DP ow... | 286 | 10,604 |
sglang | python/sglang/srt/multimodal/mm_utils.py | .py | # Copyright 2023-2024 SGLang Team
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... | 825 | 31,888 |
sglang | python/sglang/srt/multimodal/customized_mm_processor_utils.py | .py | from typing import Dict, Type
from transformers import PretrainedConfig, ProcessorMixin
# Useful for registering a custom processor different from Hugging Face's default.
_CUSTOMIZED_MM_PROCESSOR: Dict[str, Type[ProcessorMixin]] = dict()
def register_customized_processor(
processor_class: Type[ProcessorMixin],
... | 36 | 1,127 |
sglang | python/sglang/srt/multimodal/encoder_preprocessing.py | .py | import hashlib
import inspect
from collections.abc import Mapping
from typing import Any, Callable, Iterable, Sequence
import numpy as np
import torch
from sglang.srt.managers.schedule_batch import MultimodalDataItem
LOCAL_PREPROCESSED_KEY = "encoder_local_preprocessed"
def hash_raw_encoder_item(value: Any) -> int... | 141 | 5,355 |
sglang | python/sglang/srt/multimodal/audio_from_video.py | .py | # Copyright 2025 SGLang Team
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, so... | 149 | 4,999 |
sglang | python/sglang/srt/multimodal/internvl_vit_cuda_graph_runner.py | .py | # Copyright 2023-2026 SGLang Team
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... | 189 | 6,096 |
sglang | python/sglang/srt/multimodal/evs/evs_processor.py | .py | # Copyright 2025 SGLang Team
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, so... | 133 | 4,731 |
sglang | python/sglang/srt/multimodal/evs/evs_core.py | .py | # SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
# Copyright 2025 SGLang Team
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# h... | 179 | 6,889 |
sglang | python/sglang/srt/multimodal/evs/__init__.py | .py | """https://arxiv.org/abs/2510.14624: Efficient Video Sampling: Pruning Temporally Redundant Tokens for Faster VLM Inference"""
from .evs_module import EVS, EVSConfig, EVSEmbeddingResult
from .evs_processor import EVSProcessor
__all__ = [
"EVS",
"EVSConfig",
"EVSEmbeddingResult",
"EVSProcessor",
]
| 12 | 316 |
sglang | python/sglang/srt/multimodal/evs/evs_module.py | .py | # Copyright 2025 SGLang Team
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, so... | 202 | 7,545 |
sglang | python/sglang/srt/multimodal/transport/cuda_ipc.py | .py | import logging
import threading
from typing import Any, Optional
import torch
from sglang.srt.environ import envs
from sglang.srt.multimodal.transport.memory_pool import (
DEFAULT_MAX_INFLIGHT_SLICES,
StreamOrderedMmFeaturePool,
StreamOrderedPoolConsumerMixin,
)
logger = logging.getLogger(__name__)
MM_F... | 347 | 12,816 |
sglang | python/sglang/srt/multimodal/transport/memory_pool.py | .py | """Shared stream-ordered lifecycle for GPU multimodal feature pools."""
import logging
import threading
from dataclasses import dataclass
from typing import Optional
import torch
logger = logging.getLogger(__name__)
CONTROL_WORD_BYTES = 4
DATA_ALIGNMENT = 256
DEFAULT_MAX_INFLIGHT_SLICES = 4096
def align_up(value:... | 368 | 12,748 |
sglang | python/sglang/srt/multimodal/processors/inkling.py | .py | # Copyright 2026 SGLang Team
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, so... | 317 | 13,976 |
sglang | python/sglang/srt/multimodal/processors/mimo_v2.py | .py | """MiMoV2 multimodal processor -- protocol, utilities, and processor."""
import asyncio
import base64
import copy
import json
import math
import os
import re
import subprocess
from concurrent.futures import ThreadPoolExecutor, as_completed
from dataclasses import dataclass, field
from io import BytesIO
from typing imp... | 2,288 | 93,069 |
sglang | python/sglang/srt/multimodal/processors/qwen_audio.py | .py | import re
from sglang.srt.managers.schedule_batch import (
Modality,
MultimodalDataItem,
MultimodalProcessorOutput,
)
from sglang.srt.models.qwen2_audio import Qwen2AudioForConditionalGeneration
from sglang.srt.multimodal.processors.base_processor import (
BaseMultimodalProcessor,
MultimodalSpecial... | 118 | 4,181 |
sglang | python/sglang/srt/multimodal/processors/ernie45_vl.py | .py | import math
import os
from typing import List, Union
import numpy as np
import torch
import torchvision
from PIL import Image
from torchvision.transforms import InterpolationMode
from transformers import BaseImageProcessor
from sglang.srt.environ import envs
from sglang.srt.layers.rotary_embedding import MRotaryEmbed... | 435 | 15,939 |
sglang | python/sglang/srt/multimodal/processors/lightonocr.py | .py | # Copyright 2025 SGLang Team
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, so... | 111 | 4,163 |
sglang | python/sglang/srt/multimodal/processors/midashenglm.py | .py | import logging
import re
import torch
from sglang.srt.managers.schedule_batch import Modality, MultimodalProcessorOutput
from sglang.srt.models.midashenglm import MiDashengLMModel
from sglang.srt.multimodal.processors.base_processor import (
BaseMultimodalProcessor,
MultimodalSpecialTokens,
)
logger = loggin... | 168 | 6,141 |
sglang | python/sglang/srt/multimodal/processors/mllama4.py | .py | from typing import List, Union
from sglang.srt.managers.schedule_batch import MultimodalProcessorOutput
from sglang.srt.models.mllama4 import Llama4ForConditionalGeneration
from sglang.srt.multimodal.processors.base_processor import (
BaseMultimodalProcessor,
MultimodalSpecialTokens,
)
class Mllama4ImageProc... | 51 | 1,742 |
sglang | python/sglang/srt/multimodal/processors/mlama.py | .py | from typing import List, Union
from sglang.srt.managers.schedule_batch import MultimodalProcessorOutput
from sglang.srt.models.mllama import MllamaForConditionalGeneration
from sglang.srt.multimodal.processors.base_processor import (
BaseMultimodalProcessor,
MultimodalSpecialTokens,
)
class MllamaImageProces... | 39 | 1,328 |
sglang | python/sglang/srt/multimodal/processors/clip.py | .py | from typing import List, Union
from sglang.srt.managers.schedule_batch import MultimodalProcessorOutput
from sglang.srt.models.clip import CLIPModel
from sglang.srt.multimodal.processors.base_processor import (
BaseMultimodalProcessor,
MultimodalSpecialTokens,
)
class ClipImageProcessor(BaseMultimodalProcess... | 37 | 1,155 |
sglang | python/sglang/srt/multimodal/processors/glm_image.py | .py | import logging
from typing import List, Union
import torch
from sglang.srt.managers.schedule_batch import MultimodalProcessorOutput
from sglang.srt.models.glm_image_vl import GlmImageForConditionalGeneration
logger = logging.getLogger(__name__)
from sglang.srt.multimodal.processors.base_processor import (
BaseMu... | 317 | 13,468 |
sglang | python/sglang/srt/multimodal/processors/glm4v.py | .py | from typing import List, Union
from sglang.srt.layers.rotary_embedding import MRotaryEmbedding
from sglang.srt.managers.schedule_batch import MultimodalProcessorOutput
from sglang.srt.models.glm4v import Glm4vForConditionalGeneration
from sglang.srt.models.glm4v_moe import Glm4vMoeForConditionalGeneration
from sglang.... | 124 | 4,669 |
sglang | python/sglang/srt/multimodal/processors/transformers_auto.py | .py | from typing import Optional
import torch
from sglang.srt.managers.schedule_batch import (
Modality,
MultimodalDataItem,
MultimodalProcessorOutput,
)
from sglang.srt.multimodal.processors.base_processor import (
BaseMultimodalProcessor,
MultimodalSpecialTokens,
)
from sglang.srt.utils import load_i... | 219 | 8,201 |
sglang | python/sglang/srt/multimodal/processors/dots_vlm.py | .py | import re
from typing import Dict, List, Union
from sglang.srt.managers.schedule_batch import MultimodalProcessorOutput
from sglang.srt.models.dots_ocr import DotsOCRForCausalLM
from sglang.srt.models.dots_vlm import DotsVLMForCausalLM
from sglang.srt.multimodal.processors.base_processor import (
BaseMultimodalPro... | 91 | 3,230 |
sglang | python/sglang/srt/multimodal/processors/lfm2_vl.py | .py | # Copyright 2026 Liquid AI. All rights reserved.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agre... | 86 | 3,096 |
sglang | python/sglang/srt/multimodal/processors/points_v15_chat.py | .py | # Copy from qwen_vl.py, adapted for points-v15-chat
from typing import List, Union
from sglang.srt.managers.schedule_batch import MultimodalProcessorOutput
from sglang.srt.models.points_v15_chat import POINTSV15ChatModel
from sglang.srt.multimodal.processors.qwen_vl import QwenVLImageProcessor
class POINTSV15ChatPr... | 44 | 1,360 |
sglang | python/sglang/srt/multimodal/processors/qwen3_asr.py | .py | import re
from typing import Union
import torch
from sglang.srt.managers.schedule_batch import Modality, MultimodalProcessorOutput
from sglang.srt.models.qwen3_asr import Qwen3ASRForConditionalGeneration
from sglang.srt.multimodal.processors.base_processor import (
BaseMultimodalProcessor,
MultimodalSpecialTo... | 99 | 3,426 |
sglang | python/sglang/srt/multimodal/processors/pixtral.py | .py | import math
from typing import List, Union
from transformers import PreTrainedTokenizerBase
from transformers.models.pixtral.image_processing_pixtral import (
_num_image_tokens as _get_pixtral_hf_num_image_tokens,
)
from sglang.srt.managers.schedule_batch import Modality, MultimodalProcessorOutput
from sglang.srt... | 135 | 5,000 |
sglang | python/sglang/srt/multimodal/processors/mimo_audio.py | .py | """Stateful audio preprocessing pipeline shared by MiMo multimodal and ASR processors."""
import io
import math
import os
import time
from collections import OrderedDict
from dataclasses import dataclass
from typing import Optional
import numpy as np
import pybase64
import torch
from sglang.srt.utils import common
f... | 313 | 12,040 |
sglang | python/sglang/srt/multimodal/processors/base_processor.py | .py | import asyncio
import concurrent
import concurrent.futures
import dataclasses
import multiprocessing as mp
import os
import re
from abc import ABC, abstractmethod
from typing import Any, Dict, Iterator, List, Optional, Tuple, Union
import numpy as np
import torch
from PIL import Image
from transformers import BaseImag... | 1,741 | 68,440 |
sglang | python/sglang/srt/multimodal/processors/gemma3n.py | .py | # Copyright 2025 SGLang Team
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, so... | 72 | 2,792 |
sglang | python/sglang/srt/multimodal/processors/executor.py | .py | import asyncio
import concurrent.futures
import copy
import threading
from typing import Any, Callable, TypeVar
T = TypeVar("T")
class _WorkerState(threading.local):
def __init__(self):
self.processor = None
class MultimodalProcessorExecutor:
"""Run processor calls on isolated, thread-local process... | 53 | 1,648 |
sglang | python/sglang/srt/multimodal/processors/nvila.py | .py | from typing import Any
import torch.nn as nn
from transformers.configuration_utils import PretrainedConfig
from transformers.processing_utils import ProcessorMixin
from transformers.tokenization_utils_base import PreTrainedTokenizerBase
from sglang.srt.managers.io_struct import GenerateReqInput
from sglang.srt.manage... | 81 | 2,725 |
sglang | python/sglang/srt/multimodal/processors/gemma4_unified.py | .py | # Copyright 2026 SGLang Team
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, so... | 34 | 1,574 |
sglang | python/sglang/srt/multimodal/processors/deepseek_vl_v2.py | .py | # Copyright (c) 2023-2024 DeepSeek.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the "Software"), to deal in
# the Software without restriction, including without limitation the rights to
# use, copy, modify, merge, publish, dist... | 64 | 2,575 |
sglang | python/sglang/srt/multimodal/processors/internvl.py | .py | # Adapted from https://huggingface.co/OpenGVLab/InternVL2-4B/blob/main/modeling_intern_vit.py
import logging
from functools import lru_cache
from typing import List
import numpy as np
import torch
from PIL import Image
from sglang.srt.managers.schedule_batch import (
Modality,
MultimodalDataItem,
Multimo... | 740 | 27,704 |
sglang | python/sglang/srt/multimodal/processors/locate_anything.py | .py | # SPDX-License-Identifier: Apache-2.0
import re
from typing import Dict, List, Union
from sglang.srt.managers.schedule_batch import MultimodalProcessorOutput
from sglang.srt.models.locate_anything import LocateAnythingForConditionalGeneration
from sglang.srt.multimodal.processors.base_processor import (
BaseMultim... | 57 | 2,158 |
sglang | python/sglang/srt/multimodal/processors/cohere2_vision.py | .py | # SPDX-License-Identifier: Apache-2.0
# Copyright 2026 SGLang Team
"""SGLang multimodal processor for Cohere2Vision (Command-A-Vision)."""
from typing import Dict, List, Union
from sglang.srt.managers.multimodal_processor import (
BaseMultimodalProcessor as SGLangBaseProcessor,
)
from sglang.srt.managers.schedule... | 70 | 2,680 |
sglang | python/sglang/srt/multimodal/processors/unlimited_ocr.py | .py | """Standalone UNLIMITED-OCR processor."""
import hashlib
import logging
from typing import List, Union
import torch
logger = logging.getLogger(__name__)
from sglang.srt.managers.schedule_batch import MultimodalProcessorOutput
from sglang.srt.models.unlimited_ocr import UnlimitedOCRForCausalLM
from sglang.srt.multim... | 120 | 4,386 |
sglang | python/sglang/srt/multimodal/processors/llava.py | .py | import asyncio
import os
from typing import Dict, List, Optional, Union
import numpy as np
from transformers.models.auto.processing_auto import (
PROCESSOR_MAPPING_NAMES as HF_MAPPING_NAMES,
)
import sglang.srt.managers.multimodal_processor as sgl_mm_processor_utils
from sglang.srt.managers.schedule_batch import ... | 269 | 10,427 |
sglang | python/sglang/srt/multimodal/processors/phi4mm.py | .py | import logging
from typing import List, Union
from transformers.processing_utils import ProcessorMixin
from sglang.srt.managers.schedule_batch import MultimodalProcessorOutput
from sglang.srt.models.phi4mm import Phi4MMForCausalLM
from sglang.srt.multimodal.processors.base_processor import (
BaseMultimodalProcess... | 102 | 3,873 |
sglang | python/sglang/srt/multimodal/processors/qwen_vl.py | .py | import math
import os
import re
import time
from typing import List, Optional, Union
import numpy as np
import torch
import torchvision
from PIL import Image
from torchvision.transforms import InterpolationMode
from sglang.srt.environ import envs
from sglang.srt.layers.rotary_embedding import MRotaryEmbedding
from sg... | 907 | 35,295 |
sglang | python/sglang/srt/multimodal/processors/paddleocr_vlm.py | .py | # Reference: ccr-2vdh3abv-pub.cnc.bj.baidubce.com/paddlepaddle/paddleocr-genai-vllm-server:latest
# Copyright (c) 2025 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy... | 31 | 1,470 |
sglang | python/sglang/srt/multimodal/processors/kimi_common.py | .py | """Kimi-specific grid-based multimodal data helpers.
Shared by KimiVLImageProcessor and KimiK2_5VLImageProcessor.
"""
from typing import Optional, Union
import numpy as np
import torch
from sglang.srt.managers.schedule_batch import (
Modality,
MultimodalDataItem,
MultimodalProcessorOutput,
)
class Kim... | 145 | 4,732 |
sglang | python/sglang/srt/multimodal/processors/glmasr.py | .py | import re
from sglang.srt.managers.schedule_batch import MultimodalProcessorOutput
from sglang.srt.models.glmasr import GlmAsrForConditionalGeneration
from sglang.srt.multimodal.processors.base_processor import (
BaseMultimodalProcessor,
MultimodalSpecialTokens,
)
class GlmAsrProcessor(BaseMultimodalProcesso... | 55 | 1,983 |
sglang | python/sglang/srt/multimodal/processors/voxtral.py | .py | """Multimodal processor for Voxtral (speech-to-text) models."""
import math
import re
from typing import Dict, List, Optional
import torch
from sglang.srt.managers.schedule_batch import (
Modality,
MultimodalDataItem,
MultimodalProcessorOutput,
)
from sglang.srt.models.voxtral import VoxtralForConditiona... | 218 | 8,318 |
sglang | python/sglang/srt/multimodal/processors/minicpmv4_6.py | .py | # Copyright 2026 The SGLang team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
"""sglang multimodal processor for MiniCPM-V 4.6.
Ports p... | 549 | 21,091 |
sglang | python/sglang/srt/multimodal/processors/janus_pro.py | .py | from typing import List, Union
from sglang.srt.managers.schedule_batch import MultimodalProcessorOutput
from sglang.srt.models.deepseek_janus_pro import MultiModalityCausalLM
from sglang.srt.multimodal.processors.base_processor import (
BaseMultimodalProcessor,
MultimodalSpecialTokens,
)
class JanusProImageP... | 46 | 1,484 |
sglang | python/sglang/srt/multimodal/processors/gemma4.py | .py | # Copyright 2025 SGLang Team
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, so... | 159 | 6,495 |
sglang | python/sglang/srt/multimodal/processors/mimo_v2_asr.py | .py | """MiMo-V2-ASR multimodal processor.
Audio preprocessing is delegated to :class:`MiMoAudioPipeline`; this
processor only handles the special-token contract and content interleaving.
"""
import asyncio
import re
from dataclasses import dataclass
from typing import List, Literal, Union
import numpy as np
import torch
... | 287 | 10,785 |
sglang | python/sglang/srt/multimodal/processors/step3_vl.py | .py | import math
import re
from itertools import product
from typing import List, Optional, Union
import numpy as np
import torch
from PIL import Image
from torchvision import transforms
from torchvision.transforms import InterpolationMode
from torchvision.transforms import functional as F
from transformers import BatchFea... | 575 | 20,919 |
sglang | python/sglang/srt/multimodal/processors/deepseek_ocr.py | .py | from typing import List, Union
from sglang.srt.managers.schedule_batch import MultimodalProcessorOutput
from sglang.srt.models.deepseek_ocr import DeepseekOCRForCausalLM
from sglang.srt.multimodal.processors.base_processor import (
BaseMultimodalProcessor,
MultimodalSpecialTokens,
)
class DeepseekOCRProcesso... | 47 | 1,634 |
sglang | python/sglang/srt/multimodal/processors/sarashina2_vision.py | .py | from typing import List, Union
from sglang.srt.managers.schedule_batch import MultimodalProcessorOutput
from sglang.srt.models.sarashina2_vision import Sarashina2VisionForCausalLM
from sglang.srt.multimodal.processors.base_processor import (
BaseMultimodalProcessor,
MultimodalSpecialTokens,
)
class Sarashina... | 83 | 3,113 |
sglang | python/sglang/srt/multimodal/processors/gemma3.py | .py | import re
from typing import Dict, List, Union
from sglang.srt.managers.multimodal_processor import (
BaseMultimodalProcessor as SGLangBaseProcessor,
)
from sglang.srt.managers.schedule_batch import MultimodalProcessorOutput
from sglang.srt.models.gemma3_mm import Gemma3ForConditionalGeneration
from sglang.srt.mul... | 56 | 2,078 |
sglang | python/sglang/srt/multimodal/processors/interns1pro.py | .py | import time
from typing import List, Union
from sglang.srt.managers.schedule_batch import (
Modality,
MultimodalDataItem,
MultimodalProcessorOutput,
)
from sglang.srt.models.interns1pro import InternS1ProForConditionalGeneration
from sglang.srt.multimodal.processors.qwen_vl import (
QwenVLImageProcesso... | 123 | 4,198 |
sglang | python/sglang/srt/multimodal/processors/whisper.py | .py | import logging
from typing import Any, Dict, Optional
from sglang.srt.entrypoints.openai.transcription_adapters.whisper import (
FUSED_AUTODETECT_FLAG,
)
from sglang.srt.managers.schedule_batch import (
Modality,
MultimodalDataItem,
MultimodalProcessorOutput,
)
from sglang.srt.models.whisper import Whi... | 256 | 9,200 |
sglang | python/sglang/srt/multimodal/processors/minimax_m3_vl.py | .py | # Copyright 2023-2024 SGLang Team
# Licensed under the Apache License, Version 2.0 (the "License");
"""HF processor classes live in sglang.srt.configs.minimax_vl_processor to avoid circular imports with model classes."""
import math
import re
from typing import Dict, List, Optional, Tuple, Union
import torch
import t... | 284 | 10,030 |
sglang | python/sglang/srt/multimodal/processors/nano_nemotron_vl.py | .py | # Copyright 2025 SGLang Team
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, so... | 510 | 21,139 |
sglang | python/sglang/srt/multimodal/processors/moss_vl.py | .py | import asyncio
import os
import re
import tempfile
from typing import Dict, List, Optional, Tuple, Union
from urllib.parse import unquote, urlparse
import pybase64
import torch
from sglang.srt.managers.schedule_batch import (
Modality,
MultimodalDataItem,
MultimodalProcessorOutput,
)
from sglang.srt.model... | 577 | 21,761 |
sglang | python/sglang/srt/multimodal/processors/minicpm.py | .py | from typing import List, Union
import torch
from sglang.srt.managers.schedule_batch import (
Modality,
MultimodalDataItem,
MultimodalProcessorOutput,
)
from sglang.srt.models.minicpmo import MiniCPMO
from sglang.srt.models.minicpmv import MiniCPMV
from sglang.srt.multimodal.processors.base_processor impor... | 306 | 12,293 |
sglang | python/sglang/srt/multimodal/processors/muse_glimmer.py | .py | # Copyright 2023-2026 SGLang Team
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... | 62 | 2,272 |
sglang | python/sglang/srt/multimodal/processors/kimi_vl.py | .py | import re
from typing import Dict, List, Union
from sglang.srt.managers.schedule_batch import MultimodalProcessorOutput
from sglang.srt.models.kimi_vl import KimiVLForConditionalGeneration
from sglang.srt.multimodal.processors.base_processor import (
BaseMultimodalProcessor as SGLangBaseProcessor,
)
from sglang.sr... | 67 | 2,505 |
sglang | python/sglang/srt/multimodal/processors/kimi_k3.py | .py | """Kimi K3 multimodal processor.
GPU image preprocessing dedicated to K3: unlike the K2.5 wrapper it keeps
the alpha channel through the bicubic resize and then composites RGBA
images onto the checkpoint-configured background
(``transparent_bg_config`` with ``transparent_bg_fill_stage ==
"after_resize"`` in preprocess... | 527 | 20,109 |
sglang | python/sglang/srt/multimodal/processors/kimi_k25.py | .py | import math
import re
from collections import defaultdict
from typing import Callable, Dict, List, Optional, Union
import numpy as np
import torch
import torch.nn.functional as F
from PIL import Image
from sglang.kernels.ops.mm.process import normalize_and_patchify
from sglang.srt.managers.schedule_batch import (
... | 618 | 24,570 |
sglang | python/sglang/srt/multimodal/inkling/processing_inkling.py | .py | # Copyright 2026 SGLang Team
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, so... | 52 | 2,071 |
sglang | python/sglang/srt/multimodal/inkling/__init__.py | .py | # Copyright 2026 SGLang Team
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, so... | 29 | 1,145 |
sglang | python/sglang/srt/multimodal/inkling/feature_extraction.py | .py | """HuggingFace audio feature extractor for Inkling models."""
from __future__ import annotations
import io
import math
from dataclasses import dataclass
from typing import Dict, Optional, Sequence, Tuple
import numpy as np
import soundfile as sf
import torch
import torch.nn.functional as F
import torchaudio.function... | 234 | 8,014 |
sglang | python/sglang/srt/multimodal/inkling/image_processing_rust.py | .py | from __future__ import annotations
import io
from concurrent.futures import ThreadPoolExecutor
from typing import List, Optional, Union
import numpy as np
import torch
from PIL import Image
from transformers.image_processing_utils import BaseImageProcessor, BatchFeature
from transformers.image_utils import ImageInput... | 102 | 3,259 |
sglang | python/sglang/srt/multimodal/inkling/image_processing.py | .py | """HuggingFace-convention image processor for Inkling models."""
from __future__ import annotations
import io
import math
from typing import List, Optional, Union
import numpy as np
import torch
from numba import njit
from transformers.image_processing_utils import BaseImageProcessor, BatchFeature
from transformers.... | 253 | 8,742 |
sglang | python/sglang/srt/multimodal/cache/__init__.py | .py | """Content-addressed caches used by multimodal preprocessing."""
from sglang.srt.multimodal.cache.identity import (
CONTENT_HASH_PREFIX,
MediaSnapshot,
build_artifact_key,
build_feature_hash,
build_processor_fingerprint,
parse_content_hash,
snapshot_media,
)
from sglang.srt.multimodal.cache... | 30 | 711 |
sglang | python/sglang/srt/multimodal/cache/preprocess_cache.py | .py | """Bounded CPU cache and single-flight coordination for MM preprocessing."""
from __future__ import annotations
import asyncio
import concurrent.futures
import dataclasses
import sys
import threading
from collections import OrderedDict
from dataclasses import dataclass
from typing import Any, Awaitable, Callable, Gen... | 260 | 8,738 |
sglang | python/sglang/srt/multimodal/cache/identity.py | .py | """Stable identities for multimodal inputs and processor artifacts."""
from __future__ import annotations
import dataclasses
import hashlib
import json
import struct
from dataclasses import dataclass
from enum import Enum
from pathlib import Path
from typing import Any, Mapping, Optional
from urllib.parse import unqu... | 330 | 11,367 |
sglang | python/sglang/srt/arg_groups/hisparse_hook.py | .py | from __future__ import annotations
import logging
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from sglang.srt.server_args import ServerArgs
logger = logging.getLogger(__name__)
HISPARSE_CUDA_DSA_BACKENDS_BY_DTYPE = {
"bfloat16": {"flashmla_sparse"},
"fp8_e4m3": {"flashmla_kv", "flashinfer_sparse_... | 137 | 4,928 |
sglang | python/sglang/srt/arg_groups/overrides.py | .py | # Copyright 2023-2026 SGLang Team
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... | 2,714 | 113,451 |
sglang | python/sglang/srt/arg_groups/arg_utils.py | .py | # Copyright 2023-2024 SGLang Team
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... | 338 | 11,993 |
sglang | python/sglang/srt/arg_groups/argparse_actions.py | .py | import argparse
import json
import logging
logger = logging.getLogger(__name__)
class LoRAPathAction(argparse.Action):
def __call__(self, parser, namespace, values, option_string=None):
lora_paths = []
if values:
assert isinstance(values, list), "Expected a list of LoRA paths."
... | 111 | 3,951 |
sglang | python/sglang/srt/arg_groups/deepseek_v4_hook.py | .py | from __future__ import annotations
import logging
from typing import TYPE_CHECKING
from sglang.srt.environ import envs
if TYPE_CHECKING:
from sglang.srt.server_args import ServerArgs
logger = logging.getLogger(__name__)
def validate_deepseek_v4_mega_moe_token_budget(
server_args: ServerArgs,
) -> None:
... | 197 | 8,124 |
sglang | python/sglang/srt/arg_groups/speculative_hook.py | .py | from __future__ import annotations
import json
import logging
import os
from typing import TYPE_CHECKING, Optional
if TYPE_CHECKING:
from sglang.srt.server_args import ServerArgs
logger = logging.getLogger(__name__)
def _disable_overlap_schedule_for_cpu(server_args: ServerArgs) -> None:
if server_args.devi... | 844 | 34,384 |
sglang | python/sglang/srt/arg_groups/pd_disaggregation_hook.py | .py | from __future__ import annotations
import dataclasses
import logging
import os
from typing import TYPE_CHECKING
from sglang.srt.environ import envs
if TYPE_CHECKING:
from sglang.srt.server_args import ServerArgs
logger = logging.getLogger(__name__)
def handle_pd_disaggregation(server_args: ServerArgs) -> None... | 151 | 6,904 |
sglang | python/sglang/srt/arg_groups/kimi_k3_hook.py | .py | from __future__ import annotations
import logging
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from sglang.srt.server_args import ServerArgs
logger = logging.getLogger(__name__)
def apply_kimi_k3_spec_backend_defaults(server_args: ServerArgs) -> None:
"""Apply speculative backend defaults for Kimi hy... | 104 | 4,288 |
sglang | python/sglang/srt/models/glm_image_vl.py | .py | # Adapted from
# https://github.com/huggingface/transformers/blob/main/src/transformers/models/glm_image/modeling_glm_image.py
# Copyright 2025 The ZhipuAI Team.
# Copyright 2025 The HuggingFace Team.
# Copyright 2026 SGLang Team.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this ... | 1,207 | 44,211 |
sglang | python/sglang/srt/models/gemma3_mm.py | .py | # SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
# Copyright 2025 SGLang Team
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# h... | 504 | 20,904 |
sglang | python/sglang/srt/models/minimax_m2.py | .py | # Copyright 2023-2024 SGLang Team
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... | 1,452 | 51,337 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.