sglang の API リファレンス
sglang (sgl-project/sglang) の公開 API 400 件 —— クラス 199、関数 125、メソッド 76。実際のソースを静的解析して抽出した正確なシグネチャを掲載しています。
リポジトリ: sgl-project/sglang
| 種別 | 件数 |
|---|---|
| クラス | 199 |
| 関数 | 125 |
| メソッド | 76 |
API 一覧
class
python.sglang._mps_stub.EventMinimal stand-in for ``torch.cuda.Event``.
class
python.sglang._mps_stub.StreamMinimal stand-in for ``torch.cuda.Stream``.
class
python.sglang._mps_stub.StreamContextMinimal stand-in for ``torch.cuda.StreamContext``.
func
python.sglang._mps_stub.current_device() -> intReturn the index of the current MPS device (always 0).
func
python.sglang._mps_stub.current_stream(device:Any=None) -> StreamReturn the default (and only) MPS stream.
func
python.sglang._mps_stub.device_count() -> intReturn the number of available MPS devices (always 1).
func
python.sglang._mps_stub.get_device_properties(device:Any=0) -> _MPSDevicePropertiesReturn the properties of the MPS device.
func
python.sglang._mps_stub.install() -> NonePatch ``torch.mps`` with the stubs above.
func
python.sglang._mps_stub.set_device(device:Any) -> NoneSet the current device.
func
python.sglang._mps_stub.stream(s:Any) -> StreamReturn a context manager that is a no-op on MPS.
func
python.sglang._triton_stub.install() -> NoneRegister a mock ``triton`` package in *sys.modules*.
class
python.sglang.check_env.BaseEnvBase class for environment check
method
python.sglang.check_env.BaseEnv.get_info() -> dictGet CUDA-related information if available.
method
python.sglang.check_env.BaseEnv.get_package_versions() -> dictGet versions of specified packages.
class
python.sglang.check_env.GPUEnvEnvironment checker for Nvidia GPU
method
python.sglang.check_env.GPUEnv.get_topology()Get GPU topology information.
class
python.sglang.check_env.HIPEnvEnvironment checker for ROCm/HIP
class
python.sglang.check_env.MPSEnvEnvironment checker for Apple Silicon MPS
class
python.sglang.check_env.MUSAEnvEnvironment checker for MThreads GPU
method
python.sglang.check_env.MUSAEnv.get_topology()Get GPU topology information.
class
python.sglang.check_env.NPUEnvEnvironment checker for Ascend NPU
func
python.sglang.cli.utils.get_is_diffusion_model(model_path:str) -> boolDetect whether model_path points to a diffusion model.
class
python.sglang.global_config.GlobalConfigStore some global constants.
func
python.sglang.kernel_api_logging.debug_torch_op(op_func:Callable, op_name:str, *namespace:str='sglang') -> CallableNOTE: For internal use.
func
python.sglang.kernels.aot.python.sgl_kernel.elementwise.rmsnorm(input:torch.Tensor, weight:torch.Tensor, eps:float=1e-06, out:Optional[torch.Tensor]=None, enable_pdl:Optional[bool]=None) -> torch.TensorRoot mean square normalization.
func
python.sglang.kernels.aot.python.sgl_kernel.spatial.create_greenctx_stream_by_value(SM_a:int, SM_b:int, device_id:int=None) -> tuple[ExternalStream, ExternalStream]Create two streams for greenctx.
func
python.sglang.kernels.aot.python.sgl_kernel.spatial.get_sm_available(device_id:int=None) -> intGet the SMs available on the device.
func
python.sglang.kernels.jit.utils.arch.get_jit_cuda_arch() -> ArchInfoGet the current CUDA architecture info.
class
python.sglang.kernels.ops.activation.ReLU2Op``out = relu(input) ** 2`` (single-input, not gated).
func
python.sglang.kernels.ops.activation.gelu_and_mul(input:torch.Tensor, out:Optional[torch.Tensor]=None) -> torch.Tensor``out = gelu(input[..., :d]) * input[..., d:]``.
func
python.sglang.kernels.ops.activation.gelu_quick(input:torch.Tensor, out:Optional[torch.Tensor]=None) -> torch.Tensor``out = input * sigmoid(1.702 * input)``.
func
python.sglang.kernels.ops.activation.relu2(input:torch.Tensor, out:Optional[torch.Tensor]=None) -> torch.Tensor``out = relu(input) ** 2``.
func
python.sglang.kernels.ops.attention.dsa.tilelang_kernel.fp8_index(q:torch.Tensor, q_s:torch.Tensor, k:torch.Tensor, k_s:torch.Tensor) -> torch.TensorPerform index score using FP8 precision.
func
python.sglang.kernels.ops.attention.dsv4.elementwise.fused_q_indexer_rope_first_quant(q_input:torch.Tensor, weight:torch.Tensor, weight_scale:float, cos_sin_cache:torch.Tensor, positions:torch.Tensor) -> Tuple[torch.Tensor, torch.Tensor]DeepSeek-V3.2 only.
func
python.sglang.kernels.ops.attention.fla.kda.cdiv(a:int, b:int) -> intCeiling division.
func
python.sglang.kernels.ops.attention.fla.kda.next_power_of_2(n:int) -> intThe next power of 2 (inclusive)
class
python.sglang.kernels.ops.attention.flash_attn.cute.cache_utils.JITCacheIn-memory cache for compiled functions.
method
python.sglang.kernels.ops.attention.flash_attn.cute.cache_utils.JITCache.clear() -> NoneClear in-memory cache of compiled functions
func
python.sglang.kernels.ops.attention.flash_attn.cute.cache_utils.get_jit_cache(name:str | None=None) -> JITCacheJIT cache factory.
func
python.sglang.kernels.ops.attention.flash_attn.cute.cute_dsl_ptxas.patch()Install system ptxas hook.
func
python.sglang.kernels.ops.attention.flash_attn.cute.fa_logging.set_fa_log_level(level:int | str) -> NoneSet the FA log level programmatically.
class
python.sglang.kernels.ops.attention.flash_attn.cute.mask.Sm100MaskEnumEnumeration of mask types for FMHA operations.
func
python.sglang.kernels.ops.attention.flash_attn.cute.pipeline.make_pipeline_state(type:PipelineUserType, stages:int)Creates a pipeline state.
func
python.sglang.kernels.ops.attention.flash_attn.cute.softmax.floor_if_packed(q_idx, qhead_per_kvhead:cutlass.Constexpr[int]) -> cute.TensorConvert q_idx to packed format for Pack-GQA.
func
python.sglang.kernels.ops.attention.position.compute_position_triton(extend_prefix_lens:torch.Tensor, extend_seq_lens:torch.Tensor, extend_seq_lens_sum)Compute positions.
func
python.sglang.kernels.ops.diffusion.residual_gate_add(residual:torch.Tensor, update:torch.Tensor, gate:torch.Tensor) -> torch.TensorFused ``residual + gate * update``.
func
python.sglang.kernels.ops.diffusion.triton.mps_fallback.triton_one_pass_rms_norm_native(x:torch.Tensor, w:torch.Tensor, eps:float=1e-06) -> torch.TensorMLX-accelerated triton_one_pass_rms_norm.
func
python.sglang.kernels.ops.diffusion.triton.sana_wm_gdn.fused_qk_inv_rms(qkv:torch.Tensor, eps:float=1e-05) -> tuple[torch.Tensor, torch.Tensor]Single-pass Triton fused Q+K inverse-RMS.
func
python.sglang.kernels.ops.diffusion.usp_relayout.usp_merge_heads(x:torch.Tensor) -> torch.TensorMerge Ulysses output heads with an exact eager fallback.
func
python.sglang.kernels.ops.elementwise.elementwise.fused_sigmoid_mul(attn_output:torch.Tensor, gate:torch.Tensor, inplace:bool=False) -> torch.TensorFused sigmoid-mul for attention output gating.
class
python.sglang.kernels.ops.gemm.cutedsl_bf16_gemm.WorkTileInfoWhich output tile this CTA processes.
func
python.sglang.kernels.ops.gemm.dsv3_fused_a_gemm(mat_a:torch.Tensor, mat_b:torch.Tensor, output:Optional[torch.Tensor]=None) -> torch.TensorDeepSeek-V3 fused QKV-A GEMM.
func
python.sglang.kernels.ops.gemm.kv_b_lora_absorbed.step_a_q_fwd(q_nope:torch.Tensor, B_buf:torch.Tensor, batch_info:LoRABatchInfo, full_K_per_head:int) -> torch.TensorStep A of the q-side correction.
func
python.sglang.kernels.ops.gemm.kv_b_lora_absorbed.step_a_v_fwd(attn_output:torch.Tensor, A_buf:torch.Tensor, batch_info:LoRABatchInfo) -> torch.TensorStep A of the v-side correction.
func
python.sglang.kernels.ops.gemm.trtllm_lora_temp.kv_b_lora_absorbed.step_a_q_fwd(q_nope:torch.Tensor, B_buf:torch.Tensor, batch_info:LoRABatchInfo, full_K_per_head:int) -> torch.TensorStep A of the q-side correction.
func
python.sglang.kernels.ops.gemm.trtllm_lora_temp.kv_b_lora_absorbed.step_a_v_fwd(attn_output:torch.Tensor, A_buf:torch.Tensor, batch_info:LoRABatchInfo) -> torch.TensorStep A of the v-side correction.
func
python.sglang.kernels.ops.kimi_k3.all_reduce.register_comm(comm:Communicator, *pull_sem_mc_ptr:int=0) -> NoneRegister the CustomAllReduceV2 storage plane.
func
python.sglang.kernels.ops.kimi_k3.attn_res_hip.supports_attn_res_hip(hidden_size:int, nvb:int) -> boolWhether this shape fits the register budget.
func
python.sglang.kernels.ops.kimi_k3.gemm_ar.fits(x:torch.Tensor) -> boolWhether this o_proj input can take the fused GEMM+AR path.
func
python.sglang.kernels.ops.layernorm.gemma4_fused_ops.gemma4_fused_routing(gating_output:torch.Tensor, per_expert_scale:torch.Tensor, topk:int) -> tuple[torch.Tensor, torch.Tensor]One-launch Gemma4 router.
func
python.sglang.kernels.ops.lplb.cuda_solver.solve_ipm(A:torch.Tensor, b:torch.Tensor, c:torch.Tensor, num_iters:int=DEFAULT_NUM_ITERS, result:torch.Tensor | None=None) -> torch.TensorRun the fused single-SM IPM kernel.
func
python.sglang.kernels.ops.lplb.shmem_budget.assert_fits(nc:int, nv:int, gpu:str='h100') -> NoneRaise if the fused kernel will not fit on the target GPU.
func
python.sglang.kernels.ops.lplb.shmem_budget.max_nc_for_nv(nv:int, gpu:str='h100') -> intLargest NC that fits for a given NV.
func
python.sglang.kernels.ops.lplb.shmem_budget.report(nc:int, nv:int, gpu:str='h100') -> strHuman-readable summary — used by kernels on init for logging.
class
python.sglang.kernels.ops.mamba.triton_ops.ssu_dispatch.TritonSSUBackendTriton-based selective-state-update backend.
func
python.sglang.kernels.ops.moe.ep_moe_kernels.get_tma_aligned_size(x:int, element_size:int) -> intGlobal memory address of TMA must be 16-byte aligned.
func
python.sglang.kernels.ops.moe.moe_front.get_front_strategy(num_tokens:int, device) -> strReturn the measured front strategy for this exact workload.
func
python.sglang.kernels.ops.sampling.murmur_hash.fmix32(h:tl.uint32) -> tl.uint32final mix of 32-bit hash value for MurmurHash
func
python.sglang.kernels.ops.sampling.murmur_hash.murmur3_mix(h:tl.uint32, k:tl.uint32) -> tl.uint32Mixes a 32-bit key into the hash state.
func
python.sglang.kernels.ops.sampling.murmur_hash.rotl32(x, r:tl.constexpr) -> tl.uint32rotate left 32-bit integer x by r bits e.g.
func
python.sglang.kernels.ops.sampling.top_k_renorm_probs(probs:torch.Tensor, top_k:Union[torch.Tensor, int]) -> torch.TensorRenormalize ``probs`` by top-k thresholding.
func
python.sglang.kernels.ops.sampling.top_p_renorm_probs(probs:torch.Tensor, top_p:Union[torch.Tensor, float]) -> torch.TensorRenormalize ``probs`` by top-p thresholding.
func
python.sglang.kernels.registry.register_kernel(spec:KernelSpec) -> KernelSpecRegister ``spec`` in the process-wide :data:`registry`.
func
python.sglang.kernels.selector.clear_cache() -> NoneDrop the resolved-callable cache (used by tests).
func
python.sglang.kernels.selector.get_kernel(op:str, backend:Optional[KernelBackend]=None) -> CallableResolve ``op`` to a callable kernel and cache it.
class
python.sglang.kernels.spec.DeviceTypeAccelerator device family a kernel can run on.
class
python.sglang.kernels.spec.FormatSignatureA light description of a kernel's data contract.
class
python.sglang.kernels.spec.KernelSpecA single callable kernel implementation and its metadata.
method
python.sglang.kernels.spec.KernelSpec.is_available(platform:PlatformInfo) -> boolWhether this backend can run on ``platform`` (metadata-only check).
method
python.sglang.kernels.spec.KernelSpec.load() -> CallableImport and return the backing callable.
class
python.sglang.kernels.spec.PlatformInfoA minimal snapshot of the runtime accelerator platform.
func
python.sglang.kernels.spec.capabilities_satisfied(capabilities:Union[FrozenSet[CapabilityRequirement], Tuple[CapabilityRequirement, ...], CapabilityRequirement], platform:PlatformInfo) -> boolOR over ``capabilities`` (empty = unrestricted).
class
python.sglang.lang.backend.crusoe.CrusoeSGLang backend for Crusoe managed inference.
class
python.sglang.lang.backend.runtime_endpoint.RuntimeA wrapper for the HTTP server.
class
python.sglang.lang.interpreter.ProgramStateThe state of an SGL program.
class
python.sglang.multimodal_gen.apps.ComfyUI_SGLDiffusion.executors.flux.FluxExecutorExecutor for Flux models in ComfyUI.
class
python.sglang.multimodal_gen.apps.ComfyUI_SGLDiffusion.executors.zimage.ZImageExecutorExecutor for ZImage models in ComfyUI.
method
python.sglang.multimodal_gen.configs.models.base.ModelConfig.update_model_arch(source_model_dict:dict[str, Any]) -> NoneUpdate arch_config with source_model_dict
class
python.sglang.multimodal_gen.configs.models.dits.cosmos3video.Cosmos3VideoConfigDiT config wrapper for Cosmos3 Video model.
class
python.sglang.multimodal_gen.configs.models.dits.ltx_2.LTX2ConfigConfiguration for LTX-2 Video Transformer.
class
python.sglang.multimodal_gen.configs.models.encoders.qwen3.Qwen3TextArchConfigArchitecture config for Qwen3 text encoder.
class
python.sglang.multimodal_gen.configs.models.encoders.qwen3.Qwen3TextConfigTop-level config for Qwen3 text encoder.
class
python.sglang.multimodal_gen.configs.models.encoders.qwen3vl.Qwen3VLConfigConfiguration for Qwen3-VL text encoder.
class
python.sglang.multimodal_gen.configs.models.vaes.hunyuan3d.Hunyuan3DVAEArchConfigArchitecture config for Hunyuan3D VAE.
class
python.sglang.multimodal_gen.configs.models.vaes.hunyuan3d.Hunyuan3DVAEConfigVAE configuration for Hunyuan3D.
class
python.sglang.multimodal_gen.configs.models.vaes.stablediffusion3.StableDiffusion3VAEConfigConfiguration for StableDiffusion3 VAE.
class
python.sglang.multimodal_gen.configs.pipeline_configs.base.PipelineConfigThe base configuration class for a generation pipeline.
class
python.sglang.multimodal_gen.configs.pipeline_configs.base.STA_ModeSTA (Sliding Tile Attention) modes.
class
python.sglang.multimodal_gen.configs.pipeline_configs.base.SlidingTileAttnConfigConfiguration for sliding tile attention.
class
python.sglang.multimodal_gen.configs.pipeline_configs.base.SpatialImagePipelineConfigBase config for spatial image pipelines (e.g.
func
python.sglang.multimodal_gen.configs.pipeline_configs.base.parse_int_list(value:str) -> list[int]Parse a comma-separated string of integers into a list.
class
python.sglang.multimodal_gen.configs.pipeline_configs.cosmos3.Cosmos3ConfigCosmos3 unified pipeline config.
class
python.sglang.multimodal_gen.configs.pipeline_configs.flux.FluxPipelineConfigConfiguration for the FLUX pipeline.
class
python.sglang.multimodal_gen.configs.pipeline_configs.glm_image.GlmImagePipelineConfigConfiguration for the GlmImage pipeline.
class
python.sglang.multimodal_gen.configs.pipeline_configs.helios.HeliosT2VConfigConfiguration for the Helios T2V pipeline.
class
python.sglang.multimodal_gen.configs.pipeline_configs.krea2.Krea2PipelineConfigKrea-2 single-stream MMDiT, text-to-image.
class
python.sglang.multimodal_gen.configs.pipeline_configs.ltx_2.LTX23PipelineConfigConfiguration overrides for LTX-2.3.
class
python.sglang.multimodal_gen.configs.pipeline_configs.ltx_2.LTX2PipelineConfigConfiguration for LTX-Video pipeline.
class
python.sglang.multimodal_gen.configs.pipeline_configs.qwen_image.QwenImagePipelineConfigConfiguration for the QwenImage pipeline.
func
python.sglang.multimodal_gen.configs.sample.glmimage.align_glm_image_dimension(value:int) -> intRound a GLM-Image dimension up to a supported multiple.
class
python.sglang.multimodal_gen.configs.sample.joy_echo.JoyEchoSamplingParamsSampling parameters for JoyEcho DMD inference.
class
python.sglang.multimodal_gen.configs.sample.ltx_2.LTX2SamplingParamsSampling parameters for LTX-2.
class
python.sglang.multimodal_gen.configs.sample.sampling_params.SamplingParamsSampling parameters for generation.
method
python.sglang.multimodal_gen.configs.sample.sampling_params.SamplingParams.add_cli_args(parser:Any) -> AnyAdd CLI arguments for SamplingParam fields
class
python.sglang.multimodal_gen.configs.sample.sana.SanaSamplingParamsDefaults for SANA 1.5 1024px variant.
class
python.sglang.multimodal_gen.configs.sample.wan.Wan2_2_Base_SamplingParamsSampling parameters for Wan2.2 TI2V 5B model.
class
python.sglang.multimodal_gen.configs.sample.wan.Wan2_2_TI2V_5B_SamplingParamSampling parameters for Wan2.2 TI2V 5B model.
func
python.sglang.multimodal_gen.registry.get_non_diffusers_pipeline_name(model_path:str) -> Optional[str]Get the pipeline name for a known non-diffusers model.
func
python.sglang.multimodal_gen.registry.get_pipeline_config_classes(pipeline_class_name:str) -> Tuple[Type[PipelineConfig], Type[Any]] | NoneGet the configuration classes for a pipeline.
class
python.sglang.multimodal_gen.runtime.cache.cache_dit_integration.CacheDitConfigConfiguration for cache-dit integration.
class
python.sglang.multimodal_gen.runtime.cache.spectrum.SpectrumForecasterChebyshev + discrete Taylor blend forecaster.
func
python.sglang.multimodal_gen.runtime.disaggregation.roles.get_module_role(module_name:str) -> 'RoleType | None'Classify a module name to its primary role.
func
python.sglang.multimodal_gen.runtime.disaggregation.transport.protocol.encode_transfer_msg(msg:Any) -> list[bytes]Encode as [TRANSFER_MAGIC, json_payload_bytes].
func
python.sglang.multimodal_gen.runtime.distributed.group_coordinator.get_local_torch_device() -> torch.deviceReturn the torch device for the current rank.
func
python.sglang.multimodal_gen.runtime.distributed.parallel_state.destroy_model_parallel() -> NoneSet the groups to none and destroy them.
func
python.sglang.multimodal_gen.runtime.distributed.parallel_state.get_dp_rank() -> intReturn my rank for the data parallel group.
func
python.sglang.multimodal_gen.runtime.distributed.parallel_state.get_world_rank() -> intReturn my rank for the world group.
func
python.sglang.multimodal_gen.runtime.distributed.parallel_state.get_world_size() -> intReturn world size for the world group.
class
python.sglang.multimodal_gen.runtime.entrypoints.cli.cli_types.CLISubcommandBase class for CLI subcommands
method
python.sglang.multimodal_gen.runtime.entrypoints.cli.cli_types.CLISubcommand.validate(args:argparse.Namespace) -> NoneValidate the arguments for this command
func
python.sglang.multimodal_gen.runtime.entrypoints.http_server.model_info_endpoint(request:Request)Get model information.
func
python.sglang.multimodal_gen.runtime.entrypoints.http_server.server_info_endpoint(request:Request)Get server information.
class
python.sglang.multimodal_gen.runtime.entrypoints.openai.common_api.ModelCardModel cards.
func
python.sglang.multimodal_gen.runtime.entrypoints.openai.common_api.available_models()Show available models.
func
python.sglang.multimodal_gen.runtime.entrypoints.openai.common_api.retrieve_model(model:str)Retrieve a model instance.
class
python.sglang.multimodal_gen.runtime.entrypoints.openai.realtime.generate_session.GenerateSessionA realtime generation session
func
python.sglang.multimodal_gen.runtime.entrypoints.openai.utils.build_sampling_params(request_id:str, **kwargs) -> SamplingParamsBuild SamplingParams from request parameters.
func
python.sglang.multimodal_gen.runtime.launch_server.parse_url_string(url_str:str) -> list[str]Parse a semicolon-separated URL string into a list.
class
python.sglang.multimodal_gen.runtime.layers.activation.GeluAndMulAn activation function for GeGLU.
class
python.sglang.multimodal_gen.runtime.layers.activation.SiluAndMulAn activation function for SwiGLU.
method
python.sglang.multimodal_gen.runtime.layers.activation.SiluAndMul.forward_native(x:torch.Tensor) -> torch.TensorPyTorch-native implementation equivalent to forward().
func
python.sglang.multimodal_gen.runtime.layers.activation.get_act_fn(act_fn_name:str) -> nn.ModuleGet an activation function by name.
class
python.sglang.multimodal_gen.runtime.layers.attention.backends.attention_backend.AttentionBackendAbstract class for attention backends.
class
python.sglang.multimodal_gen.runtime.layers.attention.layer.LocalAttentionAttention layer.
class
python.sglang.multimodal_gen.runtime.layers.attention.turbo_layer.DistributedAttentionInitialization.
class
python.sglang.multimodal_gen.runtime.layers.custom_op.CustomOpBase class for custom ops.
class
python.sglang.multimodal_gen.runtime.layers.layernorm.RMSNormRoot mean square normalization.
class
python.sglang.multimodal_gen.runtime.layers.linear.ColumnParallelLinearLinear layer with column parallelism.
class
python.sglang.multimodal_gen.runtime.layers.linear.LinearBaseBase linear layer.
class
python.sglang.multimodal_gen.runtime.layers.linear.LinearMethodBaseBase class for different (maybe quantized) linear methods.
method
python.sglang.multimodal_gen.runtime.layers.linear.LinearMethodBase.apply(layer:torch.nn.Module, x:torch.Tensor, bias:torch.Tensor | None=None) -> torch.TensorApply the weights in layer to the input tensor.
class
python.sglang.multimodal_gen.runtime.layers.linear.MergedColumnParallelLinearPacked linear layers with column parallelism.
class
python.sglang.multimodal_gen.runtime.layers.linear.ReplicatedLinearReplicated linear layer.
class
python.sglang.multimodal_gen.runtime.layers.linear.RowParallelLinearLinear layer with row parallelism.
class
python.sglang.multimodal_gen.runtime.layers.linear.UnquantizedLinearMethodLinear method without quantization.
class
python.sglang.multimodal_gen.runtime.layers.mlp.FeedForwardA feed-forward layer.
class
python.sglang.multimodal_gen.runtime.layers.mlp.MLPMLP for DiT blocks, NO gated linear units
func
python.sglang.multimodal_gen.runtime.layers.parallel_conv.gather_height_sizes(x:torch.Tensor) -> list[int]gather heights of sharded feature_maps from peers
class
python.sglang.multimodal_gen.runtime.layers.quantization.configs.base_config.QuantizationConfigBase class for quantization configs.
class
python.sglang.multimodal_gen.runtime.layers.quantization.configs.base_config.QuantizeMethodBaseBase class for different quantized methods.
method
python.sglang.multimodal_gen.runtime.layers.quantization.configs.base_config.QuantizeMethodBase.process_weights_after_loading(layer:nn.Module) -> NoneProcess the weight after loading.
class
python.sglang.multimodal_gen.runtime.layers.quantization.fp8.Fp8ConfigConfig class for FP8.
class
python.sglang.multimodal_gen.runtime.layers.quantization.fp8.Fp8LinearMethodLinear method for FP8.
class
python.sglang.multimodal_gen.runtime.layers.quantization.modelopt_quant.ModelOptFp4ConfigConfig class for NVFP4.
class
python.sglang.multimodal_gen.runtime.layers.rotary_embedding.base.RotaryEmbeddingOriginal rotary positional embedding.
class
python.sglang.multimodal_gen.runtime.layers.rotary_embedding.mrope.NDRotaryEmbeddingN-dimensional rotary positional embedding.
class
python.sglang.multimodal_gen.runtime.layers.rotary_embedding.mrope.OneDRotaryEmbedding1D rotary positional embedding with caching.
class
python.sglang.multimodal_gen.runtime.layers.visual_embedding.ModulateProjectionModulation layer for DiT blocks.
class
python.sglang.multimodal_gen.runtime.layers.vocab_parallel_embedding.UnquantizedEmbeddingMethodUnquantized method for embeddings.
func
python.sglang.multimodal_gen.runtime.layers.vocab_parallel_embedding.pad_vocab_size(vocab_size:int, pad_to:int=DEFAULT_VOCAB_PADDING_SIZE) -> intPad the vocab size to the given value.
class
python.sglang.multimodal_gen.runtime.loader.component_loaders.component_loader.AutoProcessorLoaderLoader for auto processor.
class
python.sglang.multimodal_gen.runtime.loader.component_loaders.component_loader.ImageProcessorLoaderLoader for image processor.
class
python.sglang.multimodal_gen.runtime.loader.component_loaders.component_loader.TokenizerLoaderLoader for tokenizers.
class
python.sglang.multimodal_gen.runtime.loader.component_loaders.scheduler_loader.SchedulerLoaderLoader for scheduler.
class
python.sglang.multimodal_gen.runtime.loader.component_loaders.text_encoder_loader.TextEncoderLoaderLoader for text encoders.
class
python.sglang.multimodal_gen.runtime.loader.component_loaders.text_encoder_loader.TextEncoderLoader.SourceA source for weights.
func
python.sglang.multimodal_gen.runtime.loader.weight_utils.default_weight_loader(param:torch.Tensor, loaded_weight:torch.Tensor) -> NoneDefault weight loader.
func
python.sglang.multimodal_gen.runtime.loader.weight_utils.maybe_remap_kv_scale_name(name:str, params_dict:dict) -> str | NoneRemap the name of FP8 k/v_scale parameters.
func
python.sglang.multimodal_gen.runtime.managers.forward_context.get_forward_context() -> 'ForwardContext'Get the current forward context.
class
python.sglang.multimodal_gen.runtime.managers.gpu_worker.GPUWorkerA worker that executes the model on a single GPU.
method
python.sglang.multimodal_gen.runtime.managers.gpu_worker.GPUWorker.execute_forward(batch:List[Req], return_req:bool=False) -> OutputBatch | ReqExecute a forward pass.
method
python.sglang.multimodal_gen.runtime.managers.gpu_worker.GPUWorker.merge_lora_weights(target:str='all', strength:float=1.0) -> OutputBatchMerge LoRA weights.
method
python.sglang.multimodal_gen.runtime.managers.gpu_worker.GPUWorker.release_realtime_session(session_id:str) -> OutputBatchrelease the session of a realtime connection
method
python.sglang.multimodal_gen.runtime.managers.gpu_worker.GPUWorker.unmerge_lora_weights(target:str='all') -> OutputBatchUnmerge LoRA weights.
class
python.sglang.multimodal_gen.runtime.managers.scheduler.SchedulerRuns the main event loop for the rank 0 worker.
class
python.sglang.multimodal_gen.runtime.models.bridges.mova_dual_tower.PerFrameAttentionPoolingPer-frame multi-head attention pooling.
method
python.sglang.multimodal_gen.runtime.models.bridges.mova_dual_tower.PerFrameAttentionPooling.forward(x:torch.Tensor, grid_size:Tuple[int, int, int]) -> torch.TensorForward pass.
func
python.sglang.multimodal_gen.runtime.models.dits.common.modulate(x:torch.Tensor, shift:torch.Tensor | None=None, scale:torch.Tensor | None=None) -> torch.TensorModulate by shift and scale.
class
python.sglang.multimodal_gen.runtime.models.dits.cosmos3video.Cosmos3GatedMLPGated MLP (SwiGLU-style) for Cosmos3.
class
python.sglang.multimodal_gen.runtime.models.dits.cosmos3video.Cosmos3OmniTransformerCosmos3 Omni transformer.
class
python.sglang.multimodal_gen.runtime.models.dits.flux.FluxTransformer2DModelThe Transformer model introduced in Flux.
class
python.sglang.multimodal_gen.runtime.models.dits.flux_2.Flux2Transformer2DModelThe Transformer model introduced in Flux 2.
class
python.sglang.multimodal_gen.runtime.models.dits.glm_image.GlmImageKVCacheContainer for all layers' KV caches.
class
python.sglang.multimodal_gen.runtime.models.dits.glm_image.GlmImageLayerKVCacheKV cache for GlmImage model.
class
python.sglang.multimodal_gen.runtime.models.dits.joy_image.ModulateWanModulation layer for WanX.
func
python.sglang.multimodal_gen.runtime.models.dits.joy_image.fused_add_gate(residual:torch.Tensor, x:torch.Tensor, gate:torch.Tensor) -> torch.TensorFused residual addition with gate.
class
python.sglang.multimodal_gen.runtime.models.dits.mova_audio_dit.Conv1dLocalIslandInherits from Conv1d and overrides forward.
class
python.sglang.multimodal_gen.runtime.models.dits.mova_video_dit.CrossAttentionCross-Attention module for MOVA DiT.
class
python.sglang.multimodal_gen.runtime.models.dits.qwen_image.QwenImageTransformer2DModelThe Transformer model introduced in Qwen.
class
python.sglang.multimodal_gen.runtime.models.dits.sana.GLUMBConvGated Linear Unit with Multi-Branch Convolution.
class
python.sglang.multimodal_gen.runtime.models.dits.sana_wm.SanaWMBlockOne transformer block of SANA-WM.
class
python.sglang.multimodal_gen.runtime.models.dits.sana_wm.SanaWMTransformer3DModelSANA-WM 2.6B TI2V world model.
class
python.sglang.multimodal_gen.runtime.models.dits.sana_wm_components.TimestepEmbedderUpstream ``TimestepEmbedder``.
class
python.sglang.multimodal_gen.runtime.models.dits.sana_wm_refiner_transformer.SanaWMRefinerBlockVideo-only LTX-2 transformer block.
class
python.sglang.multimodal_gen.runtime.models.encoders.gemma2.Gemma2ModelGemma2 text encoder model for SANA pipeline.
class
python.sglang.multimodal_gen.runtime.models.encoders.gemma_3.Gemma3MultiModalProjectorProjector for Gemma3 multimodal.
class
python.sglang.multimodal_gen.runtime.models.encoders.qwen3.Qwen3DecoderLayerQwen3 transformer decoder layer.
class
python.sglang.multimodal_gen.runtime.models.encoders.t5.AttentionTypeAttention type.
class
python.sglang.multimodal_gen.runtime.models.parameter.BasevLLMParameterBase parameter for vLLM linear layers.
class
python.sglang.multimodal_gen.runtime.models.parameter.ModelWeightParameterParameter class for linear layer weights.
class
python.sglang.multimodal_gen.runtime.models.schedulers.scheduling_flow_match_euler_discrete.FlowMatchEulerDiscreteSchedulerEuler scheduler.
class
python.sglang.multimodal_gen.runtime.models.vaes.autoencoder_kl_qwenimage.QwenImageDecoder3dA 3D decoder module.
class
python.sglang.multimodal_gen.runtime.models.vaes.autoencoder_kl_qwenimage.QwenImageEncoder3dA 3D encoder module.
class
python.sglang.multimodal_gen.runtime.models.vaes.autoencoder_kl_qwenimage.QwenImageRMS_normA custom RMS normalization layer.
class
python.sglang.multimodal_gen.runtime.models.vaes.autoencoder_kl_qwenimage.QwenImageResidualBlockA custom residual block module.
class
python.sglang.multimodal_gen.runtime.models.vaes.hunyuan3d_vae.Latent2MeshOutputContainer for mesh output from VAE decoder.
class
python.sglang.multimodal_gen.runtime.models.vaes.hunyuan3d_vae.MCSurfaceExtractorMarching Cubes surface extractor.
class
python.sglang.multimodal_gen.runtime.models.vaes.hunyuan3d_vae.SurfaceExtractorBase class for surface extraction algorithms.
class
python.sglang.multimodal_gen.runtime.models.vaes.hunyuan3d_vae.VectsetVAEBase VAE class for vector set encoding.
method
python.sglang.multimodal_gen.runtime.models.vaes.hunyuan3d_vae.VectsetVAE.latents2mesh(latents:torch.FloatTensor, **kwargs)Convert latents to mesh.
class
python.sglang.multimodal_gen.runtime.models.vaes.ltx_2_audio.LTX2AudioAudioPatchifierPatchifier for spectrogram/audio latents.
class
python.sglang.multimodal_gen.runtime.models.vaes.ltx_2_vae.AutoencoderKLCausalLTX2VideoStreaming causal LTX-2 VAE.
class
python.sglang.multimodal_gen.runtime.models.vaes.ltx_2_vae.LTX2VideoDownBlock3DDown block used in the LTXVideo model.
class
python.sglang.multimodal_gen.runtime.models.vaes.ltx_2_vae.LTX2VideoMidBlock3dA middle block used in the LTXVideo model.
class
python.sglang.multimodal_gen.runtime.models.vaes.ltx_2_vae.LTX2VideoUpBlock3dUp block used in the LTXVideo model.
func
python.sglang.multimodal_gen.runtime.models.vaes.minimax_h3_audio_vae.alias_free.sinc(x:torch.Tensor)Implementation of sinc, i.e.
class
python.sglang.multimodal_gen.runtime.models.vaes.wanvae.WanAttentionBlockCausal self-attention with a single head.
class
python.sglang.multimodal_gen.runtime.models.vaes.wanvae.WanDecoder3dA 3D decoder module.
class
python.sglang.multimodal_gen.runtime.models.vaes.wanvae.WanEncoder3dA 3D encoder module.
class
python.sglang.multimodal_gen.runtime.models.vaes.wanvae.WanMidBlockMiddle block for WanVAE encoder and decoder.
class
python.sglang.multimodal_gen.runtime.models.vaes.wanvae.WanRMS_normA custom RMS normalization layer.
class
python.sglang.multimodal_gen.runtime.models.vaes.wanvae.WanResampleA custom resampling module for 2D and 3D data.
class
python.sglang.multimodal_gen.runtime.models.vaes.wanvae.WanResidualBlockA custom residual block module.
class
python.sglang.multimodal_gen.runtime.pipelines.hunyuan3d_pipeline.Hunyuan3D2PipelineHunyuan3D 2.0 image-to-mesh pipeline.
class
python.sglang.multimodal_gen.runtime.pipelines.ltx_2_pipeline.LTX2TwoStageResidencyControllerLTX-2.3 two-stage residency controller.
class
python.sglang.multimodal_gen.runtime.pipelines.mova_pipeline.MOVAPipelineMOVA pipeline with SGLang stage orchestration.
method
python.sglang.multimodal_gen.runtime.pipelines.mova_pipeline.MOVAPipeline.initialize_pipeline(server_args:ServerArgs) -> NoneInitialize the pipeline.
class
python.sglang.multimodal_gen.runtime.pipelines.sana_wm_pipeline.SanaWMPipelineSANA-WM TI2V pipeline (single-stage).
class
python.sglang.multimodal_gen.runtime.pipelines.sana_wm_realtime_pipeline.SanaWMRealtimePipelineSANA-WM realtime interactive pipeline.
class
python.sglang.multimodal_gen.runtime.pipelines.wan_pipeline.WanPipelineWan video diffusion pipeline with LoRA support.
func
python.sglang.multimodal_gen.runtime.pipelines_core.build_pipeline(server_args:ServerArgs) -> PipelineWithLoRAOnly works with valid hf diffusers configs.
class
python.sglang.multimodal_gen.runtime.pipelines_core.schedule_batch.OutputBatchFinal output (after pipeline completion)
class
python.sglang.multimodal_gen.runtime.pipelines_core.stages.base.PipelineStageAbstract base class for all pipeline stages.
method
python.sglang.multimodal_gen.runtime.pipelines_core.stages.base.PipelineStage.device() -> torch.deviceGet the device for this stage.
method
python.sglang.multimodal_gen.runtime.pipelines_core.stages.base.PipelineStage.forward(batch:Req, server_args:ServerArgs) -> ReqForward pass of the stage's processing.
method
python.sglang.multimodal_gen.runtime.pipelines_core.stages.base.PipelineStage.verify_input(batch:Req, server_args:ServerArgs) -> VerificationResultVerify the input for the stage.
method
python.sglang.multimodal_gen.runtime.pipelines_core.stages.base.PipelineStage.verify_output(batch:Req, server_args:ServerArgs) -> VerificationResultVerify the output for the stage.
class
python.sglang.multimodal_gen.runtime.pipelines_core.stages.causal_denoising.CausalDMDDenoisingStageDenoising stage for causal diffusion.
method
python.sglang.multimodal_gen.runtime.pipelines_core.stages.causal_denoising.CausalDMDDenoisingStage.verify_input(batch:Req, server_args:ServerArgs) -> VerificationResultVerify denoising stage inputs.
class
python.sglang.multimodal_gen.runtime.pipelines_core.stages.denoising_dmd.DmdDenoisingStageDenoising stage for DMD.
method
python.sglang.multimodal_gen.runtime.pipelines_core.stages.denoising_dmd.DmdDenoisingStage.forward(batch:Req, server_args:ServerArgs) -> ReqRun the denoising loop.
class
python.sglang.multimodal_gen.runtime.pipelines_core.stages.model_specific_stages.cosmos3.Cosmos3DecodingStageVAE decoding stage for Cosmos3.
class
python.sglang.multimodal_gen.runtime.pipelines_core.stages.model_specific_stages.cosmos3.Cosmos3TokenizationStageTokenization stage for Cosmos3.
class
python.sglang.multimodal_gen.runtime.pipelines_core.stages.model_specific_stages.hunyuan3d.paint.DDIMSolverDDIM solver for fast sampling.
class
python.sglang.multimodal_gen.runtime.pipelines_core.stages.model_specific_stages.minimax_h3.task_profiles.MiniMaxH3TaskProfileOne row of the task table.
class
python.sglang.multimodal_gen.runtime.pipelines_core.stages.model_specific_stages.mova.MOVADenoisingStageRun MOVA dual-tower denoising loop.
method
python.sglang.multimodal_gen.runtime.pipelines_core.stages.model_specific_stages.mova.MOVADenoisingStage.verify_input(batch:Req, server_args:ServerArgs) -> VerificationResultVerify denoising stage inputs.
method
python.sglang.multimodal_gen.runtime.pipelines_core.stages.model_specific_stages.mova.MOVADenoisingStage.verify_output(batch:Req, server_args:ServerArgs) -> VerificationResultVerify denoising stage outputs.
func
python.sglang.multimodal_gen.runtime.pipelines_core.stages.model_specific_stages.sana_wm.parity_probe.dump_obj(dirpath:Path | str | None, name:str, obj) -> NoneSave a picklable object (e.g.
func
python.sglang.multimodal_gen.runtime.pipelines_core.stages.progressive_resolution.spectral_ops.dct_1d(x:torch.Tensor, norm:str='ortho') -> torch.Tensor1-D DCT-II via torch.fft.
class
python.sglang.multimodal_gen.runtime.pipelines_core.stages.validators.StageValidatorsCommon validators for pipeline stages.
method
python.sglang.multimodal_gen.runtime.pipelines_core.stages.validators.StageValidators.bool_value(value:Any) -> boolCheck if value is a boolean.
method
python.sglang.multimodal_gen.runtime.pipelines_core.stages.validators.StageValidators.divisible_by(value:Any, divisor:int) -> boolCheck if value is divisible by divisor.
method
python.sglang.multimodal_gen.runtime.pipelines_core.stages.validators.StageValidators.is_list(value:Any) -> boolCheck if value is a list (can be empty).
method
python.sglang.multimodal_gen.runtime.pipelines_core.stages.validators.StageValidators.is_tuple(value:Any) -> boolCheck if value is a tuple.
method
python.sglang.multimodal_gen.runtime.pipelines_core.stages.validators.StageValidators.list_length(value:Any, length:int) -> boolCheck if list has specific length.
method
python.sglang.multimodal_gen.runtime.pipelines_core.stages.validators.StageValidators.list_not_empty(value:Any) -> boolCheck if value is a non-empty list.
method
python.sglang.multimodal_gen.runtime.pipelines_core.stages.validators.StageValidators.non_negative_float(value:Any) -> boolCheck if value is a non-negative float.
method
python.sglang.multimodal_gen.runtime.pipelines_core.stages.validators.StageValidators.non_negative_int(value:Any) -> boolCheck if value is a non-negative float.
method
python.sglang.multimodal_gen.runtime.pipelines_core.stages.validators.StageValidators.none_or_list(value:Any) -> boolCheck if value is None or a list.
method
python.sglang.multimodal_gen.runtime.pipelines_core.stages.validators.StageValidators.none_or_positive_int(value:Any) -> boolCheck if value is None or a positive integer.
method
python.sglang.multimodal_gen.runtime.pipelines_core.stages.validators.StageValidators.not_none(value:Any) -> boolCheck if value is not None.
method
python.sglang.multimodal_gen.runtime.pipelines_core.stages.validators.StageValidators.positive_float(value:Any) -> boolCheck if value is a positive float.
method
python.sglang.multimodal_gen.runtime.pipelines_core.stages.validators.StageValidators.positive_int(value:Any) -> boolCheck if value is a positive integer.
method
python.sglang.multimodal_gen.runtime.pipelines_core.stages.validators.StageValidators.string_not_empty(value:Any) -> boolCheck if value is a non-empty string.
method
python.sglang.multimodal_gen.runtime.pipelines_core.stages.validators.StageValidators.string_not_none(value:Any) -> boolCheck if value is a non-empty string.
class
python.sglang.multimodal_gen.runtime.pipelines_core.stages.validators.ValidationFailureDetails about a specific validation failure.
class
python.sglang.multimodal_gen.runtime.pipelines_core.stages.validators.VerificationResultWrapper class for stage verification results.
method
python.sglang.multimodal_gen.runtime.pipelines_core.stages.validators.VerificationResult.is_valid() -> boolCheck if all validations passed.
func
python.sglang.multimodal_gen.runtime.platforms.cpu_platform_plugin() -> str | NoneDetect if CPU platform should be used.
method
python.sglang.multimodal_gen.runtime.platforms.interface.Platform.get_current_memory_usage(device:torch.types.Device | None=None) -> floatReturn the memory usage in bytes.
method
python.sglang.multimodal_gen.runtime.platforms.interface.Platform.get_device_name(device_id:int=0) -> strGet the name of a device.
method
python.sglang.multimodal_gen.runtime.platforms.interface.Platform.get_device_total_memory(device_id:int=0) -> intGet the total memory of a device in bytes.
method
python.sglang.multimodal_gen.runtime.platforms.interface.Platform.get_device_uuid(device_id:int=0) -> strGet the uuid of a device, e.g.
method
python.sglang.multimodal_gen.runtime.platforms.interface.Platform.seed_everything(seed:int | None=None) -> NoneSet the seed of each random module.
func
python.sglang.multimodal_gen.runtime.platforms.xpu_platform_plugin() -> str | NoneDetect if Intel XPU platform is available.
class
python.sglang.multimodal_gen.runtime.postprocess.realesrgan_upscaler.ImageUpscalerLazy-loaded Real-ESRGAN upscaler.
method
python.sglang.multimodal_gen.runtime.postprocess.realesrgan_upscaler.ImageUpscaler.upscale(frames:list[np.ndarray]) -> list[np.ndarray]Upscale a list of HWC uint8 frames.
class
python.sglang.multimodal_gen.runtime.postprocess.realesrgan_upscaler.RRDBResidual in Residual Dense Block.
method
python.sglang.multimodal_gen.runtime.postprocess.rife_interpolator.Model.load_model(path:str, strip_module_prefix:bool=True) -> NoneLoad weights from {path}/flownet.pkl.
func
python.sglang.multimodal_gen.runtime.postprocess.rife_interpolator.warp(tenInput:torch.Tensor, tenFlow:torch.Tensor) -> torch.TensorWarp tenInput by tenFlow using grid_sample.
class
python.sglang.multimodal_gen.runtime.realtime.session.BaseRealtimeStateper-session state owned by pipeline stages
class
python.sglang.multimodal_gen.runtime.server_args.server_args.BackendEnumeration for different model backends.
method
python.sglang.multimodal_gen.runtime.server_args.server_args.Backend.from_string(value:str) -> 'Backend'Convert string to Backend enum.
func
python.sglang.multimodal_gen.runtime.server_warmup.get_first_generation_req(req_or_group:Any) -> Req | NoneExtract the first req
func
python.sglang.multimodal_gen.runtime.server_warmup.is_realtime_serving(server_args:ServerArgs) -> boolSynthetic warmup has no realtime session state.
func
python.sglang.multimodal_gen.runtime.server_warmup.is_warmup_req(req_or_group:Any) -> booleither server-based or req-based
func
python.sglang.multimodal_gen.runtime.utils.common.add_prefix(name:str, prefix:str) -> strAdd a weight path prefix to a module name.
func
python.sglang.multimodal_gen.runtime.utils.hf_diffusers_utils.check_gguf_file(model:str | os.PathLike) -> boolCheck if the file is a GGUF model.
method
python.sglang.multimodal_gen.runtime.utils.logging_utils.ColoredFormatter.format(record:logging.LogRecord) -> strAdds color to the log
class
python.sglang.multimodal_gen.runtime.utils.mesh3d_utils.ImageProcessorV2Image processor for Hunyuan3D single-view input.
class
python.sglang.multimodal_gen.runtime.utils.mesh3d_utils.MVImageProcessorV2Multi-view image processor for Hunyuan3D.
func
python.sglang.multimodal_gen.runtime.utils.mesh3d_utils.export_to_trimesh(mesh_output:Any) -> AnyConvert mesh output to trimesh format.
func
python.sglang.multimodal_gen.runtime.utils.mesh3d_utils.get_perspective_projection_matrix(fovy:float, aspect_wh:float, near:float, far:float) -> np.ndarrayCompute perspective projection matrix.
func
python.sglang.multimodal_gen.runtime.utils.mesh3d_utils.mesh_uv_wrap(mesh:Any) -> AnyApply UV unwrapping to mesh.
func
python.sglang.multimodal_gen.runtime.utils.mesh3d_utils.stride_from_shape(shape:Tuple[int, ...]) -> List[int]Compute stride from shape for scatter operations.
func
python.sglang.multimodal_gen.runtime.utils.mesh3d_utils.transform_pos(mtx:Union[np.ndarray, torch.Tensor], pos:torch.Tensor, keepdim:bool=False) -> torch.TensorTransform positions by a matrix.
class
python.sglang.multimodal_gen.runtime.utils.trace_wrapper.DiffStageNamed trace stages for the diffusion pipeline.
func
python.sglang.multimodal_gen.runtime.utils.vision.load_image(image:str | bytes | PIL.Image.Image, convert_method:Callable[[PIL.Image.Image], PIL.Image.Image] | None=None) -> PIL.Image.ImageLoads `image` to a PIL Image.
func
python.sglang.multimodal_gen.runtime.utils.vision.normalize(images:np.ndarray | torch.Tensor) -> np.ndarray | torch.TensorNormalize an image array to [-1,1].
func
python.sglang.multimodal_gen.runtime.utils.vision.numpy_to_pt(images:np.ndarray) -> torch.TensorConvert a NumPy image to a PyTorch tensor.
func
python.sglang.multimodal_gen.runtime.utils.vision.resize(image:PIL.Image.Image | np.ndarray | torch.Tensor, height:int, width:int, resize_mode:str='default', resample:str='lanczos') -> PIL.Image.Image | np.ndarray | torch.TensorResize image.
func
python.sglang.multimodal_gen.runtime.vla.observation.tensor_fingerprint(tensor:torch.Tensor) -> strHash tensor content with SRT's CPU/CUDA implementation.
func
python.sglang.multimodal_gen.utils.get_mixed_precision_state() -> MixedPrecisionStateGet the current mixed precision state.
func
python.sglang.multimodal_gen.utils.resolve_obj_by_qualname(qualname:str) -> AnyResolve an object by its fully qualified name.
func
python.sglang.multimodal_gen.utils.warn_for_unimplemented_methods(cls:type[T]) -> type[T]A replacement for `abc.ABC`.
func
python.sglang.srt.arg_groups.deepseek_v4_hook.validate_deepseek_v4_cp(server_args:ServerArgs) -> NoneValidate DeepSeek V4 context-parallel configuration.
func
python.sglang.srt.arg_groups.overrides.run_post_process_pass(server_args:Any, fn:Callable[..., dict]) -> NoneInvoke one pass at its legacy handler slot.
func
python.sglang.srt.batch_invariant_ops.batch_invariant_ops.log_softmax(input:torch.Tensor, dim:int=-1) -> torch.TensorCompute log_softmax using Triton kernel.
func
python.sglang.srt.batch_invariant_ops.batch_invariant_ops.rms_norm(input:torch.Tensor, weight:torch.Tensor, eps:float=1e-06) -> torch.TensorCompute RMS normalization using Triton kernel.
func
python.sglang.srt.compilation.backend.set_model_tag(tag:str)Context manager to set the model tag.
func
python.sglang.srt.compilation.inductor_pass.get_pass_context() -> PassContextGet the current pass context.
class
python.sglang.srt.compilation.pass_manager.PostGradPassManagerThe pass manager for post-grad passes.
class
python.sglang.srt.configs.dbrx.DbrxAttentionConfigConfiguration class for Dbrx Attention.
class
python.sglang.srt.configs.dbrx.DbrxConfigConfiguration class for Dbrx.
class
python.sglang.srt.configs.dbrx.DbrxFFNConfigConfiguration class for Dbrx FFN.
class
python.sglang.srt.configs.embedding_model_spec.EmbeddingExecutionThe model path that produces an embedding.
class
python.sglang.srt.configs.internvl.InternLM2TokenizerConstruct a InternLM2 tokenizer.
method
python.sglang.srt.configs.internvl.InternLM2Tokenizer.get_vocab()Returns vocab as a dict
method
python.sglang.srt.configs.internvl.InternLM2Tokenizer.vocab_size()Returns vocab size
class
python.sglang.srt.configs.kimi_k25.KimiK25ConfigK2-VL model configuration.
method
python.sglang.srt.configs.kimi_k25.KimiK25Config.vocab_size() -> intGet vocab size from text config for compatibility.
class
python.sglang.srt.configs.lfm2.Lfm2ConfigSGLang configuration for LFM2 models.
method
python.sglang.srt.configs.lfm2.Lfm2Config.mamba_chunk_size() -> intReturn chunk size for Mamba2 backend.
class
python.sglang.srt.configs.lfm2_vl.Lfm2VlConfigSGLang configuration for LFM2-VL models.
method
python.sglang.srt.configs.lfm2_vl.Lfm2VlConfig.mamba_chunk_size() -> intReturn chunk size for Mamba2 backend.
method
python.sglang.srt.configs.model_config.ModelConfig.get_num_kv_heads(tensor_parallel_size) -> intReturns the number of KV heads per GPU.
method
python.sglang.srt.configs.model_config.ModelConfig.get_total_num_kv_heads() -> intReturns the total number of KV heads.
class
python.sglang.srt.connector.azure.AzureBlobConnectorFile connector for Azure Blob Storage.
method
python.sglang.srt.connector.serde.serde.Deserializer.from_bytes(bs:bytes) -> torch.TensorDeserialize a pytorch tensor from bytes.
method
python.sglang.srt.connector.serde.serde.Serializer.to_bytes(t:torch.Tensor) -> bytesSerialize a pytorch tensor to bytes.
func
python.sglang.srt.connector.utils.parse_model_name(url:str) -> strParse the model name from the url.
class
python.sglang.srt.debug_utils.comparator.aligner.token_aligner.smart.types.TokenAlignerPlanToken alignment plan.
func
python.sglang.srt.debug_utils.comparator.dims_spec.tensor_naming.find_dim_index(dim_specs:list[DimSpec], name:str) -> Optional[int]Find index by name.
func
python.sglang.srt.debug_utils.comparator.dims_spec.tensor_naming.get_dim_names(tensor:torch.Tensor) -> tuple[Optional[str], ...]Get dimension names attached to a tensor.
method
python.sglang.srt.debug_utils.comparator.dims_spec.types.DimSpec.sub_dims() -> list[str]Sub-dim names.
func
python.sglang.srt.debug_utils.comparator.entrypoint.parse_args(argv:list[str]) -> argparse.NamespaceParse CLI arguments from an argv list.
class
python.sglang.srt.debug_utils.comparator.report_sink.ReportSinkUnified entry point for all record output.
func
python.sglang.srt.debug_utils.comparator.utils.calc_per_token_rel_diff(x:torch.Tensor, y:torch.Tensor, *seq_dim:int) -> torch.TensorCosine-distance-like metric per token position.
class
python.sglang.srt.debug_utils.source_patcher.types.PatchApplicationErrormatch text not found or not unique in source.
class
python.sglang.srt.disaggregation.base.conn.BaseKVManagerBase class for managing transfer states
class
python.sglang.srt.disaggregation.common.staging_handler.DecodeStagingContextStaging-specific context for decode mode.
method
python.sglang.srt.disaggregation.common.staging_handler.DecodeStagingHandler.create(kv_manager, scheduler, tp_rank:int) -> DecodeStagingHandlerFactory: create handler.
method
python.sglang.srt.disaggregation.common.staging_handler.DecodeStagingHandler.is_staging_room(room:int) -> boolCheck if a room is registered for staging scatter.
method
python.sglang.srt.disaggregation.common.staging_handler.DecodeStagingHandler.submit_last_scatter_async(room:int) -> boolRecord all-ranks Success.
class
python.sglang.srt.disaggregation.common.staging_handler.PrefillStagingContextStaging-specific context for prefill mode.
class
python.sglang.srt.disaggregation.decode.DecodePreallocQueueStore the requests that are preallocating.
method
python.sglang.srt.disaggregation.decode.DecodePreallocQueue.add(req:Req, is_retracted:bool=False, is_rebootstrap:bool=False) -> NoneAdd a request to the pending queue.
method
python.sglang.srt.disaggregation.decode.DecodePreallocQueue.extend(reqs:List[Req], is_retracted:bool=False) -> NoneAdd a request to the pending queue.
class
python.sglang.srt.disaggregation.decode.DecodeTransferQueueStore the requests that is polling kv
class
python.sglang.srt.disaggregation.encode_grpc_server.SGLangEncoderServergRPC service implementation for SGLang encoder.
func
python.sglang.srt.disaggregation.encode_receiver.extract_original_req_id(part_req_id:str) -> strExtract the original request ID from a part request ID.
func
python.sglang.srt.disaggregation.encode_receiver.video_meta_attrs_for(model_type:Optional[str]) -> tupleVideo-meta attrs for model_type.
class
python.sglang.srt.disaggregation.kv_events.KVCacheEventBase class for all KV cache-related events
class
python.sglang.srt.disaggregation.kv_events.KVEventsConfigConfiguration for KV event publishing.
method
python.sglang.srt.disaggregation.kv_events.KVEventsConfig.from_cli(cli_value:str) -> 'KVEventsConfig'Parse the CLI value for the event publisher config.
class
python.sglang.srt.disaggregation.kv_events.NullEventPublisherNo-op implementation (default when disabled).
class
python.sglang.srt.disaggregation.kv_events.StorageMediumStorage tier for KV cache events.
class
python.sglang.srt.disaggregation.nixl.conn.TransferInfoContains indices for a transfer, sent by KVReceiver.
class
python.sglang.srt.disaggregation.nixl.conn.TransferStatusUsed by KV Receiver to know when a transfer is done.
class
python.sglang.srt.disaggregation.prefill.PrefillBootstrapQueueStore the requests in bootstrapping
method
python.sglang.srt.disaggregation.prefill.PrefillBootstrapQueue.finalize_bootstrap(req:Req) -> boolInitialize the sender after bootstrap completes.
func
python.sglang.srt.disaggregation.prefill.should_force_retry(req:Req) -> boolTest hook to force a request into optimistic prefill retry.
func
python.sglang.srt.distributed.device_communicators.custom_all_reduce_utils.gpu_p2p_access_check(src:int, tgt:int) -> boolCheck if GPU src can access GPU tgt.
func
python.sglang.srt.distributed.utils.get_global_tcp_store() -> Optional[TCPStore]Get the existing global TCPStore.
func
python.sglang.srt.distributed.utils.get_pp_indices(num_hidden_layers:int, pp_rank:int, pp_size:int) -> Tuple[int, int]Try to evenly distribute layers across partitions.
class
python.sglang.srt.dllm.mixin.scheduler.DllmManagerManager for Diffusion LLM request scheduling.
method
python.sglang.srt.dllm.mixin.scheduler.DllmManager.add_waiting_reqs(reqs:Union[Req, List[Req]]) -> NoneAdd requests to waiting queue with redundancy check.
method
python.sglang.srt.dllm.mixin.scheduler.DllmManager.any_staging_reqs() -> boolCheck if there are requests in staging queue.
method
python.sglang.srt.dllm.mixin.scheduler.DllmManager.filter_finished_reqs() -> NoneRemove finished requests from both queues.
method
python.sglang.srt.dllm.mixin.scheduler.DllmManager.get_decode_requests() -> List[Req]Get all decode requests from waiting queue.
method
python.sglang.srt.dllm.mixin.scheduler.DllmManager.get_prefill_requests() -> List[Req]Get all prefill requests from waiting queue.
func
python.sglang.srt.elastic_ep.elastic_ep.try_admit_scale_ranks(global_ranks:List[int]) -> boolAdmit append-only ranks into the expandable WORLD group.
class
python.sglang.srt.entrypoints.anthropic.protocol.AnthropicBashToolAnthropic ``bash_*`` server tool family.
class
python.sglang.srt.entrypoints.anthropic.protocol.AnthropicComputerToolAnthropic ``computer_*`` server tool family.
class
python.sglang.srt.entrypoints.anthropic.protocol.AnthropicCountTokensRequestAnthropic count_tokens API request.
class
python.sglang.srt.entrypoints.anthropic.protocol.AnthropicCountTokensResponseAnthropic count_tokens API response.
class
python.sglang.srt.entrypoints.anthropic.protocol.AnthropicErrorError structure for Anthropic API.
class
python.sglang.srt.entrypoints.anthropic.protocol.AnthropicErrorResponseError response structure for Anthropic API.
class
python.sglang.srt.entrypoints.anthropic.protocol.AnthropicMessageEndDeltaDelta carried on ``message_delta`` events.
class
python.sglang.srt.entrypoints.anthropic.protocol.AnthropicMessagesRequestAnthropic Messages API request.
class
python.sglang.srt.entrypoints.anthropic.protocol.AnthropicMessagesResponseAnthropic Messages API response.
class
python.sglang.srt.entrypoints.anthropic.protocol.AnthropicOutputConfigClaude 4.7 ``output_config`` block.
class
python.sglang.srt.entrypoints.anthropic.protocol.AnthropicToolChoiceTool choice strategy.
class
python.sglang.srt.entrypoints.anthropic.protocol.AnthropicUsageToken usage information.
class
python.sglang.srt.entrypoints.anthropic.protocol.AnthropicWebSearchToolAnthropic ``web_search_*`` server tool family.
class
python.sglang.srt.entrypoints.anthropic.serving.AnthropicServingHandler for Anthropic Messages API requests.
func
python.sglang.srt.entrypoints.elastic_ep.scale_elastic_ep(raw_request:Request)Request an asynchronous EP scale-up.
class
python.sglang.srt.entrypoints.engine.EngineThe entry point to the inference engine.
method
python.sglang.srt.entrypoints.engine.Engine.close_session(session_id:str) -> NoneClose a session and release its resources.
この情報について
掲載しているシグネチャは sgl-project/sglang の公開ソースコードを
Python の ast モジュールで静的解析し、引数名・デフォルト値・
型注釈・戻り値型をそのまま抽出したものです。実装コードは保存していません。
詳しくは仕組みの解説をご覧ください。