sglang 0.4.1.post2__py3-none-any.whl → 0.4.1.post4__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- sglang/bench_one_batch.py +2 -0
- sglang/srt/layers/attention/__init__.py +14 -5
- sglang/srt/layers/attention/double_sparsity_backend.py +0 -52
- sglang/srt/layers/attention/flashinfer_backend.py +211 -81
- sglang/srt/layers/attention/torch_native_backend.py +1 -38
- sglang/srt/layers/attention/triton_backend.py +20 -11
- sglang/srt/layers/attention/triton_ops/decode_attention.py +4 -0
- sglang/srt/layers/logits_processor.py +167 -212
- sglang/srt/layers/moe/fused_moe_triton/configs/E=1,N=14336,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a16.json +146 -0
- sglang/srt/layers/moe/fused_moe_triton/configs/E=1,N=14336,device_name=NVIDIA_A100-SXM4-80GB.json +146 -0
- sglang/srt/layers/moe/fused_moe_triton/configs/E=1,N=1792,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a16.json +218 -0
- sglang/srt/layers/moe/fused_moe_triton/configs/E=1,N=1792,device_name=NVIDIA_A100-SXM4-80GB.json +218 -0
- sglang/srt/layers/moe/fused_moe_triton/configs/E=1,N=3072,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a16.json +218 -0
- sglang/srt/layers/moe/fused_moe_triton/configs/E=1,N=3072,device_name=NVIDIA_H100_80GB_HBM3,dtype=int8_w8a16.json +218 -0
- sglang/srt/layers/moe/fused_moe_triton/configs/E=1,N=3072,device_name=NVIDIA_H100_80GB_HBM3.json +218 -0
- sglang/srt/layers/moe/fused_moe_triton/configs/E=1,N=3584,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a16.json +218 -0
- sglang/srt/layers/moe/fused_moe_triton/configs/E=1,N=3584,device_name=NVIDIA_A100-SXM4-80GB.json +218 -0
- sglang/srt/layers/moe/fused_moe_triton/configs/E=1,N=7168,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a16.json +218 -0
- sglang/srt/layers/moe/fused_moe_triton/configs/E=1,N=7168,device_name=NVIDIA_A100-SXM4-80GB.json +218 -0
- sglang/srt/layers/moe/fused_moe_triton/configs/E=16,N=1344,device_name=NVIDIA_A100-SXM4-40GB.json +146 -0
- sglang/srt/layers/moe/fused_moe_triton/configs/E=16,N=1344,device_name=NVIDIA_A100-SXM4-80GB.json +146 -0
- sglang/srt/layers/moe/fused_moe_triton/configs/E=16,N=1344,device_name=NVIDIA_H100_80GB_HBM3.json +146 -0
- sglang/srt/layers/moe/fused_moe_triton/configs/E=16,N=14336,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a16.json +146 -0
- sglang/srt/layers/moe/fused_moe_triton/configs/E=16,N=14336,device_name=NVIDIA_A100-SXM4-80GB.json +146 -0
- sglang/srt/layers/moe/fused_moe_triton/configs/E=16,N=1792,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a16.json +218 -0
- sglang/srt/layers/moe/fused_moe_triton/configs/E=16,N=1792,device_name=NVIDIA_A100-SXM4-80GB.json +218 -0
- sglang/srt/layers/moe/fused_moe_triton/configs/E=16,N=2688,device_name=NVIDIA_A100-SXM4-80GB.json +146 -0
- sglang/srt/layers/moe/fused_moe_triton/configs/E=16,N=2688,device_name=NVIDIA_H100_80GB_HBM3.json +146 -0
- sglang/srt/layers/moe/fused_moe_triton/configs/E=16,N=3072,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a16.json +146 -0
- sglang/srt/layers/moe/fused_moe_triton/configs/E=16,N=3072,device_name=NVIDIA_H100_80GB_HBM3,dtype=int8_w8a16.json +146 -0
- sglang/srt/layers/moe/fused_moe_triton/configs/E=16,N=3200,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8.json +130 -0
- sglang/srt/layers/moe/fused_moe_triton/configs/E=16,N=3584,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a16.json +146 -0
- sglang/srt/layers/moe/fused_moe_triton/configs/E=16,N=3584,device_name=NVIDIA_A100-SXM4-80GB.json +218 -0
- sglang/srt/layers/moe/fused_moe_triton/configs/E=16,N=6400,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8.json +130 -0
- sglang/srt/layers/moe/fused_moe_triton/configs/E=16,N=7168,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a16.json +146 -0
- sglang/srt/layers/moe/fused_moe_triton/configs/E=16,N=7168,device_name=NVIDIA_A100-SXM4-80GB.json +146 -0
- sglang/srt/layers/moe/fused_moe_triton/configs/E=16,N=7168,device_name=NVIDIA_H100_80GB_HBM3,dtype=int8_w8a16.json +146 -0
- sglang/srt/layers/moe/fused_moe_triton/configs/E=16,N=800,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8.json +130 -0
- sglang/srt/layers/moe/fused_moe_triton/configs/E=256,N=128,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8,block_shape=[128, 128].json +146 -0
- sglang/srt/layers/moe/fused_moe_triton/configs/E=256,N=256,device_name=NVIDIA_H200,dtype=fp8_w8a8,block_shape=[128, 128].json +146 -0
- sglang/srt/layers/moe/fused_moe_triton/configs/E=64,N=1280,device_name=NVIDIA_A100-SXM4-80GB.json +146 -0
- sglang/srt/layers/moe/fused_moe_triton/configs/E=64,N=1280,device_name=NVIDIA_A800-SXM4-80GB.json +146 -0
- sglang/srt/layers/moe/fused_moe_triton/configs/E=64,N=1280,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8.json +146 -0
- sglang/srt/layers/moe/fused_moe_triton/configs/E=64,N=1280,device_name=NVIDIA_H100_80GB_HBM3.json +146 -0
- sglang/srt/layers/moe/fused_moe_triton/configs/E=64,N=1280,device_name=NVIDIA_H200,dtype=fp8_w8a8.json +146 -0
- sglang/srt/layers/moe/fused_moe_triton/configs/E=64,N=1280,device_name=NVIDIA_H200.json +146 -0
- sglang/srt/layers/moe/fused_moe_triton/configs/E=64,N=2560,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8.json +146 -0
- sglang/srt/layers/moe/fused_moe_triton/configs/E=64,N=2560,device_name=NVIDIA_H200,dtype=fp8_w8a8.json +146 -0
- sglang/srt/layers/moe/fused_moe_triton/configs/E=64,N=2560,device_name=NVIDIA_H200.json +146 -0
- sglang/srt/layers/moe/fused_moe_triton/configs/E=64,N=320,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8.json +146 -0
- sglang/srt/layers/moe/fused_moe_triton/configs/E=64,N=320,device_name=NVIDIA_H100_80GB_HBM3.json +146 -0
- sglang/srt/layers/moe/fused_moe_triton/configs/E=64,N=320,device_name=NVIDIA_H200,dtype=fp8_w8a8.json +146 -0
- sglang/srt/layers/moe/fused_moe_triton/configs/E=64,N=320,device_name=NVIDIA_H200.json +146 -0
- sglang/srt/layers/moe/fused_moe_triton/configs/E=64,N=640,device_name=NVIDIA_A100-SXM4-80GB.json +146 -0
- sglang/srt/layers/moe/fused_moe_triton/configs/E=64,N=640,device_name=NVIDIA_A800-SXM4-80GB.json +146 -0
- sglang/srt/layers/moe/fused_moe_triton/configs/E=64,N=640,device_name=NVIDIA_GeForce_RTX_4090,dtype=fp8_w8a8.json +146 -0
- sglang/srt/layers/moe/fused_moe_triton/configs/E=64,N=640,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8.json +146 -0
- sglang/srt/layers/moe/fused_moe_triton/configs/E=64,N=640,device_name=NVIDIA_H100_80GB_HBM3.json +146 -0
- sglang/srt/layers/moe/fused_moe_triton/configs/E=64,N=640,device_name=NVIDIA_H200,dtype=fp8_w8a8.json +146 -0
- sglang/srt/layers/moe/fused_moe_triton/configs/E=64,N=640,device_name=NVIDIA_H200.json +146 -0
- sglang/srt/layers/moe/fused_moe_triton/configs/E=8,N=14336,device_name=AMD_Instinct_MI300X.json +200 -0
- sglang/srt/layers/moe/fused_moe_triton/configs/E=8,N=14336,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8.json +138 -0
- sglang/srt/layers/moe/fused_moe_triton/configs/E=8,N=14336,device_name=NVIDIA_H200,dtype=fp8_w8a8.json +146 -0
- sglang/srt/layers/moe/fused_moe_triton/configs/E=8,N=14336,device_name=NVIDIA_H200.json +146 -0
- sglang/srt/layers/moe/fused_moe_triton/configs/E=8,N=1792,device_name=AMD_Instinct_MI300X.json +200 -0
- sglang/srt/layers/moe/fused_moe_triton/configs/E=8,N=1792,device_name=NVIDIA_A100-SXM4-40GB.json +146 -0
- sglang/srt/layers/moe/fused_moe_triton/configs/E=8,N=1792,device_name=NVIDIA_A100-SXM4-80GB.json +146 -0
- sglang/srt/layers/moe/fused_moe_triton/configs/E=8,N=1792,device_name=NVIDIA_H100_80GB_HBM3.json +146 -0
- sglang/srt/layers/moe/fused_moe_triton/configs/E=8,N=1792,device_name=NVIDIA_H200,dtype=fp8_w8a8.json +146 -0
- sglang/srt/layers/moe/fused_moe_triton/configs/E=8,N=1792,device_name=NVIDIA_H200.json +146 -0
- sglang/srt/layers/moe/fused_moe_triton/configs/E=8,N=2048,device_name=NVIDIA_A100-SXM4-80GB.json +146 -0
- sglang/srt/layers/moe/fused_moe_triton/configs/E=8,N=2048,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8.json +146 -0
- sglang/srt/layers/moe/fused_moe_triton/configs/E=8,N=2048,device_name=NVIDIA_H100_80GB_HBM3.json +146 -0
- sglang/srt/layers/moe/fused_moe_triton/configs/E=8,N=2048,device_name=NVIDIA_H200,dtype=fp8_w8a8.json +146 -0
- sglang/srt/layers/moe/fused_moe_triton/configs/E=8,N=2048,device_name=NVIDIA_H200.json +146 -0
- sglang/srt/layers/moe/fused_moe_triton/configs/E=8,N=3584,device_name=AMD_Instinct_MI300X.json +200 -0
- sglang/srt/layers/moe/fused_moe_triton/configs/E=8,N=3584,device_name=NVIDIA_A100-SXM4-40GB.json +146 -0
- sglang/srt/layers/moe/fused_moe_triton/configs/E=8,N=3584,device_name=NVIDIA_A100-SXM4-80GB.json +146 -0
- sglang/srt/layers/moe/fused_moe_triton/configs/E=8,N=3584,device_name=NVIDIA_GeForce_RTX_4090,dtype=fp8_w8a8.json +146 -0
- sglang/srt/layers/moe/fused_moe_triton/configs/E=8,N=3584,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8.json +146 -0
- sglang/srt/layers/moe/fused_moe_triton/configs/E=8,N=3584,device_name=NVIDIA_H100_80GB_HBM3.json +146 -0
- sglang/srt/layers/moe/fused_moe_triton/configs/E=8,N=3584,device_name=NVIDIA_H200,dtype=fp8_w8a8.json +146 -0
- sglang/srt/layers/moe/fused_moe_triton/configs/E=8,N=3584,device_name=NVIDIA_H200.json +146 -0
- sglang/srt/layers/moe/fused_moe_triton/configs/E=8,N=3584,device_name=NVIDIA_L40S.json +173 -0
- sglang/srt/layers/moe/fused_moe_triton/configs/E=8,N=4096,device_name=AMD_Instinct_MI300X,dtype=fp8_w8a8.json +178 -0
- sglang/srt/layers/moe/fused_moe_triton/configs/E=8,N=4096,device_name=NVIDIA_A100-SXM4-80GB.json +146 -0
- sglang/srt/layers/moe/fused_moe_triton/configs/E=8,N=4096,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8.json +146 -0
- sglang/srt/layers/moe/fused_moe_triton/configs/E=8,N=4096,device_name=NVIDIA_H100_80GB_HBM3.json +146 -0
- sglang/srt/layers/moe/fused_moe_triton/configs/E=8,N=4096,device_name=NVIDIA_H200,dtype=fp8_w8a8.json +146 -0
- sglang/srt/layers/moe/fused_moe_triton/configs/E=8,N=4096,device_name=NVIDIA_H200.json +146 -0
- sglang/srt/layers/moe/fused_moe_triton/configs/E=8,N=7168,device_name=AMD_Instinct_MI300X.json +200 -0
- sglang/srt/layers/moe/fused_moe_triton/configs/E=8,N=7168,device_name=NVIDIA_A100-SXM4-80GB.json +146 -0
- sglang/srt/layers/moe/fused_moe_triton/configs/E=8,N=7168,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8.json +146 -0
- sglang/srt/layers/moe/fused_moe_triton/configs/E=8,N=7168,device_name=NVIDIA_H100_80GB_HBM3.json +146 -0
- sglang/srt/layers/moe/fused_moe_triton/configs/E=8,N=7168,device_name=NVIDIA_H200,dtype=fp8_w8a8.json +146 -0
- sglang/srt/layers/moe/fused_moe_triton/configs/E=8,N=7168,device_name=NVIDIA_H200.json +146 -0
- sglang/srt/layers/moe/fused_moe_triton/configs/E=8,N=8192,device_name=AMD_Instinct_MI300X,dtype=fp8_w8a8.json +175 -0
- sglang/srt/layers/moe/fused_moe_triton/configs/E=8,N=8192,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8.json +146 -0
- sglang/srt/layers/moe/fused_moe_triton/configs/E=8,N=8192,device_name=NVIDIA_H200,dtype=fp8_w8a8.json +146 -0
- sglang/srt/layers/moe/fused_moe_triton/fused_moe.py +187 -29
- sglang/srt/layers/moe/fused_moe_triton/layer.py +14 -6
- sglang/srt/layers/quantization/configs/N=1536,K=1536,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8,block_shape=[128, 128].json +146 -0
- sglang/srt/layers/quantization/configs/N=1536,K=7168,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8,block_shape=[128, 128].json +146 -0
- sglang/srt/layers/quantization/configs/N=1536,K=7168,device_name=NVIDIA_H200,dtype=fp8_w8a8,block_shape=[128, 128].json +146 -0
- sglang/srt/layers/quantization/configs/N=2048,K=512,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8,block_shape=[128, 128].json +146 -0
- sglang/srt/layers/quantization/configs/N=2048,K=512,device_name=NVIDIA_H200,dtype=fp8_w8a8,block_shape=[128, 128].json +146 -0
- sglang/srt/layers/quantization/configs/N=2304,K=7168,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8,block_shape=[128, 128].json +146 -0
- sglang/srt/layers/quantization/configs/N=2304,K=7168,device_name=NVIDIA_H200,dtype=fp8_w8a8,block_shape=[128, 128].json +146 -0
- sglang/srt/layers/quantization/configs/N=24576,K=7168,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8,block_shape=[128, 128].json +146 -0
- sglang/srt/layers/quantization/configs/N=24576,K=7168,device_name=NVIDIA_H200,dtype=fp8_w8a8,block_shape=[128, 128].json +146 -0
- sglang/srt/layers/quantization/configs/N=256,K=7168,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8,block_shape=[128, 128].json +146 -0
- sglang/srt/layers/quantization/configs/N=3072,K=1536,device_name=NVIDIA_H200,dtype=fp8_w8a8,block_shape=[128, 128].json +146 -0
- sglang/srt/layers/quantization/configs/N=3072,K=7168,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8,block_shape=[128, 128].json +146 -0
- sglang/srt/layers/quantization/configs/N=3072,K=7168,device_name=NVIDIA_H200,dtype=fp8_w8a8,block_shape=[128, 128].json +146 -0
- sglang/srt/layers/quantization/configs/N=32768,K=512,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8,block_shape=[128, 128].json +146 -0
- sglang/srt/layers/quantization/configs/N=32768,K=512,device_name=NVIDIA_H200,dtype=fp8_w8a8,block_shape=[128, 128].json +146 -0
- sglang/srt/layers/quantization/configs/N=36864,K=7168,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8,block_shape=[128, 128].json +146 -0
- sglang/srt/layers/quantization/configs/N=36864,K=7168,device_name=NVIDIA_H200,dtype=fp8_w8a8,block_shape=[128, 128].json +146 -0
- sglang/srt/layers/quantization/configs/N=4096,K=512,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8,block_shape=[128, 128].json +146 -0
- sglang/srt/layers/quantization/configs/N=4096,K=512,device_name=NVIDIA_H200,dtype=fp8_w8a8,block_shape=[128, 128].json +146 -0
- sglang/srt/layers/quantization/configs/N=4608,K=7168,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8,block_shape=[128, 128].json +146 -0
- sglang/srt/layers/quantization/configs/N=4608,K=7168,device_name=NVIDIA_H200,dtype=fp8_w8a8,block_shape=[128, 128].json +146 -0
- sglang/srt/layers/quantization/configs/N=512,K=7168,device_name=NVIDIA_H200,dtype=fp8_w8a8,block_shape=[128, 128].json +146 -0
- sglang/srt/layers/quantization/configs/N=576,K=7168,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8,block_shape=[128, 128].json +146 -0
- sglang/srt/layers/quantization/configs/N=576,K=7168,device_name=NVIDIA_H200,dtype=fp8_w8a8,block_shape=[128, 128].json +146 -0
- sglang/srt/layers/quantization/configs/N=7168,K=1024,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8,block_shape=[128, 128].json +146 -0
- sglang/srt/layers/quantization/configs/N=7168,K=1024,device_name=NVIDIA_H200,dtype=fp8_w8a8,block_shape=[128, 128].json +146 -0
- sglang/srt/layers/quantization/configs/N=7168,K=1152,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8,block_shape=[128, 128].json +146 -0
- sglang/srt/layers/quantization/configs/N=7168,K=1152,device_name=NVIDIA_H200,dtype=fp8_w8a8,block_shape=[128, 128].json +146 -0
- sglang/srt/layers/quantization/configs/N=7168,K=128,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8,block_shape=[128, 128].json +146 -0
- sglang/srt/layers/quantization/configs/N=7168,K=16384,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8,block_shape=[128, 128].json +146 -0
- sglang/srt/layers/quantization/configs/N=7168,K=16384,device_name=NVIDIA_H200,dtype=fp8_w8a8,block_shape=[128, 128].json +146 -0
- sglang/srt/layers/quantization/configs/N=7168,K=18432,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8,block_shape=[128, 128].json +146 -0
- sglang/srt/layers/quantization/configs/N=7168,K=18432,device_name=NVIDIA_H200,dtype=fp8_w8a8,block_shape=[128, 128].json +146 -0
- sglang/srt/layers/quantization/configs/N=7168,K=2048,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8,block_shape=[128, 128].json +146 -0
- sglang/srt/layers/quantization/configs/N=7168,K=2048,device_name=NVIDIA_H200,dtype=fp8_w8a8,block_shape=[128, 128].json +146 -0
- sglang/srt/layers/quantization/configs/N=7168,K=2304,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8,block_shape=[128, 128].json +146 -0
- sglang/srt/layers/quantization/configs/N=7168,K=2304,device_name=NVIDIA_H200,dtype=fp8_w8a8,block_shape=[128, 128].json +146 -0
- sglang/srt/layers/quantization/configs/N=7168,K=256,device_name=NVIDIA_H200,dtype=fp8_w8a8,block_shape=[128, 128].json +146 -0
- sglang/srt/layers/quantization/fp8.py +2 -2
- sglang/srt/layers/sampler.py +57 -21
- sglang/srt/layers/torchao_utils.py +17 -3
- sglang/srt/managers/detokenizer_manager.py +2 -0
- sglang/srt/managers/io_struct.py +12 -3
- sglang/srt/managers/schedule_batch.py +26 -2
- sglang/srt/managers/schedule_policy.py +159 -90
- sglang/srt/managers/scheduler.py +71 -27
- sglang/srt/managers/tokenizer_manager.py +29 -20
- sglang/srt/managers/tp_worker.py +16 -4
- sglang/srt/managers/tp_worker_overlap_thread.py +3 -4
- sglang/srt/model_executor/cuda_graph_runner.py +118 -73
- sglang/srt/model_executor/forward_batch_info.py +33 -8
- sglang/srt/model_executor/model_runner.py +63 -61
- sglang/srt/models/deepseek_v2.py +34 -7
- sglang/srt/models/grok.py +97 -26
- sglang/srt/openai_api/adapter.py +0 -17
- sglang/srt/openai_api/protocol.py +3 -3
- sglang/srt/sampling/sampling_batch_info.py +21 -0
- sglang/srt/sampling/sampling_params.py +9 -1
- sglang/srt/server.py +9 -5
- sglang/srt/server_args.py +109 -51
- sglang/srt/speculative/build_eagle_tree.py +347 -0
- sglang/srt/speculative/eagle_utils.py +618 -0
- sglang/srt/speculative/eagle_worker.py +170 -0
- sglang/srt/speculative/spec_info.py +5 -0
- sglang/srt/utils.py +15 -2
- sglang/version.py +1 -1
- {sglang-0.4.1.post2.dist-info → sglang-0.4.1.post4.dist-info}/METADATA +9 -8
- sglang-0.4.1.post4.dist-info/RECORD +329 -0
- {sglang-0.4.1.post2.dist-info → sglang-0.4.1.post4.dist-info}/WHEEL +1 -1
- sglang-0.4.1.post2.dist-info/RECORD +0 -197
- {sglang-0.4.1.post2.dist-info → sglang-0.4.1.post4.dist-info}/LICENSE +0 -0
- {sglang-0.4.1.post2.dist-info → sglang-0.4.1.post4.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,170 @@
|
|
1
|
+
from typing import List, Optional, Union
|
2
|
+
|
3
|
+
import torch
|
4
|
+
|
5
|
+
from sglang.srt.layers.logits_processor import LogitsProcessorOutput
|
6
|
+
from sglang.srt.managers.schedule_batch import Req, ScheduleBatch
|
7
|
+
from sglang.srt.managers.tp_worker import TpModelWorker
|
8
|
+
from sglang.srt.model_executor.forward_batch_info import (
|
9
|
+
CaptureHiddenMode,
|
10
|
+
ForwardBatch,
|
11
|
+
ForwardMode,
|
12
|
+
)
|
13
|
+
from sglang.srt.model_executor.model_runner import ModelRunner
|
14
|
+
from sglang.srt.server_args import ServerArgs
|
15
|
+
from sglang.srt.speculative.eagle_utils import EAGLEDraftInput
|
16
|
+
|
17
|
+
|
18
|
+
class EAGLEWorker(TpModelWorker):
|
19
|
+
|
20
|
+
def __init__(
|
21
|
+
self,
|
22
|
+
server_args: ServerArgs,
|
23
|
+
gpu_id: int,
|
24
|
+
tp_rank: int,
|
25
|
+
dp_rank: Optional[int],
|
26
|
+
nccl_port: int,
|
27
|
+
target_worker: TpModelWorker,
|
28
|
+
):
|
29
|
+
# Do not capture cuda graph in `super().__init__()`
|
30
|
+
# We will capture it later
|
31
|
+
backup_disable_cuda_graph = server_args.disable_cuda_graph
|
32
|
+
server_args.disable_cuda_graph = True
|
33
|
+
super().__init__(
|
34
|
+
gpu_id=gpu_id,
|
35
|
+
tp_rank=tp_rank,
|
36
|
+
server_args=server_args,
|
37
|
+
nccl_port=nccl_port,
|
38
|
+
dp_rank=dp_rank,
|
39
|
+
is_draft_worker=True,
|
40
|
+
)
|
41
|
+
self.target_worker = target_worker
|
42
|
+
self.server_args = server_args
|
43
|
+
|
44
|
+
# Share the embedding and lm_head
|
45
|
+
embed, head = self.target_worker.model_runner.model.get_embed_and_head()
|
46
|
+
self.model_runner.model.set_embed_and_head(embed, head)
|
47
|
+
self.model_runner.server_args.disable_cuda_graph = backup_disable_cuda_graph
|
48
|
+
self.model_runner.init_cuda_graphs()
|
49
|
+
|
50
|
+
def forward_draft_decode(self, batch: ScheduleBatch):
|
51
|
+
batch.spec_info.prepare_for_decode(batch)
|
52
|
+
model_worker_batch = batch.get_model_worker_batch()
|
53
|
+
forward_batch = ForwardBatch.init_new(model_worker_batch, self.model_runner)
|
54
|
+
forward_batch.spec_info.capture_hidden_mode = CaptureHiddenMode.LAST
|
55
|
+
logits_output = self.model_runner.forward(forward_batch)
|
56
|
+
self.capture_for_decode(logits_output, forward_batch)
|
57
|
+
|
58
|
+
def forward_draft_extend(self, batch: ScheduleBatch):
|
59
|
+
self._swap_mem_pool(batch, self.model_runner)
|
60
|
+
batch.spec_info.prepare_for_extend(batch)
|
61
|
+
model_worker_batch = batch.get_model_worker_batch()
|
62
|
+
forward_batch = ForwardBatch.init_new(model_worker_batch, self.model_runner)
|
63
|
+
forward_batch.spec_info.capture_hidden_mode = CaptureHiddenMode.LAST
|
64
|
+
logits_output = self.model_runner.forward(forward_batch)
|
65
|
+
self.capture_for_decode(logits_output, forward_batch)
|
66
|
+
self._swap_mem_pool(batch, self.target_worker.model_runner)
|
67
|
+
|
68
|
+
def forward_batch_speculative_generation(self, batch: ScheduleBatch):
|
69
|
+
if batch.forward_mode.is_decode():
|
70
|
+
prev_spec_info = batch.spec_info
|
71
|
+
self._swap_mem_pool(batch, self.model_runner)
|
72
|
+
for i in range(self.server_args.speculative_num_steps):
|
73
|
+
self.forward_draft_decode(batch)
|
74
|
+
batch.spec_info.clear_draft_cache(batch)
|
75
|
+
self._swap_mem_pool(batch, self.target_worker.model_runner)
|
76
|
+
(
|
77
|
+
next_draft_input,
|
78
|
+
logits_output,
|
79
|
+
verified_id,
|
80
|
+
self.finish_extend_len,
|
81
|
+
model_worker_batch,
|
82
|
+
) = self.verify(batch)
|
83
|
+
next_draft_input.init(self.server_args)
|
84
|
+
batch.spec_info = next_draft_input
|
85
|
+
# if it is None, means all requsets are finished
|
86
|
+
if batch.spec_info.verified_id is not None:
|
87
|
+
self.forward_extend_after_decode(batch)
|
88
|
+
batch.spec_info = prev_spec_info
|
89
|
+
return logits_output, verified_id, model_worker_batch, next_draft_input
|
90
|
+
|
91
|
+
else:
|
92
|
+
spec_info = EAGLEDraftInput()
|
93
|
+
spec_info.init(self.server_args)
|
94
|
+
model_worker_batch = batch.get_model_worker_batch()
|
95
|
+
model_worker_batch.spec_info = spec_info
|
96
|
+
spec_info.capture_hidden_mode = CaptureHiddenMode.FULL
|
97
|
+
logits_output, next_token_ids = self.target_worker.forward_batch_generation(
|
98
|
+
model_worker_batch
|
99
|
+
)
|
100
|
+
model_worker_batch.spec_info.verified_id = next_token_ids
|
101
|
+
model_worker_batch.spec_info.hidden_states = logits_output.hidden_states
|
102
|
+
batch.spec_info = spec_info
|
103
|
+
self.forward_draft_extend(batch)
|
104
|
+
batch.spec_info = None
|
105
|
+
return logits_output, next_token_ids, model_worker_batch, spec_info
|
106
|
+
|
107
|
+
def verify(self, batch: ScheduleBatch):
|
108
|
+
verify_input = batch.spec_info.prepare_for_verify(batch)
|
109
|
+
batch.forward_mode = ForwardMode.TARGET_VERIFY
|
110
|
+
verify_input.prepare_for_verify(batch)
|
111
|
+
batch.spec_info = verify_input
|
112
|
+
batch.spec_info.capture_hidden_mode = CaptureHiddenMode.FULL
|
113
|
+
model_worker_batch = batch.get_model_worker_batch()
|
114
|
+
logits_output, _ = self.target_worker.forward_batch_generation(
|
115
|
+
model_worker_batch, skip_sample=True
|
116
|
+
)
|
117
|
+
verify_input.hidden_states = logits_output.hidden_states
|
118
|
+
res = verify_input.verify(batch, logits_output)
|
119
|
+
batch.forward_mode = ForwardMode.DECODE
|
120
|
+
return res + (model_worker_batch,)
|
121
|
+
|
122
|
+
def _swap_mem_pool(self, batch: ScheduleBatch, runner: ModelRunner):
|
123
|
+
batch.token_to_kv_pool = runner.token_to_kv_pool
|
124
|
+
batch.req_to_token_pool = runner.req_to_token_pool
|
125
|
+
|
126
|
+
def forward_extend_after_decode(self, batch: ScheduleBatch):
|
127
|
+
self._swap_mem_pool(batch, self.model_runner)
|
128
|
+
batch.forward_mode = ForwardMode.DRAFT_EXTEND
|
129
|
+
if batch.spec_info.has_finished:
|
130
|
+
index = batch.spec_info.unfinished_index
|
131
|
+
seq_lens = batch.seq_lens
|
132
|
+
batch.seq_lens = batch.seq_lens[index]
|
133
|
+
batch.spec_info.prepare_extend_after_decode(batch)
|
134
|
+
model_worker_batch = batch.get_model_worker_batch()
|
135
|
+
forward_batch = ForwardBatch.init_new(model_worker_batch, self.model_runner)
|
136
|
+
forward_batch.spec_info.capture_hidden_mode = CaptureHiddenMode.LAST
|
137
|
+
logits_output = self.model_runner.forward(forward_batch)
|
138
|
+
batch.spec_info.hidden_states = logits_output.hidden_states
|
139
|
+
self.capture_for_decode(logits_output, forward_batch)
|
140
|
+
batch.forward_mode = ForwardMode.DECODE
|
141
|
+
if batch.spec_info.has_finished:
|
142
|
+
batch.seq_lens = seq_lens
|
143
|
+
self._swap_mem_pool(batch, self.target_worker.model_runner)
|
144
|
+
|
145
|
+
def capture_for_decode(self, logits_output, forward_batch):
|
146
|
+
if isinstance(logits_output, LogitsProcessorOutput):
|
147
|
+
logits = logits_output.next_token_logits
|
148
|
+
sample_output = torch.softmax(
|
149
|
+
logits, dim=-1
|
150
|
+
) # TODO: Support more sampling method @kavioyu
|
151
|
+
forward_batch.spec_info.capture_for_decode(
|
152
|
+
sample_output, logits_output.hidden_states, forward_batch.forward_mode
|
153
|
+
)
|
154
|
+
|
155
|
+
# Don't support prefix share now.
|
156
|
+
def finish_request(self, reqs: Union[Req, List[Req]]):
|
157
|
+
if not isinstance(reqs, List):
|
158
|
+
reqs = [reqs]
|
159
|
+
for req in reqs:
|
160
|
+
req_len = (
|
161
|
+
len(req.origin_input_ids)
|
162
|
+
+ len(req.output_ids)
|
163
|
+
- self.finish_extend_len[req.rid]
|
164
|
+
- 1
|
165
|
+
)
|
166
|
+
kv_indices = self.model_runner.req_to_token_pool.req_to_token[
|
167
|
+
req.req_pool_idx
|
168
|
+
][:req_len]
|
169
|
+
self.model_runner.token_to_kv_pool.free(kv_indices)
|
170
|
+
self.model_runner.req_to_token_pool.free(req.req_pool_idx)
|
@@ -2,8 +2,12 @@ from enum import IntEnum, auto
|
|
2
2
|
|
3
3
|
|
4
4
|
class SpeculativeAlgorithm(IntEnum):
|
5
|
+
NONE = auto()
|
5
6
|
EAGLE = auto()
|
6
7
|
|
8
|
+
def is_none(self):
|
9
|
+
return self == SpeculativeAlgorithm.NONE
|
10
|
+
|
7
11
|
def is_eagle(self):
|
8
12
|
return self == SpeculativeAlgorithm.EAGLE
|
9
13
|
|
@@ -11,6 +15,7 @@ class SpeculativeAlgorithm(IntEnum):
|
|
11
15
|
def from_string(name: str):
|
12
16
|
name_map = {
|
13
17
|
"EAGLE": SpeculativeAlgorithm.EAGLE,
|
18
|
+
None: SpeculativeAlgorithm.NONE,
|
14
19
|
}
|
15
20
|
return name_map[name]
|
16
21
|
|
sglang/srt/utils.py
CHANGED
@@ -15,6 +15,7 @@
|
|
15
15
|
|
16
16
|
import base64
|
17
17
|
import dataclasses
|
18
|
+
import io
|
18
19
|
import ipaddress
|
19
20
|
import itertools
|
20
21
|
import json
|
@@ -34,6 +35,7 @@ import warnings
|
|
34
35
|
from functools import lru_cache
|
35
36
|
from importlib.metadata import PackageNotFoundError, version
|
36
37
|
from io import BytesIO
|
38
|
+
from multiprocessing.reduction import ForkingPickler
|
37
39
|
from typing import Any, Callable, Dict, List, Optional, Protocol, Tuple, Union
|
38
40
|
|
39
41
|
import numpy as np
|
@@ -60,7 +62,6 @@ from triton.runtime.cache import (
|
|
60
62
|
|
61
63
|
logger = logging.getLogger(__name__)
|
62
64
|
|
63
|
-
|
64
65
|
show_time_cost = False
|
65
66
|
time_infos = {}
|
66
67
|
|
@@ -1206,7 +1207,6 @@ def _cuda_device_count_stateless(cuda_visible_devices: Optional[str] = None) ->
|
|
1206
1207
|
# https://github.com/pytorch/pytorch/blob/
|
1207
1208
|
# c1cd946818442aca8c7f812b16d187ce1586c3bc/
|
1208
1209
|
# torch/cuda/__init__.py#L831C1-L831C17
|
1209
|
-
import torch.cuda
|
1210
1210
|
import torch.version
|
1211
1211
|
|
1212
1212
|
if not torch.cuda._is_compiled():
|
@@ -1335,3 +1335,16 @@ def parse_tool_response(text, tools, **kwargs):
|
|
1335
1335
|
for call_info in call_info_list
|
1336
1336
|
]
|
1337
1337
|
return text, call_info_list
|
1338
|
+
|
1339
|
+
|
1340
|
+
class MultiprocessingSerializer:
|
1341
|
+
@staticmethod
|
1342
|
+
def serialize(obj):
|
1343
|
+
buf = io.BytesIO()
|
1344
|
+
ForkingPickler(buf).dump(obj)
|
1345
|
+
buf.seek(0)
|
1346
|
+
return buf.read()
|
1347
|
+
|
1348
|
+
@staticmethod
|
1349
|
+
def deserialize(data):
|
1350
|
+
return ForkingPickler.loads(data)
|
sglang/version.py
CHANGED
@@ -1 +1 @@
|
|
1
|
-
__version__ = "0.4.1.
|
1
|
+
__version__ = "0.4.1.post4"
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: sglang
|
3
|
-
Version: 0.4.1.
|
3
|
+
Version: 0.4.1.post4
|
4
4
|
Summary: SGLang is yet another fast serving framework for large language models and vision language models.
|
5
5
|
License: Apache License
|
6
6
|
Version 2.0, January 2004
|
@@ -243,11 +243,11 @@ Requires-Dist: torch; extra == "srt"
|
|
243
243
|
Requires-Dist: vllm<=0.6.4.post1,>=0.6.3.post1; extra == "srt"
|
244
244
|
Requires-Dist: cuda-python; extra == "srt"
|
245
245
|
Requires-Dist: flashinfer==0.1.6; extra == "srt"
|
246
|
-
Requires-Dist: sgl-kernel>=0.0.2.
|
246
|
+
Requires-Dist: sgl-kernel>=0.0.2.post11; extra == "srt"
|
247
247
|
Provides-Extra: srt-hip
|
248
248
|
Requires-Dist: sglang[runtime_common]; extra == "srt-hip"
|
249
249
|
Requires-Dist: torch; extra == "srt-hip"
|
250
|
-
Requires-Dist: vllm==0.6.3.
|
250
|
+
Requires-Dist: vllm==0.6.3.post2.dev1; extra == "srt-hip"
|
251
251
|
Provides-Extra: srt-xpu
|
252
252
|
Requires-Dist: sglang[runtime_common]; extra == "srt-xpu"
|
253
253
|
Provides-Extra: srt-hpu
|
@@ -315,7 +315,7 @@ Requires-Dist: sglang[test]; extra == "dev-hpu"
|
|
315
315
|
|
316
316
|
| [**Blog**](https://lmsys.org/blog/2024-07-25-sglang-llama3/)
|
317
317
|
| [**Documentation**](https://sgl-project.github.io/)
|
318
|
-
| [**Join Slack**](https://join.slack.com/t/sgl-fru7574/shared_invite/zt-
|
318
|
+
| [**Join Slack**](https://join.slack.com/t/sgl-fru7574/shared_invite/zt-2um0ad92q-LkU19KQTxCGzlCgRiOiQEw)
|
319
319
|
| [**Join Bi-Weekly Development Meeting**](https://docs.google.com/document/d/1xEow4eIM152xNcRxqZz9VEcOiTQo8-CEuuQ5qTmkt-E/edit?usp=sharing)
|
320
320
|
| [**Slides**](https://github.com/sgl-project/sgl-learning-materials?tab=readme-ov-file#slides) |
|
321
321
|
|
@@ -347,9 +347,10 @@ The core features include:
|
|
347
347
|
|
348
348
|
## Getting Started
|
349
349
|
- [Install SGLang](https://sgl-project.github.io/start/install.html)
|
350
|
-
- [
|
351
|
-
- [Backend
|
352
|
-
- [Frontend
|
350
|
+
- [Quick Start](https://sgl-project.github.io/start/send_request.html)
|
351
|
+
- [Backend Tutorial](https://sgl-project.github.io/backend/openai_api_completions.html)
|
352
|
+
- [Frontend Tutorial](https://sgl-project.github.io/frontend/frontend.html)
|
353
|
+
- [Contribution Guide](https://sgl-project.github.io/references/contribution_guide.html)
|
353
354
|
|
354
355
|
## Benchmark and Performance
|
355
356
|
Learn more in our release blogs: [v0.2 blog](https://lmsys.org/blog/2024-07-25-sglang-llama3/), [v0.3 blog](https://lmsys.org/blog/2024-09-04-sglang-v0-3/), [v0.4 blog](https://lmsys.org/blog/2024-12-04-sglang-v0-4/)
|
@@ -361,5 +362,5 @@ Learn more in our release blogs: [v0.2 blog](https://lmsys.org/blog/2024-07-25-s
|
|
361
362
|
The project is supported by (alphabetically): AMD, Baseten, DataCrunch, Etched, Hyperbolic, Jam & Tea Studios, LinkedIn, LMSYS.org, Meituan, NVIDIA, RunPod, Stanford, UC Berkeley, UCLA, xAI, 01.AI.
|
362
363
|
|
363
364
|
## Acknowledgment and Citation
|
364
|
-
We learned
|
365
|
+
We learned the design and reused code from the following projects: [Guidance](https://github.com/guidance-ai/guidance), [vLLM](https://github.com/vllm-project/vllm), [LightLLM](https://github.com/ModelTC/lightllm), [FlashInfer](https://github.com/flashinfer-ai/flashinfer), [Outlines](https://github.com/outlines-dev/outlines), and [LMQL](https://github.com/eth-sri/lmql).
|
365
366
|
Please cite the paper, [SGLang: Efficient Execution of Structured Language Model Programs](https://arxiv.org/abs/2312.07104), if you find the project useful.
|