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/models/qwen2_eagle.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 writing, softwar... | 148 | 4,885 |
sglang | python/sglang/srt/models/minicpmv.py | .py | # Adapted from
# https://github.com/huggingface/transformers/blob/v4.28.0/src/transformers/models/llama/modeling_llama.py
# Copyright 2023 The SGLang team.
# Copyright 2022 EleutherAI and the HuggingFace Inc. team. All rights reserved.
#
# This code is based on EleutherAI's GPT-NeoX library and the GPT-NeoX
# and OPT i... | 1,765 | 62,392 |
sglang | python/sglang/srt/models/sarvam_moe.py | .py | """Inference-only Sarvam MoE models for SGLang.
- SarvamMLAForCausalLM (105B)
- SarvamMoEForCausalLM (30B)
"""
import math
from enum import IntEnum, auto
from typing import Any, Dict, Iterable, Optional, Tuple
import torch
import torch.nn.functional as F
from torch import nn
from transformers import PretrainedConfig
... | 1,509 | 55,169 |
sglang | python/sglang/srt/models/kimi_k3.py | .py | # Kimi-K3 multimodal model: KimiLinear text backbone + MoonViT3d vision tower.
# Based on kimi_linear.py with K3-specific features:
# - Attention Residual (attn_res_block_size)
# - Latent MoE (routed_expert_hidden_size)
# - SiTU activation
# - MLA output gate (mla_use_output_gate)
# - Full-rank KDA gate (use_... | 3,443 | 150,542 |
sglang | python/sglang/srt/models/llavavid.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... | 292 | 13,114 |
sglang | python/sglang/srt/models/mimo_vl.py | .py | """Inference-only MiMo vision model: attention + ViT."""
from __future__ import annotations
from functools import partial
from typing import Optional, Tuple, Type
import torch
import torch.nn as nn
import torch.nn.functional as F
from einops import rearrange
from transformers.configuration_utils import PretrainedCon... | 530 | 18,857 |
sglang | python/sglang/srt/models/mixtral_quant.py | .py | # SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
# 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
#
# ... | 432 | 15,441 |
sglang | python/sglang/srt/models/idefics2.py | .py | # Copyright 2023 The SGLang team.
# Copyright 2022 EleutherAI and the HuggingFace Inc. team. All rights reserved.
#
# This code is based on EleutherAI's GPT-NeoX library and the GPT-NeoX
# and OPT implementations in this library. It has been modified from its
# original forms to accommodate minor architectural differen... | 364 | 12,919 |
sglang | python/sglang/srt/models/qwen2_rm.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... | 93 | 3,185 |
sglang | python/sglang/srt/models/interns2_mobius.py | .py | """Inference-only Intern-S2-Mobius model."""
import logging
from collections.abc import Iterable
import torch
from torch import nn
from sglang.srt.configs.interns2_mobius import (
InternS2MobiusConfig,
InternS2MobiusTextConfig,
)
from sglang.srt.distributed import get_pp_group, tensor_model_parallel_all_redu... | 820 | 31,353 |
sglang | python/sglang/srt/models/commandr.py | .py | # SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
# Adapted from https://github.com/vllm-project/vllm/blob/main/vllm/model_executor/models/commandr.py
# Copyright 2023-2024 SGLang Team
# Licensed under the Apache License, Version 2.0 (the "License");
# you may n... | 434 | 16,117 |
sglang | python/sglang/srt/models/gemma3n_causal.py | .py | from typing import Iterable, Optional, Set, Tuple
import torch
import torch.nn.functional as F
from torch import nn
from transformers import AutoModel, Gemma3nTextConfig, PretrainedConfig, PreTrainedModel
from sglang.srt.layers.activation import GeluAndMul
from sglang.srt.layers.layernorm import RMSNorm
from sglang.s... | 1,017 | 36,632 |
sglang | python/sglang/srt/models/kimi_k25.py | .py | import logging
from copy import deepcopy
from typing import Iterable, List, Optional, Sequence, Tuple
import numpy as np
import torch
import torch.nn.functional as F
from torch import nn
from transformers.activations import PytorchGELUTanh
from sglang.kernels.ops.attention.vision_rope import (
PreparedInplaceComp... | 987 | 36,410 |
sglang | python/sglang/srt/models/inkling_common/moe.py | .py | from __future__ import annotations
from typing import Literal, cast
import torch
import torch.nn.functional as F
import triton
import triton.language as tl
from torch import nn
from triton.language.extra import libdevice
from sglang.kernels.jit.utils import is_arch_support_pdl
from sglang.kernels.ops.moe.gate_topk i... | 1,098 | 44,397 |
sglang | python/sglang/srt/models/inkling_common/norm.py | .py | from __future__ import annotations
import torch
import torch.nn.functional as F
from torch import nn
try:
from sgl_kernel import rmsnorm
except ImportError:
rmsnorm = None
class RMSNorm(nn.Module):
def __init__(self, hidden_size: int, eps: float = 1e-6) -> None:
super().__init__()
self.w... | 41 | 1,281 |
sglang | python/sglang/srt/models/inkling_common/hmlp.py | .py | from __future__ import annotations
from typing import cast
import numpy as np
import torch
from torch import nn
from torch.nn import functional as F
from sglang.srt.configs.inkling import InklingVisionConfig
from sglang.srt.models.inkling_common.norm import RMSNorm
def _prime_factors(n: int) -> list[int]:
"""R... | 185 | 5,749 |
sglang | python/sglang/srt/models/inkling_common/sconv.py | .py | from enum import IntEnum
import torch
import torch.nn as nn
import triton
import triton.language as tl
from einops import rearrange
from torch.nn.parameter import Parameter
from sglang.srt.model_executor.forward_batch_info import ForwardBatch
from sglang.srt.model_executor.forward_context import get_attn_backend
from... | 782 | 29,887 |
sglang | python/sglang/srt/models/inkling_common/dense_mlp.py | .py | import logging
from enum import Enum
import torch
from torch import nn
from torch.nn import functional as F
from sglang.srt.layers.moe.moe_runner.base import MoeRunnerConfig
from sglang.srt.layers.quantization.base_config import QuantizationConfig
from sglang.srt.layers.quantization.unquant import UnquantizedFusedMoE... | 523 | 19,888 |
sglang | python/sglang/srt/models/inkling_common/util.py | .py | from __future__ import annotations
import abc
import torch
from torch import nn
from sglang.srt.layers.moe.fused_moe_triton.layer import FusedMoE
from sglang.srt.layers.moe.moe_runner.base import MoeRunnerConfig
from sglang.srt.layers.quantization.base_config import QuantizationConfig
from sglang.srt.layers.quantiza... | 118 | 3,962 |
sglang | python/sglang/srt/models/inkling_common/lora.py | .py | from __future__ import annotations
import torch
from sglang.srt.lora.backend.base_backend import BaseLoRABackend
from sglang.srt.models.inkling_common.dense_mlp import InklingBatchDenseMLP
class InklingBatchDenseMLPWithLoRA(InklingBatchDenseMLP):
"""LoRA layer for Inkling's dense shared-expert sink."""
is_... | 244 | 9,880 |
sglang | python/sglang/srt/models/inkling_common/attn.py | .py | from __future__ import annotations
from collections.abc import Callable
from functools import cache
import torch
from torch import nn
from sglang.kernels.ops.attention.inkling_rel_proj import rel_proj_small_t
from sglang.kernels.ops.attention.inkling_row_scale import row_compact_bf16
from sglang.kernels.ops.attentio... | 1,023 | 42,460 |
sglang | python/sglang/srt/models/inkling_common/quantization/quant.py | .py | from __future__ import annotations
import logging
from typing import TYPE_CHECKING
import torch
from sglang.srt.layers.moe import MoeRunner, MoeRunnerConfig
from sglang.srt.layers.quantization.base_config import FusedMoEMethodBase
from sglang.srt.utils import ceil_div, set_weight_attrs
if TYPE_CHECKING:
from sg... | 166 | 6,180 |
sglang | python/sglang/srt/models/inkling_common/quantization/__init__.py | .py | from sglang.srt.models.inkling_common.quantization.config import (
InklingModelOptNvfp4Config,
InklingQuantizationConfigBase,
get_quantization_config,
)
from sglang.srt.models.inkling_common.quantization.quant import (
InklingMoEMethodBase,
InklingNvfp4MoEMethod,
)
__all__ = [
"InklingModelOptN... | 18 | 460 |
sglang | python/sglang/srt/models/inkling_common/quantization/config.py | .py | from __future__ import annotations
import json
import logging
import os
from typing import Any
import huggingface_hub
import torch
from huggingface_hub import snapshot_download
from sglang.srt.configs.model_config import ModelConfig
from sglang.srt.layers.quantization.base_config import (
QuantizationConfig,
... | 273 | 10,648 |
sglang | python/sglang/srt/models/inkling_common/kernels/sconv.py | .py | from typing import TypedDict
import torch
import triton
import triton.language as tl
from sglang.srt.utils import is_cuda
PAD_SLOT_ID = -1
class SconvDecodeMetadata(TypedDict):
cache_mask: torch.Tensor
safe_idx: torch.Tensor
cu: torch.Tensor
si: torch.Tensor
class SconvExtendMetadata(TypedDict):
... | 1,212 | 45,328 |
sglang | python/sglang/srt/models/inkling_common/kernels/comm.py | .py | from __future__ import annotations
import functools
from typing import TYPE_CHECKING
import msgspec
import torch
from sglang.srt.environ import envs
from sglang.srt.runtime_context import get_exec
from sglang.srt.utils import is_cuda
if TYPE_CHECKING:
from sglang.srt.distributed.parallel_state import GroupCoord... | 1,201 | 46,538 |
sglang | python/sglang/srt/models/deepseek_common/attention_backend_handler.py | .py | from sglang.srt.layers.attention.tbo_backend import TboAttnBackend
from sglang.srt.layers.utils.cp_utils import mla_use_prefill_cp
from sglang.srt.model_executor.forward_context import get_attn_backend
from sglang.srt.model_executor.runner_backend_utils.breakable_cuda_graph import (
is_in_breakable_cuda_graph,
)
fr... | 248 | 9,758 |
sglang | python/sglang/srt/models/deepseek_common/utils.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... | 168 | 5,322 |
sglang | python/sglang/srt/models/deepseek_common/deepseek_weight_loader.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... | 806 | 35,271 |
sglang | python/sglang/srt/models/deepseek_common/attention_forward_methods/forward_mha_rocm.py | .py | """AMD/ROCm multi-head attention forward path for DeepSeek models.
`AttnForwardMethod.MHA_ROCM` and `AttnForwardMethod.MHA_ONE_SHOT_ROCM` route
here, which keeps every AITER/gfx95 kernel choice out of the shared
`forward_mha.py`. Only the prepare step is platform specific; the attention
cores in `DeepseekMHAForwardMix... | 323 | 13,026 |
sglang | python/sglang/srt/models/deepseek_common/attention_forward_methods/forward_mla.py | .py | from __future__ import annotations
import logging
from dataclasses import dataclass
from typing import TYPE_CHECKING, Optional
import torch
from sglang.kernels.ops.kvcache.cache_ops import absorbed_bmm_concat_cast_q_fp8
from sglang.kernels.ops.quantization.fp8_kernel import (
per_tensor_quant_mla_fp8,
per_to... | 971 | 39,520 |
sglang | python/sglang/srt/models/deepseek_common/attention_forward_methods/forward_mla_rocm.py | .py | """AMD/ROCm absorbed multi-latent attention forward path for DeepSeek models.
`AttnForwardMethod.MLA_ROCM` routes here, which keeps every AITER/gfx95 kernel
choice out of the shared `forward_mla.py` and lets non-AMD builds avoid
importing `aiter` altogether.
The BMM absorb steps stay module level to keep ROCm kernel ... | 851 | 33,545 |
sglang | python/sglang/srt/models/deepseek_common/attention_forward_methods/__init__.py | .py | from .forward_methods import AttnForwardMethod
from .forward_mha import DeepseekMHAForwardMixin
from .forward_mha_rocm import DeepseekMHARocmForwardMixin
from .forward_mla import DeepseekMLAForwardMixin
from .forward_mla_fused_rope_cpu import DeepseekMLACpuForwardMixin
from .forward_mla_fused_rope_rocm import DeepseekM... | 18 | 656 |
sglang | python/sglang/srt/models/deepseek_common/attention_forward_methods/forward_mha.py | .py | from __future__ import annotations
from typing import TYPE_CHECKING
import torch
from sglang.kernels.ops.attention.dsa.dequant_k_cache import dequantize_k_cache_paged
from sglang.kernels.ops.attention.utils import concat_and_cast_mha_k_triton
from sglang.srt.environ import envs
from sglang.srt.layers.attention.tbo_b... | 548 | 22,426 |
sglang | python/sglang/srt/models/deepseek_common/attention_forward_methods/forward_mla_fused_rope_cpu.py | .py | from __future__ import annotations
from typing import TYPE_CHECKING
import torch
from sglang.srt.layers.amx_utils import PackWeightMethod
from sglang.srt.model_executor.forward_batch_info import ForwardBatch
from sglang.srt.models.deepseek_common.utils import (
_is_cpu,
_is_cpu_amx_available,
)
from sglang.s... | 154 | 6,000 |
sglang | python/sglang/srt/models/deepseek_common/attention_forward_methods/forward_mla_fused_rope_rocm.py | .py | from __future__ import annotations
import os
from typing import TYPE_CHECKING
import torch
from sglang.kernels.ops.quantization.fp8_kernel import per_tensor_quant_mla_fp8
from sglang.srt.model_executor.forward_batch_info import ForwardBatch
from sglang.srt.model_executor.forward_context import (
get_attn_backend... | 230 | 7,925 |
sglang | python/sglang/srt/models/deepseek_common/attention_forward_methods/forward_methods.py | .py | from enum import IntEnum, auto
class AttnForwardMethod(IntEnum):
# Use multi-head attention
MHA = auto()
# Use absorbed multi-latent attention
MLA = auto()
# Use multi-head attention, but with KV cache chunked.
# This method can avoid OOM when prefix lengths are long.
MHA_CHUNKED_KV = au... | 42 | 1,084 |
sglang | python/sglang/srt/models/deepseek_common/amd/deepseek_v4_fused_mhc.py | .py | import logging
from typing import Optional, Tuple
import torch
import triton
from sglang.srt.environ import envs
logger = logging.getLogger(__name__)
_FUSED_HC_POST_PRE_M_THRESHOLD = 64
_FUSED_HC_POST_PRE_CACHE: dict[tuple, dict[str, torch.Tensor]] = {}
_TRITON_MHC_POST_PRE_OPS = None
_TRITON_MHC_POST_PRE_RUNTIME_D... | 159 | 4,795 |
sglang | python/sglang/srt/elastic_ep/expert_backup_client.py | .py | import logging
import re
import threading
import time
from typing import Any, Callable
import torch
import zmq
from sglang.srt.distributed.parallel_state import (
get_world_group,
get_world_size,
)
from sglang.srt.environ import envs
from sglang.srt.eplb.expert_location import get_global_expert_location_metad... | 182 | 7,216 |
sglang | python/sglang/srt/elastic_ep/elastic_ep.py | .py | from __future__ import annotations
import logging
import time
from dataclasses import dataclass
from typing import TYPE_CHECKING, Callable, Iterator, List, Optional
import torch
from sglang.srt.distributed import get_world_group, parallel_state
from sglang.srt.distributed.utils import get_global_tcp_store
from sglan... | 521 | 17,263 |
sglang | python/sglang/srt/elastic_ep/expert_backup_manager.py | .py | import logging
import multiprocessing as mp
import re
import signal
import torch
import zmq
from sglang.srt.configs.load_config import LoadConfig
from sglang.srt.configs.model_config import ModelConfig
from sglang.srt.environ import envs
from sglang.srt.managers.io_struct import (
BackupDramReq,
ExpertWeightP... | 187 | 6,779 |
sglang | python/sglang/srt/configs/inkling.py | .py | from __future__ import annotations
from dataclasses import dataclass, field
from typing import Any, Literal, Optional
import torch
from transformers import CONFIG_MAPPING
from transformers.configuration_utils import PretrainedConfig
from sglang.srt.configs.mamba_utils import BaseLinearStateParams
from sglang.srt.run... | 432 | 16,371 |
sglang | python/sglang/srt/configs/qwen3_vl.py | .py | from transformers import PretrainedConfig
class Qwen3VLVisionConfig(PretrainedConfig):
model_type = "qwen3_vl"
base_config_key = "vision_config"
def __init__(
self,
depth=27,
hidden_size=1152,
hidden_act="gelu_pytorch_tanh",
intermediate_size=4304,
num_head... | 572 | 28,606 |
sglang | python/sglang/srt/configs/embedding_model_spec.py | .py | """Embedding-model capabilities resolved from model architecture and server intent.
This module is deliberately declarative. Server-argument resolution, model
implementations, documentation, and benchmarks can consume the same contract
without each reimplementing a partial list of embedding architectures.
"""
from d... | 345 | 11,850 |
sglang | python/sglang/srt/configs/radio.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... | 121 | 5,087 |
sglang | python/sglang/srt/configs/jet_nemotron.py | .py | from dataclasses import dataclass
from typing import Any
from transformers.configuration_utils import PretrainedConfig
from sglang.srt.configs.mamba_utils import (
Mamba2CacheParams,
Mamba2StateShape,
mamba2_state_dtype,
)
from sglang.srt.runtime_context import get_parallel
@dataclass
class JetBlockConf... | 81 | 2,253 |
sglang | python/sglang/srt/configs/cohere2_moe.py | .py | # SPDX-License-Identifier: Apache-2.0
"""Cohere2Moe text config used by the Cohere Command-A Plus checkpoints."""
from transformers.configuration_utils import PreTrainedConfig
from transformers.models.auto.configuration_auto import CONFIG_MAPPING
class Cohere2MoeConfig(PreTrainedConfig):
model_type = "cohere2_mo... | 124 | 4,755 |
sglang | python/sglang/srt/configs/dots_ocr.py | .py | from typing import Optional
from transformers import AutoProcessor, Qwen2_5_VLProcessor
from transformers.image_processing_utils import BaseImageProcessor
from transformers.models.qwen2 import Qwen2Config
from sglang.srt.configs.dots_vlm import DotsVisionConfig
class DotsOCRConfig(Qwen2Config):
model_type = "do... | 65 | 1,865 |
sglang | python/sglang/srt/configs/utils.py | .py | from typing import Type
from transformers import (
AutoImageProcessor,
AutoProcessor,
BaseImageProcessor,
PretrainedConfig,
ProcessorMixin,
)
def register_image_processor(
config: Type[PretrainedConfig], image_processor: Type[BaseImageProcessor]
):
"""
register customized hf image pro... | 28 | 699 |
sglang | python/sglang/srt/configs/qwen3_5.py | .py | from transformers import PretrainedConfig
from sglang.srt.configs.qwen3_next import Qwen3NextConfig
from sglang.srt.configs.qwen3_vl import Qwen3VLVisionConfig
class Qwen3_5VisionConfig(Qwen3VLVisionConfig):
model_type = "qwen3_5"
base_config_key = "vision_config"
def __init__(self, **kwargs):
s... | 139 | 5,186 |
sglang | python/sglang/srt/configs/laguna.py | .py | # coding=utf-8
# 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
"""Laguna (poolside/Laguna-XS.2) model conf... | 243 | 9,954 |
sglang | python/sglang/srt/configs/minimax_vl.py | .py | # SPDX-License-Identifier: Apache-2.0
from typing import Optional
from transformers.configuration_utils import PretrainedConfig
from transformers.models.auto import CONFIG_MAPPING
def _coerce_sub_config(
sub_config: Optional[dict], default_model_type: str
) -> Optional[PretrainedConfig]:
"""Convert a config... | 61 | 2,286 |
sglang | python/sglang/srt/configs/olmo3.py | .py | # coding=utf-8
# Copyright 2024 The Qwen team, Alibaba Group and the HuggingFace Inc. team. 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/... | 104 | 3,495 |
sglang | python/sglang/srt/configs/dots_vlm.py | .py | from transformers import AutoProcessor, PretrainedConfig
from transformers.processing_utils import ProcessingKwargs
try:
from transformers import Qwen2_5_VLProcessor
except ImportError:
raise ImportError(
"Qwen2_5_VLProcessor can not be found. Please upgrade your transformers version."
)
from sgla... | 135 | 4,912 |
sglang | python/sglang/srt/configs/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... | 110 | 4,299 |
sglang | python/sglang/srt/configs/afmoe.py | .py | from typing import List, Optional
from transformers import PretrainedConfig
class AfmoeConfig(PretrainedConfig):
model_type = "afmoe"
def __init__(
self,
vocab_size: int = 32000,
hidden_size: int = 4096,
intermediate_size: int = 11008,
moe_intermediate_size: int = 256... | 103 | 3,494 |
sglang | python/sglang/srt/configs/points_v15_chat.py | .py | from typing import Optional, Union
from transformers import PretrainedConfig, Qwen2Config
from transformers.models.qwen2_vl.configuration_qwen2_vl import Qwen2VLVisionConfig
class POINTSV15ChatConfig(PretrainedConfig):
model_type = "pointsv1.5_chat"
def __init__(
self,
vision_config: Optiona... | 30 | 983 |
sglang | python/sglang/srt/configs/qwen3_asr.py | .py | import torch
from transformers import (
AutoConfig,
AutoFeatureExtractor,
AutoTokenizer,
PretrainedConfig,
ProcessorMixin,
)
from sglang.srt.configs.qwen3_omni import Qwen3OmniMoeAudioEncoderConfig
from sglang.srt.multimodal.customized_mm_processor_utils import (
register_customized_processor,
... | 169 | 6,490 |
sglang | python/sglang/srt/configs/chatglm.py | .py | # Adapted from
# https://github.com/THUDM/ChatGLM2-6B
# https://github.com/vllm-project/vllm/blob/main/vllm/transformers_utils/configs/chatglm.py
# ChatGLM2 and ChatGLM3 share the same config.
# ChatGLM4 is officially supported by Huggingface
# transformers >= 4.46.0 is required
# https://huggingface.co/docs/transform... | 79 | 2,908 |
sglang | python/sglang/srt/configs/model_config.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... | 2,192 | 93,871 |
sglang | python/sglang/srt/configs/nemotron_h.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... | 560 | 23,476 |
sglang | python/sglang/srt/configs/__init__.py | .py | from sglang.srt.configs.afmoe import AfmoeConfig
from sglang.srt.configs.bailing_hybrid import BailingHybridConfig
from sglang.srt.configs.chatglm import ChatGLMConfig
from sglang.srt.configs.cohere2_moe import Cohere2MoeConfig
from sglang.srt.configs.dbrx import DbrxConfig
from sglang.srt.configs.deepseekvl2 import De... | 125 | 4,215 |
sglang | python/sglang/srt/configs/kimi_linear.py | .py | # SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
# Adapted from: https://github.com/vllm-project/vllm/blob/0384aa7150c4c9778efca041ffd1beb3ad2bd694/vllm/transformers_utils/configs/kimi_linear.py
from transformers.configuration_utils import PretrainedConfig
from... | 181 | 6,870 |
sglang | python/sglang/srt/configs/bailing_hybrid.py | .py | # coding=utf-8
# Copyright 2024 The Qwen team, Alibaba Group and the HuggingFace Inc. team. 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/... | 189 | 6,544 |
sglang | python/sglang/srt/configs/jet_vlm.py | .py | from typing import Any
from transformers.configuration_utils import PretrainedConfig
from transformers.models.siglip import SiglipVisionConfig
from sglang.srt.configs.jet_nemotron import JetNemotronConfig
from sglang.srt.configs.mamba_utils import Mamba2CacheParams
class JetVLMConfig(PretrainedConfig):
model_ty... | 54 | 1,626 |
sglang | python/sglang/srt/configs/internvl.py | .py | import copy
import os
from shutil import copyfile
from typing import Any, Dict, List, Optional, Tuple, Union
import sentencepiece as spm
from transformers import (
TOKENIZER_MAPPING,
GptOssConfig,
LlamaConfig,
PretrainedConfig,
PreTrainedTokenizer,
Qwen2Config,
Qwen3Config,
Qwen3MoeConf... | 706 | 28,081 |
sglang | python/sglang/srt/configs/locate_anything.py | .py | # SPDX-License-Identifier: Apache-2.0
# Adapted from https://huggingface.co/nvidia/LocateAnything-3B/blob/main/configuration_locateanything.py
"""Config for nvidia/LocateAnything-3B.
LocateAnything is a multimodal grounding/detection model composed of a MoonViT
vision encoder, an InternVL-style ``mlp1`` projector, and... | 64 | 2,571 |
sglang | python/sglang/srt/configs/unlimited_ocr.py | .py | """Standalone UNLIMITED-OCR configuration and HF processor."""
import math
from typing import Any, Dict, List, Tuple
import torch
from PIL import Image, ImageOps
from transformers import (
AutoConfig,
AutoProcessor,
PretrainedConfig,
PreTrainedTokenizerFast,
ProcessorMixin,
)
from sglang.srt.conf... | 630 | 21,951 |
sglang | python/sglang/srt/configs/load_config.py | .py | # SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
# Adapted from https://github.com/vllm-project/vllm/blob/v0.6.4.post1/vllm/config.py
import enum
import logging
from dataclasses import dataclass, field
from typing import Any, List, Optional, Union
import orjson... | 155 | 6,229 |
sglang | python/sglang/srt/configs/interns2preview.py | .py | from sglang.srt.configs.qwen3_5 import (
Qwen3_5MoeConfig,
Qwen3_5MoeTextConfig,
Qwen3_5MoeVisionConfig,
)
class InternS2PreviewVisionConfig(Qwen3_5MoeVisionConfig):
model_type = "intern_s2_preview"
def __init__(self, **kwargs):
super().__init__(**kwargs)
class InternS2PreviewConfig(Qwe... | 24 | 568 |
sglang | python/sglang/srt/configs/device_config.py | .py | import logging
from typing import Optional
import torch
from sglang.srt.platforms import current_platform
logger = logging.getLogger(__name__)
SUPPORTED_DEVICES = ["cuda", "xpu", "hpu", "cpu", "npu", "musa", "mps"]
class DeviceConfig:
device: Optional[torch.device]
gpu_id: Optional[int]
def __init__(... | 24 | 657 |
sglang | python/sglang/srt/configs/step3p5.py | .py | from typing import Any, Optional
from transformers.configuration_utils import PretrainedConfig
class Step3p5Config(PretrainedConfig):
model_type = "step3p5"
architectures = ["Step3p5ForCausalLM"]
def __init__(
self,
hidden_size: int = 4096,
intermediate_size: int = 11264,
... | 109 | 3,405 |
sglang | python/sglang/srt/configs/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-side ``PretrainedConfig`` classes for MiniCPM-V ... | 160 | 6,253 |
sglang | python/sglang/srt/configs/janus_pro.py | .py | # Adapted from:
# https://github.com/deepseek-ai/Janus/tree/main/janus/models
from dataclasses import dataclass
from typing import Dict, List, Tuple, Union
import numpy as np
import PIL
import torch
from PIL.Image import Image
from transformers import (
BaseImageProcessor,
BatchFeature,
LlamaConfig,
L... | 635 | 19,240 |
sglang | python/sglang/srt/configs/step3p7.py | .py | from typing import Optional, Union
from transformers.configuration_utils import PretrainedConfig
class Step3p7VisionEncoderConfig(PretrainedConfig):
model_type = "perception_encoder"
def __init__(
self,
width=1536,
layers=47,
heads=16,
num_channels=3,
image_si... | 98 | 3,206 |
sglang | python/sglang/srt/configs/mamba_utils.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... | 324 | 11,996 |
sglang | python/sglang/srt/configs/muse_glimmer_processing.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... | 303 | 11,250 |
sglang | python/sglang/srt/configs/hybrid_arch.py | .py | from __future__ import annotations
from typing import TYPE_CHECKING, Any
from sglang.srt.configs import (
BailingHybridConfig,
FalconH1Config,
GraniteMoeHybridConfig,
InklingMMConfig,
InklingModelConfig,
InternS2PreviewConfig,
JetNemotronConfig,
JetVLMConfig,
KimiLinearConfig,
... | 127 | 3,559 |
sglang | python/sglang/srt/configs/dbrx.py | .py | # Adapted from
# https://huggingface.co/databricks/dbrx-base/blob/main/configuration_dbrx.py
# https://github.com/vllm-project/vllm/blob/main/vllm/transformers_utils/configs/dbrx.py
"""Dbrx configuration."""
from typing import Any, Optional
from transformers.configuration_utils import PretrainedConfig
from transforme... | 280 | 11,005 |
sglang | python/sglang/srt/configs/step3_vl.py | .py | from typing import Any, Optional, Union
from transformers.configuration_utils import PretrainedConfig
class Step3VisionEncoderConfig(PretrainedConfig):
model_type = "step3_vision_encoder"
def __init__(
self,
hidden_size=1792,
intermediate_size=3072,
output_hidden_size=4096,
... | 173 | 4,845 |
sglang | python/sglang/srt/configs/deepseek_ocr.py | .py | import math
from dataclasses import dataclass
from typing import Any, Dict, List, Optional, Tuple, Union
import torch
from PIL import Image, ImageOps
from torchvision.transforms import InterpolationMode
from torchvision.transforms import functional as TF
from transformers import (
AutoProcessor,
LlamaTokenizer... | 906 | 30,742 |
sglang | python/sglang/srt/configs/qwen3_next.py | .py | # coding=utf-8
# Copyright 2024 The Qwen team, Alibaba Group and the HuggingFace Inc. team. 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/... | 314 | 15,878 |
sglang | python/sglang/srt/configs/model_config_parser_registry.py | .py | """Named registry for model-config parsers.
Mirrors the ``LoadFormat.PRIVATE`` escape hatch in
:mod:`sglang.srt.configs.load_config` but registry-shaped, so multiple
plugins can coexist without colliding on a single private import path.
"""
from __future__ import annotations
import logging
from abc import ABC, abstr... | 63 | 1,947 |
sglang | python/sglang/srt/configs/zaya.py | .py | # SPDX-License-Identifier: Apache-2.0
# 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... | 326 | 12,873 |
sglang | python/sglang/srt/configs/kimi_vl_moonvit.py | .py | # SPDX-License-Identifier: Apache-2.0
# Adapted from https://huggingface.co/moonshotai/Kimi-VL-A3B-Instruct/blob/main/configuration_kimi_vl.py
from transformers.configuration_utils import PretrainedConfig
class MoonViTConfig(PretrainedConfig):
model_type = "moonvit"
def __init__(
self,
patch_... | 33 | 1,163 |
sglang | python/sglang/srt/configs/deepseekvl2.py | .py | import math
from dataclasses import dataclass
from typing import Dict, List, Optional, Tuple
import torch
from PIL import Image, ImageOps
from transformers import (
AutoProcessor,
LlamaTokenizerFast,
PretrainedConfig,
ProcessorMixin,
)
def select_best_resolution(image_size, candidate_resolutions):
... | 688 | 23,694 |
sglang | python/sglang/srt/configs/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... | 169 | 7,117 |
sglang | python/sglang/srt/configs/deepseek_v4.py | .py | import logging
import os
from dataclasses import dataclass, field
from typing import Dict, List, Optional
from transformers import PretrainedConfig
from sglang.srt.layers.quantization.base_config import QuantizationConfig
logger = logging.getLogger(__name__)
def try_detect_fp4_experts(model_path: str) -> Optional[... | 111 | 3,144 |
sglang | python/sglang/srt/configs/update_config.py | .py | from __future__ import annotations
import logging
from typing import TYPE_CHECKING
from sglang.srt.utils import (
log_debug_on_rank0,
)
logger = logging.getLogger(__name__)
DEFAULT_MOE_PADDING_SIZE = 32
if TYPE_CHECKING:
from sglang.srt.configs.load_config import LoadConfig
from sglang.srt.configs.mode... | 356 | 13,453 |
sglang | python/sglang/srt/configs/granitemoehybrid.py | .py | # coding=utf-8
# Copyright 2025 IBM and the HuggingFace Inc. team. 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
#
# ... | 302 | 13,855 |
sglang | python/sglang/srt/configs/modelopt_config.py | .py | # Configuration for NVIDIA ModelOpt quantization integration
from dataclasses import dataclass
from typing import Optional
@dataclass
class ModelOptConfig:
"""Configuration for NVIDIA ModelOpt quantization operations.
This configuration class holds parameters for ModelOpt quantization,
checkpoint managem... | 31 | 1,070 |
sglang | python/sglang/srt/configs/qwen3_omni.py | .py | from transformers import PretrainedConfig
from transformers.configuration_utils import layer_type_validation
from sglang.utils import logger
class Qwen3OmniMoeAudioEncoderConfig(PretrainedConfig):
model_type = "qwen3_omni_moe_audio_encoder"
def __init__(
self,
num_mel_bins=128,
encod... | 610 | 22,205 |
sglang | python/sglang/srt/configs/lfm2_moe.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... | 193 | 6,976 |
sglang | python/sglang/srt/configs/falcon_h1.py | .py | # coding=utf-8
# Copyright 2024 TII and the HuggingFace Inc. team. 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
#
# ... | 316 | 14,991 |
sglang | python/sglang/srt/configs/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... | 284 | 10,768 |
sglang | python/sglang/srt/configs/longcat_flash.py | .py | from transformers.configuration_utils import PretrainedConfig
from transformers.utils import logging
logger = logging.get_logger(__name__)
FLASH_PRETRAINED_CONFIG_ARCHIVE_MAP = {}
class LongcatFlashConfig(PretrainedConfig):
model_type = "longcat_flash"
keys_to_ignore_at_inference = ["past_key_values"]
... | 125 | 4,468 |
sglang | python/sglang/srt/configs/kimi_vl.py | .py | # SPDX-License-Identifier: Apache-2.0
# Adapted from https://huggingface.co/moonshotai/Kimi-VL-A3B-Instruct/blob/main/configuration_kimi_vl.py
from typing import Optional, Union
from transformers.configuration_utils import PretrainedConfig
from sglang.srt.configs.deepseekvl2 import DeepseekV2Config
from sglang.srt.co... | 39 | 1,359 |
sglang | python/sglang/srt/configs/lfm2.py | .py | # coding=utf-8
# Copyright 2024 Liquid AI and the HuggingFace Inc. team. 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.... | 105 | 3,849 |
sglang | python/sglang/srt/configs/parakeet.py | .py | # SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
# 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
#
# h... | 77 | 2,853 |
sglang | python/sglang/srt/configs/exaone.py | .py | # coding=utf-8
# Copyright 2024 The LG AI Research EXAONE Lab. All rights reserved.
# Copyright 2024 The LG CNS AI Engineering Team.
# 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 ... | 197 | 10,732 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.