sglang 0.4.6.post4__py3-none-any.whl → 0.4.7__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_offline_throughput.py +16 -10
- sglang/bench_one_batch.py +5 -4
- sglang/bench_one_batch_server.py +86 -22
- sglang/bench_serving.py +197 -110
- sglang/compile_deep_gemm.py +4 -4
- sglang/lang/backend/runtime_endpoint.py +24 -1
- sglang/profiler.py +167 -0
- sglang/srt/_custom_ops.py +34 -0
- sglang/srt/configs/internvl.py +8 -12
- sglang/srt/configs/model_config.py +66 -29
- sglang/srt/constrained/base_grammar_backend.py +5 -2
- sglang/srt/constrained/llguidance_backend.py +9 -8
- sglang/srt/constrained/outlines_backend.py +5 -4
- sglang/srt/constrained/xgrammar_backend.py +18 -18
- sglang/srt/conversation.py +47 -9
- sglang/srt/custom_op.py +38 -3
- sglang/srt/debug_utils.py +74 -0
- sglang/srt/disaggregation/common/__init__.py +1 -0
- sglang/srt/disaggregation/common/conn.py +407 -0
- sglang/srt/disaggregation/decode.py +187 -134
- sglang/srt/disaggregation/decode_schedule_batch_mixin.py +142 -0
- sglang/srt/disaggregation/fake/conn.py +4 -13
- sglang/srt/disaggregation/kv_events.py +412 -0
- sglang/srt/disaggregation/launch_lb.py +140 -0
- sglang/srt/disaggregation/mini_lb.py +84 -70
- sglang/srt/disaggregation/mooncake/conn.py +441 -140
- sglang/srt/disaggregation/mooncake/transfer_engine.py +31 -14
- sglang/srt/disaggregation/nixl/conn.py +124 -442
- sglang/srt/disaggregation/prefill.py +128 -44
- sglang/srt/disaggregation/utils.py +154 -6
- sglang/srt/distributed/device_communicators/pymscclpp.py +315 -0
- sglang/srt/distributed/parallel_state.py +52 -5
- sglang/srt/distributed/utils.py +3 -3
- sglang/srt/entrypoints/EngineBase.py +11 -0
- sglang/srt/entrypoints/engine.py +129 -12
- sglang/srt/entrypoints/http_server.py +21 -6
- sglang/srt/entrypoints/http_server_engine.py +5 -2
- sglang/srt/function_call/base_format_detector.py +302 -0
- sglang/srt/function_call/core_types.py +34 -0
- sglang/srt/function_call/deepseekv3_detector.py +205 -0
- sglang/srt/function_call/ebnf_composer.py +248 -0
- sglang/srt/function_call/function_call_parser.py +202 -0
- sglang/srt/function_call/llama32_detector.py +93 -0
- sglang/srt/function_call/mistral_detector.py +131 -0
- sglang/srt/function_call/pythonic_detector.py +229 -0
- sglang/srt/function_call/qwen25_detector.py +121 -0
- sglang/srt/function_call/utils.py +52 -0
- sglang/srt/hf_transformers_utils.py +50 -7
- sglang/srt/layers/attention/aiter_backend.py +878 -0
- sglang/srt/layers/attention/base_attn_backend.py +4 -0
- sglang/srt/layers/attention/cutlass_mla_backend.py +2 -19
- sglang/srt/layers/attention/flashattention_backend.py +166 -35
- sglang/srt/layers/attention/flashinfer_backend.py +45 -1
- sglang/srt/layers/attention/flashinfer_mla_backend.py +45 -5
- sglang/srt/layers/attention/flashmla_backend.py +340 -78
- sglang/srt/layers/attention/intel_amx_backend.py +128 -0
- sglang/srt/layers/attention/tbo_backend.py +232 -0
- sglang/srt/layers/attention/torch_native_backend.py +3 -0
- sglang/srt/layers/attention/triton_backend.py +247 -5
- sglang/srt/layers/attention/triton_ops/extend_attention.py +12 -4
- sglang/srt/layers/attention/utils.py +2 -2
- sglang/srt/layers/attention/vision.py +1 -1
- sglang/srt/layers/communicator.py +517 -0
- sglang/srt/layers/dp_attention.py +6 -15
- sglang/srt/layers/layernorm.py +30 -19
- sglang/srt/layers/moe/cutlass_moe.py +370 -0
- sglang/srt/layers/moe/cutlass_moe_params.py +169 -0
- sglang/srt/layers/moe/ep_moe/kernels.py +60 -17
- sglang/srt/layers/moe/ep_moe/layer.py +195 -87
- sglang/srt/layers/moe/ep_moe/token_dispatcher.py +88 -8
- sglang/srt/layers/moe/fused_moe_native.py +4 -0
- sglang/srt/layers/moe/fused_moe_triton/configs/triton_3_2_0/E=257,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/triton_3_2_0/E=257,N=128,device_name=NVIDIA_H20,dtype=fp8_w8a8,block_shape=[128, 128].json +146 -0
- sglang/srt/layers/moe/fused_moe_triton/configs/triton_3_2_0/E=257,N=256,device_name=NVIDIA_B200,dtype=fp8_w8a8,block_shape=[128, 128].json +146 -0
- sglang/srt/layers/moe/fused_moe_triton/configs/triton_3_2_0/E=257,N=256,device_name=NVIDIA_H20,dtype=fp8_w8a8,block_shape=[128, 128].json +146 -0
- sglang/srt/layers/moe/fused_moe_triton/configs/triton_3_2_0/E=257,N=256,device_name=NVIDIA_H200,dtype=fp8_w8a8,block_shape=[128, 128].json +146 -0
- sglang/srt/layers/moe/fused_moe_triton/configs/triton_3_2_0/E=8,N=7168,device_name=NVIDIA_H100_80GB_HBM3.json +146 -0
- sglang/srt/layers/moe/fused_moe_triton/configs/triton_3_3_1/E=257,N=256,device_name=NVIDIA_B200,dtype=fp8_w8a8,block_shape=[128, 128].json +146 -0
- sglang/srt/layers/moe/fused_moe_triton/configs/triton_3_3_1/E=8,N=7168,device_name=NVIDIA_H100_80GB_HBM3.json +146 -0
- sglang/srt/layers/moe/fused_moe_triton/fused_moe.py +220 -25
- sglang/srt/layers/moe/fused_moe_triton/layer.py +48 -4
- sglang/srt/layers/moe/topk.py +107 -24
- sglang/srt/layers/multimodal.py +70 -0
- sglang/srt/layers/quantization/__init__.py +10 -4
- sglang/srt/layers/quantization/blockwise_int8.py +3 -0
- sglang/srt/layers/quantization/compressed_tensors/compressed_tensors_moe.py +5 -0
- sglang/srt/layers/quantization/deep_gemm.py +60 -59
- sglang/srt/layers/quantization/fp8.py +113 -18
- sglang/srt/layers/quantization/fp8_kernel.py +118 -66
- sglang/srt/layers/quantization/fp8_utils.py +165 -43
- sglang/srt/layers/quantization/gptq.py +298 -6
- sglang/srt/layers/quantization/int8_kernel.py +18 -5
- sglang/srt/layers/quantization/modelopt_quant.py +334 -7
- sglang/srt/layers/quantization/moe_wna16.py +3 -0
- sglang/srt/layers/quantization/qoq.py +244 -0
- sglang/srt/layers/quantization/w8a8_fp8.py +3 -0
- sglang/srt/layers/quantization/w8a8_int8.py +3 -0
- sglang/srt/layers/rotary_embedding.py +6 -12
- sglang/srt/layers/sampler.py +80 -79
- sglang/srt/layers/utils.py +6 -0
- sglang/srt/lora/layers.py +12 -15
- sglang/srt/lora/lora.py +49 -5
- sglang/srt/lora/lora_manager.py +20 -8
- sglang/srt/lora/mem_pool.py +24 -16
- sglang/srt/lora/utils.py +17 -13
- sglang/srt/managers/data_parallel_controller.py +13 -5
- sglang/srt/managers/eplb_algorithms/__init__.py +63 -0
- sglang/srt/managers/eplb_algorithms/deepseek.py +223 -0
- sglang/srt/managers/eplb_algorithms/deepseek_vec.py +276 -0
- sglang/srt/managers/eplb_manager.py +96 -0
- sglang/srt/managers/expert_distribution.py +878 -56
- sglang/srt/managers/expert_location.py +448 -0
- sglang/srt/managers/expert_location_dispatch.py +108 -0
- sglang/srt/managers/io_struct.py +29 -5
- sglang/srt/managers/mm_utils.py +355 -151
- sglang/srt/managers/multimodal_processors/base_processor.py +299 -42
- sglang/srt/managers/multimodal_processors/deepseek_vl_v2.py +6 -1
- sglang/srt/managers/multimodal_processors/gemma3.py +15 -17
- sglang/srt/managers/multimodal_processors/internvl.py +18 -5
- sglang/srt/managers/multimodal_processors/janus_pro.py +7 -1
- sglang/srt/managers/multimodal_processors/kimi_vl.py +14 -32
- sglang/srt/managers/multimodal_processors/llava.py +3 -3
- sglang/srt/managers/multimodal_processors/minicpm.py +27 -32
- sglang/srt/managers/multimodal_processors/mllama4.py +6 -0
- sglang/srt/managers/multimodal_processors/phi4mm.py +87 -0
- sglang/srt/managers/multimodal_processors/pixtral.py +9 -9
- sglang/srt/managers/multimodal_processors/qwen_vl.py +35 -35
- sglang/srt/managers/schedule_batch.py +185 -55
- sglang/srt/managers/schedule_policy.py +4 -5
- sglang/srt/managers/scheduler.py +389 -154
- sglang/srt/managers/session_controller.py +1 -1
- sglang/srt/managers/tokenizer_manager.py +231 -39
- sglang/srt/managers/utils.py +0 -4
- sglang/srt/mem_cache/base_prefix_cache.py +3 -0
- sglang/srt/mem_cache/chunk_cache.py +3 -1
- sglang/srt/mem_cache/hiradix_cache.py +4 -4
- sglang/srt/mem_cache/memory_pool.py +74 -52
- sglang/srt/mem_cache/multimodal_cache.py +45 -0
- sglang/srt/mem_cache/radix_cache.py +58 -5
- sglang/srt/metrics/collector.py +11 -2
- sglang/srt/mm_utils.py +10 -0
- sglang/srt/model_executor/cuda_graph_runner.py +87 -65
- sglang/srt/model_executor/expert_location_updater.py +557 -0
- sglang/srt/model_executor/forward_batch_info.py +39 -14
- sglang/srt/model_executor/model_runner.py +231 -101
- sglang/srt/model_loader/loader.py +10 -6
- sglang/srt/model_loader/utils.py +67 -1
- sglang/srt/models/clip.py +5 -1
- sglang/srt/models/deepseek_nextn.py +1 -1
- sglang/srt/models/deepseek_v2.py +732 -403
- sglang/srt/models/exaone.py +8 -3
- sglang/srt/models/gemma3_causal.py +7 -0
- sglang/srt/models/gemma3_mm.py +75 -33
- sglang/srt/models/idefics2.py +342 -0
- sglang/srt/models/kimi_vl.py +4 -4
- sglang/srt/models/llama.py +1 -1
- sglang/srt/models/llama4.py +10 -2
- sglang/srt/models/llava.py +26 -18
- sglang/srt/models/mimo_mtp.py +220 -0
- sglang/srt/models/minicpmo.py +7 -17
- sglang/srt/models/minicpmv.py +3 -295
- sglang/srt/models/mistral.py +71 -1
- sglang/srt/models/mllama.py +3 -3
- sglang/srt/models/phi4mm.py +512 -0
- sglang/srt/models/qwen2.py +133 -35
- sglang/srt/models/qwen2_5_vl.py +5 -3
- sglang/srt/models/qwen2_eagle.py +4 -1
- sglang/srt/models/qwen2_moe.py +206 -69
- sglang/srt/models/qwen2_vl.py +3 -3
- sglang/srt/models/qwen3.py +92 -19
- sglang/srt/models/qwen3_moe.py +457 -55
- sglang/srt/models/registry.py +9 -1
- sglang/srt/models/siglip.py +294 -0
- sglang/srt/models/transformers.py +291 -0
- sglang/srt/openai_api/adapter.py +114 -40
- sglang/srt/openai_api/protocol.py +37 -2
- sglang/srt/openai_api/utils.py +172 -0
- sglang/srt/operations.py +189 -0
- sglang/srt/operations_strategy.py +207 -0
- sglang/srt/sampling/sampling_batch_info.py +13 -1
- sglang/srt/sampling/sampling_params.py +2 -1
- sglang/srt/server_args.py +235 -38
- sglang/srt/speculative/build_eagle_tree.py +8 -8
- sglang/srt/speculative/eagle_draft_cuda_graph_runner.py +8 -11
- sglang/srt/speculative/eagle_draft_extend_cuda_graph_runner.py +253 -0
- sglang/srt/speculative/eagle_utils.py +181 -90
- sglang/srt/speculative/eagle_worker.py +146 -21
- sglang/srt/two_batch_overlap.py +635 -0
- sglang/srt/utils.py +197 -19
- sglang/test/runners.py +16 -7
- sglang/test/send_one.py +4 -0
- sglang/test/test_cutlass_moe.py +278 -0
- sglang/test/test_fp4_moe.py +248 -0
- sglang/test/test_utils.py +81 -42
- sglang/utils.py +2 -2
- sglang/version.py +1 -1
- {sglang-0.4.6.post4.dist-info → sglang-0.4.7.dist-info}/METADATA +31 -19
- sglang-0.4.7.dist-info/RECORD +699 -0
- {sglang-0.4.6.post4.dist-info → sglang-0.4.7.dist-info}/WHEEL +1 -1
- sglang/srt/function_call_parser.py +0 -858
- sglang/srt/platforms/interface.py +0 -371
- sglang-0.4.6.post4.dist-info/RECORD +0 -646
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=1,N=14336,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a16.json → triton_3_1_0/E=1,N=14336,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a16.json} +0 -0
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=1,N=14336,device_name=NVIDIA_A100-SXM4-80GB.json → triton_3_1_0/E=1,N=14336,device_name=NVIDIA_A100-SXM4-80GB.json} +0 -0
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=1,N=1792,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a16.json → triton_3_1_0/E=1,N=1792,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a16.json} +0 -0
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=1,N=1792,device_name=NVIDIA_A100-SXM4-80GB.json → triton_3_1_0/E=1,N=1792,device_name=NVIDIA_A100-SXM4-80GB.json} +0 -0
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=1,N=3072,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a16.json → triton_3_1_0/E=1,N=3072,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a16.json} +0 -0
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=1,N=3072,device_name=NVIDIA_H100_80GB_HBM3,dtype=int8_w8a16.json → triton_3_1_0/E=1,N=3072,device_name=NVIDIA_H100_80GB_HBM3,dtype=int8_w8a16.json} +0 -0
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=1,N=3072,device_name=NVIDIA_H100_80GB_HBM3.json → triton_3_1_0/E=1,N=3072,device_name=NVIDIA_H100_80GB_HBM3.json} +0 -0
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=1,N=3584,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a16.json → triton_3_1_0/E=1,N=3584,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a16.json} +0 -0
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=1,N=3584,device_name=NVIDIA_A100-SXM4-80GB.json → triton_3_1_0/E=1,N=3584,device_name=NVIDIA_A100-SXM4-80GB.json} +0 -0
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=1,N=7168,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a16.json → triton_3_1_0/E=1,N=7168,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a16.json} +0 -0
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=1,N=7168,device_name=NVIDIA_A100-SXM4-80GB.json → triton_3_1_0/E=1,N=7168,device_name=NVIDIA_A100-SXM4-80GB.json} +0 -0
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=144,N=512,device_name=NVIDIA_H100_80GB_HBM3.json → triton_3_1_0/E=144,N=512,device_name=NVIDIA_H100_80GB_HBM3.json} +0 -0
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=16,N=1024,device_name=NVIDIA_H100_80GB_HBM3.json → triton_3_1_0/E=16,N=1024,device_name=NVIDIA_H100_80GB_HBM3.json} +0 -0
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=16,N=1024,device_name=NVIDIA_H200.json → triton_3_1_0/E=16,N=1024,device_name=NVIDIA_H200.json} +0 -0
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=16,N=1344,device_name=NVIDIA_A100-SXM4-40GB.json → triton_3_1_0/E=16,N=1344,device_name=NVIDIA_A100-SXM4-40GB.json} +0 -0
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=16,N=1344,device_name=NVIDIA_A100-SXM4-80GB.json → triton_3_1_0/E=16,N=1344,device_name=NVIDIA_A100-SXM4-80GB.json} +0 -0
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=16,N=1344,device_name=NVIDIA_H100_80GB_HBM3.json → triton_3_1_0/E=16,N=1344,device_name=NVIDIA_H100_80GB_HBM3.json} +0 -0
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=16,N=14336,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a16.json → triton_3_1_0/E=16,N=14336,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a16.json} +0 -0
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=16,N=14336,device_name=NVIDIA_A100-SXM4-80GB.json → triton_3_1_0/E=16,N=14336,device_name=NVIDIA_A100-SXM4-80GB.json} +0 -0
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=16,N=1792,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a16.json → triton_3_1_0/E=16,N=1792,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a16.json} +0 -0
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=16,N=1792,device_name=NVIDIA_A100-SXM4-80GB.json → triton_3_1_0/E=16,N=1792,device_name=NVIDIA_A100-SXM4-80GB.json} +0 -0
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=16,N=2048,device_name=NVIDIA_H100_80GB_HBM3.json → triton_3_1_0/E=16,N=2048,device_name=NVIDIA_H100_80GB_HBM3.json} +0 -0
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=16,N=2688,device_name=NVIDIA_A100-SXM4-80GB.json → triton_3_1_0/E=16,N=2688,device_name=NVIDIA_A100-SXM4-80GB.json} +0 -0
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=16,N=2688,device_name=NVIDIA_H100_80GB_HBM3.json → triton_3_1_0/E=16,N=2688,device_name=NVIDIA_H100_80GB_HBM3.json} +0 -0
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=16,N=3072,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a16.json → triton_3_1_0/E=16,N=3072,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a16.json} +0 -0
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=16,N=3072,device_name=NVIDIA_H100_80GB_HBM3,dtype=int8_w8a16.json → triton_3_1_0/E=16,N=3072,device_name=NVIDIA_H100_80GB_HBM3,dtype=int8_w8a16.json} +0 -0
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=16,N=3200,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8.json → triton_3_1_0/E=16,N=3200,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8.json} +0 -0
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=16,N=3584,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a16.json → triton_3_1_0/E=16,N=3584,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a16.json} +0 -0
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=16,N=3584,device_name=NVIDIA_A100-SXM4-80GB.json → triton_3_1_0/E=16,N=3584,device_name=NVIDIA_A100-SXM4-80GB.json} +0 -0
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=16,N=6400,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8.json → triton_3_1_0/E=16,N=6400,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8.json} +0 -0
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=16,N=7168,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a16.json → triton_3_1_0/E=16,N=7168,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a16.json} +0 -0
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=16,N=7168,device_name=NVIDIA_A100-SXM4-80GB.json → triton_3_1_0/E=16,N=7168,device_name=NVIDIA_A100-SXM4-80GB.json} +0 -0
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=16,N=7168,device_name=NVIDIA_H100_80GB_HBM3,dtype=int8_w8a16.json → triton_3_1_0/E=16,N=7168,device_name=NVIDIA_H100_80GB_HBM3,dtype=int8_w8a16.json} +0 -0
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=16,N=800,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8.json → triton_3_1_0/E=16,N=800,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8.json} +0 -0
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=160,N=192,device_name=NVIDIA_A800-SXM4-80GB.json → triton_3_1_0/E=160,N=192,device_name=NVIDIA_A800-SXM4-80GB.json} +0 -0
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=20,N=2048,device_name=NVIDIA_H100_80GB_HBM3.json → triton_3_1_0/E=20,N=2048,device_name=NVIDIA_H100_80GB_HBM3.json} +0 -0
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=24,N=1024,device_name=NVIDIA_H100_80GB_HBM3.json → triton_3_1_0/E=24,N=1024,device_name=NVIDIA_H100_80GB_HBM3.json} +0 -0
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=256,N=128,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a8,block_shape=[128, 128].json → triton_3_1_0/E=256,N=128,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a8,block_shape=[128, 128].json} +0 -0
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=256,N=128,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a8.json → triton_3_1_0/E=256,N=128,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a8.json} +0 -0
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=256,N=128,device_name=NVIDIA_A800-SXM4-80GB,dtype=int8_w8a8,block_shape=[128, 128].json → triton_3_1_0/E=256,N=128,device_name=NVIDIA_A800-SXM4-80GB,dtype=int8_w8a8,block_shape=[128, 128].json} +0 -0
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=256,N=128,device_name=NVIDIA_A800-SXM4-80GB,dtype=int8_w8a8.json → triton_3_1_0/E=256,N=128,device_name=NVIDIA_A800-SXM4-80GB,dtype=int8_w8a8.json} +0 -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 → triton_3_1_0/E=256,N=128,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8,block_shape=[128, 128].json} +0 -0
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=256,N=128,device_name=NVIDIA_H20,block_shape=[128, 128].json → triton_3_1_0/E=256,N=128,device_name=NVIDIA_H20,block_shape=[128, 128].json} +0 -0
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=256,N=128,device_name=NVIDIA_H20,dtype=fp8_w8a8,block_shape=[128, 128].json → triton_3_1_0/E=256,N=128,device_name=NVIDIA_H20,dtype=fp8_w8a8,block_shape=[128, 128].json} +0 -0
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=256,N=128,device_name=NVIDIA_L20Y,dtype=fp8_w8a8,block_shape=[128, 128].json → triton_3_1_0/E=256,N=128,device_name=NVIDIA_L20Y,dtype=fp8_w8a8,block_shape=[128, 128].json} +0 -0
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=256,N=256,device_name=AMD_Instinct_MI300X,dtype=fp8_w8a8,block_shape=[128, 128].json → triton_3_1_0/E=256,N=256,device_name=AMD_Instinct_MI300X,dtype=fp8_w8a8,block_shape=[128, 128].json} +0 -0
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=256,N=256,device_name=AMD_Instinct_MI325X,dtype=fp8_w8a8,block_shape=[128, 128].json → triton_3_1_0/E=256,N=256,device_name=AMD_Instinct_MI325X,dtype=fp8_w8a8,block_shape=[128, 128].json} +0 -0
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=256,N=256,device_name=AMD_Radeon_Graphics,dtype=fp8_w8a8,block_shape=[128, 128].json → triton_3_1_0/E=256,N=256,device_name=AMD_Radeon_Graphics,dtype=fp8_w8a8,block_shape=[128, 128].json} +0 -0
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=256,N=256,device_name=NVIDIA_B200,dtype=fp8_w8a8,block_shape=[128, 128].json → triton_3_1_0/E=256,N=256,device_name=NVIDIA_B200,dtype=fp8_w8a8,block_shape=[128, 128].json} +0 -0
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=256,N=256,device_name=NVIDIA_H20,dtype=int8_w8a8,block_shape=[128, 128].json → triton_3_1_0/E=256,N=256,device_name=NVIDIA_H20,dtype=int8_w8a8,block_shape=[128, 128].json} +0 -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 → triton_3_1_0/E=256,N=256,device_name=NVIDIA_H200,dtype=fp8_w8a8,block_shape=[128, 128].json} +0 -0
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=256,N=64,device_name=NVIDIA_A800-SXM4-80GB.json → triton_3_1_0/E=256,N=64,device_name=NVIDIA_A800-SXM4-80GB.json} +0 -0
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=256,N=64,device_name=NVIDIA_L20,dtype=int8_w8a8.json → triton_3_1_0/E=256,N=64,device_name=NVIDIA_L20,dtype=int8_w8a8.json} +0 -0
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=256,N=64,device_name=NVIDIA_L40S,dtype=int8_w8a8.json → triton_3_1_0/E=256,N=64,device_name=NVIDIA_L40S,dtype=int8_w8a8.json} +0 -0
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=64,N=1024,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8,block_shape=[128, 128].json → triton_3_1_0/E=64,N=1024,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8,block_shape=[128, 128].json} +0 -0
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=64,N=1280,device_name=NVIDIA_A100-SXM4-80GB.json → triton_3_1_0/E=64,N=1280,device_name=NVIDIA_A100-SXM4-80GB.json} +0 -0
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=64,N=1280,device_name=NVIDIA_A800-SXM4-80GB.json → triton_3_1_0/E=64,N=1280,device_name=NVIDIA_A800-SXM4-80GB.json} +0 -0
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=64,N=1280,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8.json → triton_3_1_0/E=64,N=1280,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8.json} +0 -0
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=64,N=1280,device_name=NVIDIA_H100_80GB_HBM3.json → triton_3_1_0/E=64,N=1280,device_name=NVIDIA_H100_80GB_HBM3.json} +0 -0
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=64,N=1280,device_name=NVIDIA_H200,dtype=fp8_w8a8.json → triton_3_1_0/E=64,N=1280,device_name=NVIDIA_H200,dtype=fp8_w8a8.json} +0 -0
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=64,N=1280,device_name=NVIDIA_H200.json → triton_3_1_0/E=64,N=1280,device_name=NVIDIA_H200.json} +0 -0
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=64,N=2560,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8.json → triton_3_1_0/E=64,N=2560,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8.json} +0 -0
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=64,N=2560,device_name=NVIDIA_H200,dtype=fp8_w8a8.json → triton_3_1_0/E=64,N=2560,device_name=NVIDIA_H200,dtype=fp8_w8a8.json} +0 -0
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=64,N=2560,device_name=NVIDIA_H200.json → triton_3_1_0/E=64,N=2560,device_name=NVIDIA_H200.json} +0 -0
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=64,N=320,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8.json → triton_3_1_0/E=64,N=320,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8.json} +0 -0
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=64,N=320,device_name=NVIDIA_H100_80GB_HBM3.json → triton_3_1_0/E=64,N=320,device_name=NVIDIA_H100_80GB_HBM3.json} +0 -0
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=64,N=320,device_name=NVIDIA_H200,dtype=fp8_w8a8.json → triton_3_1_0/E=64,N=320,device_name=NVIDIA_H200,dtype=fp8_w8a8.json} +0 -0
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=64,N=320,device_name=NVIDIA_H200.json → triton_3_1_0/E=64,N=320,device_name=NVIDIA_H200.json} +0 -0
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=64,N=512,device_name=NVIDIA_H200,dtype=fp8_w8a8,block_shape=[128, 128].json → triton_3_1_0/E=64,N=512,device_name=NVIDIA_H200,dtype=fp8_w8a8,block_shape=[128, 128].json} +0 -0
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=64,N=640,device_name=NVIDIA_A100-SXM4-80GB.json → triton_3_1_0/E=64,N=640,device_name=NVIDIA_A100-SXM4-80GB.json} +0 -0
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=64,N=640,device_name=NVIDIA_A800-SXM4-80GB.json → triton_3_1_0/E=64,N=640,device_name=NVIDIA_A800-SXM4-80GB.json} +0 -0
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=64,N=640,device_name=NVIDIA_GeForce_RTX_4090,dtype=fp8_w8a8.json → triton_3_1_0/E=64,N=640,device_name=NVIDIA_GeForce_RTX_4090,dtype=fp8_w8a8.json} +0 -0
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=64,N=640,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8.json → triton_3_1_0/E=64,N=640,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8.json} +0 -0
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=64,N=640,device_name=NVIDIA_H100_80GB_HBM3.json → triton_3_1_0/E=64,N=640,device_name=NVIDIA_H100_80GB_HBM3.json} +0 -0
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=64,N=640,device_name=NVIDIA_H200,dtype=fp8_w8a8.json → triton_3_1_0/E=64,N=640,device_name=NVIDIA_H200,dtype=fp8_w8a8.json} +0 -0
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=64,N=640,device_name=NVIDIA_H200.json → triton_3_1_0/E=64,N=640,device_name=NVIDIA_H200.json} +0 -0
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=8,N=14336,device_name=AMD_Instinct_MI300X.json → triton_3_1_0/E=8,N=14336,device_name=AMD_Instinct_MI300X.json} +0 -0
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=8,N=14336,device_name=AMD_Instinct_MI325X.json → triton_3_1_0/E=8,N=14336,device_name=AMD_Instinct_MI325X.json} +0 -0
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=8,N=14336,device_name=AMD_Radeon_Graphics.json → triton_3_1_0/E=8,N=14336,device_name=AMD_Radeon_Graphics.json} +0 -0
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=8,N=14336,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8.json → triton_3_1_0/E=8,N=14336,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8.json} +0 -0
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=8,N=14336,device_name=NVIDIA_H200,dtype=fp8_w8a8.json → triton_3_1_0/E=8,N=14336,device_name=NVIDIA_H200,dtype=fp8_w8a8.json} +0 -0
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=8,N=14336,device_name=NVIDIA_H200.json → triton_3_1_0/E=8,N=14336,device_name=NVIDIA_H200.json} +0 -0
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=8,N=1792,device_name=AMD_Instinct_MI300X.json → triton_3_1_0/E=8,N=1792,device_name=AMD_Instinct_MI300X.json} +0 -0
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=8,N=1792,device_name=AMD_Instinct_MI325X.json → triton_3_1_0/E=8,N=1792,device_name=AMD_Instinct_MI325X.json} +0 -0
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=8,N=1792,device_name=AMD_Radeon_Graphics.json → triton_3_1_0/E=8,N=1792,device_name=AMD_Radeon_Graphics.json} +0 -0
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=8,N=1792,device_name=NVIDIA_A100-SXM4-40GB.json → triton_3_1_0/E=8,N=1792,device_name=NVIDIA_A100-SXM4-40GB.json} +0 -0
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=8,N=1792,device_name=NVIDIA_A100-SXM4-80GB.json → triton_3_1_0/E=8,N=1792,device_name=NVIDIA_A100-SXM4-80GB.json} +0 -0
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=8,N=1792,device_name=NVIDIA_H100_80GB_HBM3.json → triton_3_1_0/E=8,N=1792,device_name=NVIDIA_H100_80GB_HBM3.json} +0 -0
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=8,N=1792,device_name=NVIDIA_H200,dtype=fp8_w8a8.json → triton_3_1_0/E=8,N=1792,device_name=NVIDIA_H200,dtype=fp8_w8a8.json} +0 -0
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=8,N=1792,device_name=NVIDIA_H200.json → triton_3_1_0/E=8,N=1792,device_name=NVIDIA_H200.json} +0 -0
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=8,N=2048,device_name=NVIDIA_A100-SXM4-80GB.json → triton_3_1_0/E=8,N=2048,device_name=NVIDIA_A100-SXM4-80GB.json} +0 -0
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=8,N=2048,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8.json → triton_3_1_0/E=8,N=2048,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8.json} +0 -0
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=8,N=2048,device_name=NVIDIA_H100_80GB_HBM3.json → triton_3_1_0/E=8,N=2048,device_name=NVIDIA_H100_80GB_HBM3.json} +0 -0
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=8,N=2048,device_name=NVIDIA_H200,dtype=fp8_w8a8.json → triton_3_1_0/E=8,N=2048,device_name=NVIDIA_H200,dtype=fp8_w8a8.json} +0 -0
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=8,N=2048,device_name=NVIDIA_H200.json → triton_3_1_0/E=8,N=2048,device_name=NVIDIA_H200.json} +0 -0
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=8,N=3584,device_name=AMD_Instinct_MI300X.json → triton_3_1_0/E=8,N=3584,device_name=AMD_Instinct_MI300X.json} +0 -0
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=8,N=3584,device_name=AMD_Instinct_MI325X.json → triton_3_1_0/E=8,N=3584,device_name=AMD_Instinct_MI325X.json} +0 -0
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=8,N=3584,device_name=AMD_Radeon_Graphics.json → triton_3_1_0/E=8,N=3584,device_name=AMD_Radeon_Graphics.json} +0 -0
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=8,N=3584,device_name=NVIDIA_A100-SXM4-40GB.json → triton_3_1_0/E=8,N=3584,device_name=NVIDIA_A100-SXM4-40GB.json} +0 -0
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=8,N=3584,device_name=NVIDIA_A100-SXM4-80GB.json → triton_3_1_0/E=8,N=3584,device_name=NVIDIA_A100-SXM4-80GB.json} +0 -0
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=8,N=3584,device_name=NVIDIA_GeForce_RTX_4090,dtype=fp8_w8a8.json → triton_3_1_0/E=8,N=3584,device_name=NVIDIA_GeForce_RTX_4090,dtype=fp8_w8a8.json} +0 -0
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=8,N=3584,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8.json → triton_3_1_0/E=8,N=3584,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8.json} +0 -0
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=8,N=3584,device_name=NVIDIA_H100_80GB_HBM3.json → triton_3_1_0/E=8,N=3584,device_name=NVIDIA_H100_80GB_HBM3.json} +0 -0
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=8,N=3584,device_name=NVIDIA_H200,dtype=fp8_w8a8.json → triton_3_1_0/E=8,N=3584,device_name=NVIDIA_H200,dtype=fp8_w8a8.json} +0 -0
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=8,N=3584,device_name=NVIDIA_H200.json → triton_3_1_0/E=8,N=3584,device_name=NVIDIA_H200.json} +0 -0
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=8,N=3584,device_name=NVIDIA_L40S.json → triton_3_1_0/E=8,N=3584,device_name=NVIDIA_L40S.json} +0 -0
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=8,N=4096,device_name=AMD_Instinct_MI300X,dtype=fp8_w8a8.json → triton_3_1_0/E=8,N=4096,device_name=AMD_Instinct_MI300X,dtype=fp8_w8a8.json} +0 -0
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=8,N=4096,device_name=AMD_Instinct_MI325X,dtype=fp8_w8a8.json → triton_3_1_0/E=8,N=4096,device_name=AMD_Instinct_MI325X,dtype=fp8_w8a8.json} +0 -0
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=8,N=4096,device_name=AMD_Radeon_Graphics,dtype=fp8_w8a8.json → triton_3_1_0/E=8,N=4096,device_name=AMD_Radeon_Graphics,dtype=fp8_w8a8.json} +0 -0
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=8,N=4096,device_name=NVIDIA_A100-SXM4-80GB.json → triton_3_1_0/E=8,N=4096,device_name=NVIDIA_A100-SXM4-80GB.json} +0 -0
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=8,N=4096,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8.json → triton_3_1_0/E=8,N=4096,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8.json} +0 -0
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=8,N=4096,device_name=NVIDIA_H100_80GB_HBM3.json → triton_3_1_0/E=8,N=4096,device_name=NVIDIA_H100_80GB_HBM3.json} +0 -0
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=8,N=4096,device_name=NVIDIA_H200,dtype=fp8_w8a8.json → triton_3_1_0/E=8,N=4096,device_name=NVIDIA_H200,dtype=fp8_w8a8.json} +0 -0
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=8,N=4096,device_name=NVIDIA_H200.json → triton_3_1_0/E=8,N=4096,device_name=NVIDIA_H200.json} +0 -0
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=8,N=7168,device_name=AMD_Instinct_MI300X.json → triton_3_1_0/E=8,N=7168,device_name=AMD_Instinct_MI300X.json} +0 -0
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=8,N=7168,device_name=AMD_Instinct_MI325X.json → triton_3_1_0/E=8,N=7168,device_name=AMD_Instinct_MI325X.json} +0 -0
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=8,N=7168,device_name=AMD_Radeon_Graphics.json → triton_3_1_0/E=8,N=7168,device_name=AMD_Radeon_Graphics.json} +0 -0
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=8,N=7168,device_name=NVIDIA_A100-SXM4-80GB.json → triton_3_1_0/E=8,N=7168,device_name=NVIDIA_A100-SXM4-80GB.json} +0 -0
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=8,N=7168,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8.json → triton_3_1_0/E=8,N=7168,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8.json} +0 -0
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=8,N=7168,device_name=NVIDIA_H100_80GB_HBM3.json → triton_3_1_0/E=8,N=7168,device_name=NVIDIA_H100_80GB_HBM3.json} +0 -0
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=8,N=7168,device_name=NVIDIA_H200,dtype=fp8_w8a8.json → triton_3_1_0/E=8,N=7168,device_name=NVIDIA_H200,dtype=fp8_w8a8.json} +0 -0
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=8,N=7168,device_name=NVIDIA_H200.json → triton_3_1_0/E=8,N=7168,device_name=NVIDIA_H200.json} +0 -0
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=8,N=8192,device_name=AMD_Instinct_MI300X,dtype=fp8_w8a8.json → triton_3_1_0/E=8,N=8192,device_name=AMD_Instinct_MI300X,dtype=fp8_w8a8.json} +0 -0
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=8,N=8192,device_name=AMD_Instinct_MI325X,dtype=fp8_w8a8.json → triton_3_1_0/E=8,N=8192,device_name=AMD_Instinct_MI325X,dtype=fp8_w8a8.json} +0 -0
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=8,N=8192,device_name=AMD_Radeon_Graphics,dtype=fp8_w8a8.json → triton_3_1_0/E=8,N=8192,device_name=AMD_Radeon_Graphics,dtype=fp8_w8a8.json} +0 -0
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=8,N=8192,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8.json → triton_3_1_0/E=8,N=8192,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8.json} +0 -0
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=8,N=8192,device_name=NVIDIA_H200,dtype=fp8_w8a8.json → triton_3_1_0/E=8,N=8192,device_name=NVIDIA_H200,dtype=fp8_w8a8.json} +0 -0
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=128,N=192,device_name=NVIDIA_A800-SXM4-80GB.json → triton_3_2_0/E=128,N=192,device_name=NVIDIA_A800-SXM4-80GB.json} +0 -0
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=128,N=192,device_name=NVIDIA_H100_80GB_HBM3.json → triton_3_2_0/E=128,N=192,device_name=NVIDIA_H100_80GB_HBM3.json} +0 -0
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=128,N=192,device_name=NVIDIA_H20.json → triton_3_2_0/E=128,N=192,device_name=NVIDIA_H20.json} +0 -0
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=128,N=192,device_name=NVIDIA_H200.json → triton_3_2_0/E=128,N=192,device_name=NVIDIA_H200.json} +0 -0
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=128,N=384,device_name=NVIDIA_H100_80GB_HBM3.json → triton_3_2_0/E=128,N=384,device_name=NVIDIA_H100_80GB_HBM3.json} +0 -0
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=128,N=384,device_name=NVIDIA_H20,dtype=fp8_w8a8,block_shape=[128, 128].json → triton_3_2_0/E=128,N=384,device_name=NVIDIA_H20,dtype=fp8_w8a8,block_shape=[128, 128].json} +0 -0
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=128,N=384,device_name=NVIDIA_H20.json → triton_3_2_0/E=128,N=384,device_name=NVIDIA_H20.json} +0 -0
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=128,N=384,device_name=NVIDIA_H200,dtype=fp8_w8a8,block_shape=[128, 128].json → triton_3_2_0/E=128,N=384,device_name=NVIDIA_H200,dtype=fp8_w8a8,block_shape=[128, 128].json} +0 -0
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=128,N=384,device_name=NVIDIA_H200.json → triton_3_2_0/E=128,N=384,device_name=NVIDIA_H200.json} +0 -0
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=128,N=512,device_name=NVIDIA_H100_80GB_HBM3.json → triton_3_2_0/E=128,N=512,device_name=NVIDIA_H100_80GB_HBM3.json} +0 -0
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=128,N=768,device_name=NVIDIA_A800-SXM4-80GB.json → triton_3_2_0/E=128,N=768,device_name=NVIDIA_A800-SXM4-80GB.json} +0 -0
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=128,N=768,device_name=NVIDIA_H100_80GB_HBM3.json → triton_3_2_0/E=128,N=768,device_name=NVIDIA_H100_80GB_HBM3.json} +0 -0
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=128,N=768,device_name=NVIDIA_H20,dtype=fp8_w8a8,block_shape=[128, 128].json → triton_3_2_0/E=128,N=768,device_name=NVIDIA_H20,dtype=fp8_w8a8,block_shape=[128, 128].json} +0 -0
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=128,N=768,device_name=NVIDIA_H20.json → triton_3_2_0/E=128,N=768,device_name=NVIDIA_H20.json} +0 -0
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=128,N=768,device_name=NVIDIA_H200,dtype=fp8_w8a8,block_shape=[128, 128].json → triton_3_2_0/E=128,N=768,device_name=NVIDIA_H200,dtype=fp8_w8a8,block_shape=[128, 128].json} +0 -0
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=128,N=768,device_name=NVIDIA_H200.json → triton_3_2_0/E=128,N=768,device_name=NVIDIA_H200.json} +0 -0
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=128,N=96,device_name=NVIDIA_H20.json → triton_3_2_0/E=128,N=96,device_name=NVIDIA_H20.json} +0 -0
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=264,N=128,device_name=NVIDIA_A800-SXM4-80GB,dtype=int8_w8a8.json → triton_3_2_0/E=264,N=128,device_name=NVIDIA_A800-SXM4-80GB,dtype=int8_w8a8.json} +0 -0
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=264,N=256,device_name=NVIDIA_B200,dtype=fp8_w8a8,block_shape=[128, 128].json → triton_3_2_0/E=264,N=256,device_name=NVIDIA_B200,dtype=fp8_w8a8,block_shape=[128, 128].json} +0 -0
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=264,N=256,device_name=NVIDIA_H20,dtype=fp8_w8a8,block_shape=[128, 128].json → triton_3_2_0/E=264,N=256,device_name=NVIDIA_H20,dtype=fp8_w8a8,block_shape=[128, 128].json} +0 -0
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=264,N=256,device_name=NVIDIA_H200,dtype=fp8_w8a8,block_shape=[128, 128].json → triton_3_2_0/E=264,N=256,device_name=NVIDIA_H200,dtype=fp8_w8a8,block_shape=[128, 128].json} +0 -0
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=272,N=128,device_name=NVIDIA_A800-SXM4-80GB,dtype=int8_w8a8.json → triton_3_2_0/E=272,N=128,device_name=NVIDIA_A800-SXM4-80GB,dtype=int8_w8a8.json} +0 -0
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=272,N=128,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8,block_shape=[128, 128].json → triton_3_2_0/E=272,N=128,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8,block_shape=[128, 128].json} +0 -0
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=272,N=128,device_name=NVIDIA_H20,dtype=fp8_w8a8,block_shape=[128, 128].json → triton_3_2_0/E=272,N=128,device_name=NVIDIA_H20,dtype=fp8_w8a8,block_shape=[128, 128].json} +0 -0
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=272,N=64,device_name=NVIDIA_A800-SXM4-80GB.json → triton_3_2_0/E=272,N=64,device_name=NVIDIA_A800-SXM4-80GB.json} +0 -0
- /sglang/srt/layers/moe/fused_moe_triton/configs/{E=288,N=64,device_name=NVIDIA_A800-SXM4-80GB.json → triton_3_2_0/E=288,N=64,device_name=NVIDIA_A800-SXM4-80GB.json} +0 -0
- /sglang/srt/models/{xiaomi_mimo.py → mimo.py} +0 -0
- {sglang-0.4.6.post4.dist-info → sglang-0.4.7.dist-info}/licenses/LICENSE +0 -0
- {sglang-0.4.6.post4.dist-info → sglang-0.4.7.dist-info}/top_level.txt +0 -0
sglang/srt/models/registry.py
CHANGED
@@ -49,7 +49,15 @@ class _ModelRegistry:
|
|
49
49
|
if not architectures:
|
50
50
|
logger.warning("No model architectures are specified")
|
51
51
|
|
52
|
-
|
52
|
+
# filter out support architectures
|
53
|
+
normalized_arch = list(
|
54
|
+
filter(lambda model: model in self.models, architectures)
|
55
|
+
)
|
56
|
+
|
57
|
+
# make sure Transformers backend is put at the last as a fallback
|
58
|
+
if len(normalized_arch) != len(architectures):
|
59
|
+
normalized_arch.append("TransformersForCausalLM")
|
60
|
+
return normalized_arch
|
53
61
|
|
54
62
|
def resolve_model_cls(
|
55
63
|
self,
|
@@ -0,0 +1,294 @@
|
|
1
|
+
# Adapted from
|
2
|
+
# https://github.com/huggingface/transformers/blob/af9b2eaa54c150741f298d6db939af6328e1dc38/src/transformers/models/siglip/modeling_siglip.py
|
3
|
+
|
4
|
+
from functools import partial
|
5
|
+
from typing import Optional, Type, Union
|
6
|
+
|
7
|
+
import torch
|
8
|
+
import torch.nn as nn
|
9
|
+
from transformers import SiglipVisionConfig
|
10
|
+
|
11
|
+
from sglang.srt.layers.activation import QuickGELU
|
12
|
+
from sglang.srt.layers.attention.vision import VisionAttention
|
13
|
+
from sglang.srt.layers.linear import ColumnParallelLinear, RowParallelLinear
|
14
|
+
from sglang.srt.layers.quantization.base_config import QuantizationConfig
|
15
|
+
from sglang.srt.layers.vocab_parallel_embedding import VocabParallelEmbedding
|
16
|
+
from sglang.srt.utils import add_prefix
|
17
|
+
|
18
|
+
|
19
|
+
# Adapted from transformers.models.siglip.modeling_siglip.SiglipVisionTransformer
|
20
|
+
class SiglipVisionEmbeddings(nn.Module):
|
21
|
+
|
22
|
+
def __init__(self, config: SiglipVisionConfig):
|
23
|
+
super().__init__()
|
24
|
+
self.config = config
|
25
|
+
self.embed_dim = config.hidden_size
|
26
|
+
self.image_size = config.image_size
|
27
|
+
self.patch_size = config.patch_size
|
28
|
+
|
29
|
+
self.patch_embedding = nn.Conv2d(
|
30
|
+
in_channels=config.num_channels,
|
31
|
+
out_channels=self.embed_dim,
|
32
|
+
kernel_size=self.patch_size,
|
33
|
+
stride=self.patch_size,
|
34
|
+
padding="valid",
|
35
|
+
)
|
36
|
+
|
37
|
+
self.num_patches = (self.image_size // self.patch_size) ** 2
|
38
|
+
self.num_positions = self.num_patches
|
39
|
+
self.position_embedding = VocabParallelEmbedding(
|
40
|
+
self.num_positions, self.embed_dim
|
41
|
+
)
|
42
|
+
self.register_buffer(
|
43
|
+
"position_ids",
|
44
|
+
torch.arange(self.num_positions).expand((1, -1)),
|
45
|
+
persistent=False,
|
46
|
+
)
|
47
|
+
|
48
|
+
def forward(self, pixel_values: torch.Tensor) -> torch.Tensor:
|
49
|
+
target_dtype = self.patch_embedding.weight.dtype
|
50
|
+
patch_embeds = self.patch_embedding(
|
51
|
+
pixel_values.to(dtype=target_dtype)
|
52
|
+
) # shape = [*, width, grid, grid]
|
53
|
+
embeddings = patch_embeds.flatten(2).transpose(1, 2)
|
54
|
+
# interpolate_pos_encoding is never used in sglang
|
55
|
+
embeddings = embeddings + self.position_embedding(self.position_ids)
|
56
|
+
|
57
|
+
return embeddings
|
58
|
+
|
59
|
+
|
60
|
+
# Copied from sglang.srt.models.clip.CLIPMLP
|
61
|
+
class SiglipMLP(nn.Module):
|
62
|
+
|
63
|
+
def __init__(
|
64
|
+
self,
|
65
|
+
config,
|
66
|
+
act_layer: Type[nn.Module] = QuickGELU,
|
67
|
+
quant_config: Optional[QuantizationConfig] = None,
|
68
|
+
prefix: str = "",
|
69
|
+
):
|
70
|
+
super().__init__()
|
71
|
+
self.fc1 = ColumnParallelLinear(
|
72
|
+
config.hidden_size,
|
73
|
+
config.intermediate_size,
|
74
|
+
quant_config=quant_config,
|
75
|
+
prefix=add_prefix("fc1", prefix),
|
76
|
+
)
|
77
|
+
self.act = act_layer()
|
78
|
+
self.fc2 = RowParallelLinear(
|
79
|
+
config.intermediate_size,
|
80
|
+
config.hidden_size,
|
81
|
+
quant_config=quant_config,
|
82
|
+
prefix=add_prefix("fc2", prefix),
|
83
|
+
)
|
84
|
+
|
85
|
+
def forward(self, x: torch.Tensor) -> torch.Tensor:
|
86
|
+
x_parallel, _ = self.fc1(x)
|
87
|
+
x_parallel = self.act(x_parallel)
|
88
|
+
x, _ = self.fc2(x_parallel)
|
89
|
+
return x
|
90
|
+
|
91
|
+
|
92
|
+
# Copied from sglang.srt.models.clip.CLIPEncoderLayer
|
93
|
+
class SiglipEncoderLayer(nn.Module):
|
94
|
+
|
95
|
+
def __init__(
|
96
|
+
self,
|
97
|
+
config: SiglipVisionConfig,
|
98
|
+
act_layer: Type[nn.Module] = QuickGELU,
|
99
|
+
norm_layer: Type[nn.Module] = None,
|
100
|
+
attn_implementation: Optional[str] = "sdpa",
|
101
|
+
quant_config: Optional[QuantizationConfig] = None,
|
102
|
+
prefix: str = "",
|
103
|
+
) -> None:
|
104
|
+
super().__init__()
|
105
|
+
if norm_layer is None:
|
106
|
+
norm_layer = partial(nn.LayerNorm, eps=config.layer_norm_eps)
|
107
|
+
self.layer_norm1 = norm_layer(config.hidden_size)
|
108
|
+
self.layer_norm2 = norm_layer(config.hidden_size)
|
109
|
+
if attn_implementation == "sdpa":
|
110
|
+
qkv_backend = "sdpa"
|
111
|
+
softmax_in_single_precision = False
|
112
|
+
elif attn_implementation == "flash_attention_2":
|
113
|
+
qkv_backend = "triton_attn"
|
114
|
+
softmax_in_single_precision = False
|
115
|
+
elif attn_implementation == "eager":
|
116
|
+
qkv_backend = "sdpa"
|
117
|
+
softmax_in_single_precision = True
|
118
|
+
self.self_attn = VisionAttention(
|
119
|
+
embed_dim=config.hidden_size,
|
120
|
+
num_heads=config.num_attention_heads,
|
121
|
+
projection_size=config.hidden_size,
|
122
|
+
use_qkv_parallel=True,
|
123
|
+
qkv_backend=qkv_backend,
|
124
|
+
softmax_in_single_precision=softmax_in_single_precision,
|
125
|
+
flatten_batch=True,
|
126
|
+
quant_config=quant_config,
|
127
|
+
prefix=add_prefix("self_attn", prefix),
|
128
|
+
)
|
129
|
+
self.mlp = SiglipMLP(
|
130
|
+
config,
|
131
|
+
act_layer=act_layer,
|
132
|
+
quant_config=quant_config,
|
133
|
+
prefix=add_prefix("mlp", prefix),
|
134
|
+
)
|
135
|
+
|
136
|
+
def forward(
|
137
|
+
self,
|
138
|
+
hidden_states: torch.Tensor,
|
139
|
+
attention_mask: torch.Tensor,
|
140
|
+
causal_attention_mask: torch.Tensor,
|
141
|
+
) -> torch.Tensor:
|
142
|
+
|
143
|
+
residual = hidden_states
|
144
|
+
hidden_states = self.layer_norm1(hidden_states)
|
145
|
+
# Siglip text model uses both `causal_attention_mask` and `attention_mask`
|
146
|
+
if attention_mask is not None and causal_attention_mask is not None:
|
147
|
+
attn_mask = attention_mask + causal_attention_mask
|
148
|
+
elif causal_attention_mask is not None:
|
149
|
+
attn_mask = causal_attention_mask
|
150
|
+
else:
|
151
|
+
attn_mask = attention_mask
|
152
|
+
hidden_states = self.self_attn(
|
153
|
+
hidden_states,
|
154
|
+
attention_mask=attn_mask,
|
155
|
+
# causal_attention_mask=causal_attention_mask,
|
156
|
+
)
|
157
|
+
|
158
|
+
hidden_states = residual + hidden_states
|
159
|
+
residual = hidden_states
|
160
|
+
hidden_states = self.layer_norm2(hidden_states)
|
161
|
+
hidden_states = self.mlp(hidden_states)
|
162
|
+
hidden_states = residual + hidden_states
|
163
|
+
return hidden_states
|
164
|
+
|
165
|
+
|
166
|
+
# Copied from sglang.srt.models.clip.CLIPEncoder
|
167
|
+
class SiglipEncoder(nn.Module):
|
168
|
+
"""
|
169
|
+
Transformer encoder consisting of `config.num_hidden_layers` self
|
170
|
+
attention layers. Each layer is a [`SiglipEncoderLayer`].
|
171
|
+
|
172
|
+
Args:
|
173
|
+
config: SiglipConfig
|
174
|
+
"""
|
175
|
+
|
176
|
+
def __init__(
|
177
|
+
self,
|
178
|
+
config: SiglipVisionConfig,
|
179
|
+
quant_config: Optional[QuantizationConfig] = None,
|
180
|
+
prefix: str = "",
|
181
|
+
) -> None:
|
182
|
+
super().__init__()
|
183
|
+
|
184
|
+
self.config = config
|
185
|
+
|
186
|
+
num_hidden_layers = config.num_hidden_layers
|
187
|
+
norm_layer = partial(nn.LayerNorm, eps=config.layer_norm_eps)
|
188
|
+
self.layers = nn.ModuleList(
|
189
|
+
[
|
190
|
+
SiglipEncoderLayer(
|
191
|
+
config=config,
|
192
|
+
norm_layer=norm_layer,
|
193
|
+
attn_implementation="sdpa",
|
194
|
+
quant_config=quant_config,
|
195
|
+
prefix=add_prefix(f"layers.{layer_idx}", prefix),
|
196
|
+
)
|
197
|
+
for layer_idx in range(num_hidden_layers)
|
198
|
+
]
|
199
|
+
)
|
200
|
+
|
201
|
+
def forward(
|
202
|
+
self,
|
203
|
+
inputs_embeds: torch.Tensor,
|
204
|
+
attention_mask: torch.Tensor = None,
|
205
|
+
causal_attention_mask: torch.Tensor = None,
|
206
|
+
return_all_hidden_states: bool = False,
|
207
|
+
) -> Union[torch.Tensor, list[torch.Tensor]]:
|
208
|
+
hidden_states_pool = [inputs_embeds]
|
209
|
+
hidden_states = inputs_embeds
|
210
|
+
|
211
|
+
for encoder_layer in self.layers:
|
212
|
+
hidden_states = encoder_layer(
|
213
|
+
hidden_states, attention_mask, causal_attention_mask
|
214
|
+
)
|
215
|
+
if return_all_hidden_states:
|
216
|
+
hidden_states_pool.append(hidden_states)
|
217
|
+
if return_all_hidden_states:
|
218
|
+
return hidden_states_pool
|
219
|
+
return hidden_states
|
220
|
+
|
221
|
+
|
222
|
+
# Adapted from transformers.models.siglip.modeling_siglip.SiglipVisionTransformer
|
223
|
+
class SiglipVisionTransformer(nn.Module):
|
224
|
+
|
225
|
+
def __init__(
|
226
|
+
self,
|
227
|
+
config: SiglipVisionConfig,
|
228
|
+
quant_config: Optional[QuantizationConfig] = None,
|
229
|
+
prefix: str = "",
|
230
|
+
) -> None:
|
231
|
+
super().__init__()
|
232
|
+
|
233
|
+
self.config = config
|
234
|
+
embed_dim = config.hidden_size
|
235
|
+
|
236
|
+
self.embeddings = SiglipVisionEmbeddings(config)
|
237
|
+
|
238
|
+
self.encoder = SiglipEncoder(
|
239
|
+
config=config,
|
240
|
+
quant_config=quant_config,
|
241
|
+
prefix=add_prefix("encoder", prefix),
|
242
|
+
)
|
243
|
+
|
244
|
+
num_hidden_layers = config.num_hidden_layers
|
245
|
+
if len(self.encoder.layers) > config.num_hidden_layers:
|
246
|
+
raise ValueError(
|
247
|
+
f"The original encoder only has {num_hidden_layers} "
|
248
|
+
f"layers, but you requested {len(self.encoder.layers)} layers."
|
249
|
+
)
|
250
|
+
|
251
|
+
# VisionAttention in SiglipEncoderLayer is multihead attention
|
252
|
+
self.post_layernorm = nn.LayerNorm(embed_dim, eps=config.layer_norm_eps)
|
253
|
+
|
254
|
+
@property
|
255
|
+
def device(self) -> torch.device:
|
256
|
+
return self.encoder.layers[0].layer_norm1.weight.device
|
257
|
+
|
258
|
+
def forward(
|
259
|
+
self,
|
260
|
+
pixel_values: torch.Tensor,
|
261
|
+
) -> torch.Tensor:
|
262
|
+
hidden_states = self.embeddings(pixel_values.to(self.device))
|
263
|
+
|
264
|
+
return_all_hidden_states = False
|
265
|
+
|
266
|
+
last_hidden_state = self.encoder(
|
267
|
+
inputs_embeds=hidden_states,
|
268
|
+
return_all_hidden_states=return_all_hidden_states,
|
269
|
+
)
|
270
|
+
|
271
|
+
last_hidden_state = self.post_layernorm(last_hidden_state)
|
272
|
+
|
273
|
+
return last_hidden_state
|
274
|
+
|
275
|
+
|
276
|
+
# Copied from sglang.srt.models.clip.CLIPVisionModel
|
277
|
+
class SiglipVisionModel(nn.Module):
|
278
|
+
def __init__(
|
279
|
+
self,
|
280
|
+
config: SiglipVisionConfig,
|
281
|
+
quant_config: Optional[QuantizationConfig] = None,
|
282
|
+
prefix: str = "",
|
283
|
+
):
|
284
|
+
super().__init__()
|
285
|
+
self.vision_model = SiglipVisionTransformer(
|
286
|
+
config, quant_config, prefix=add_prefix("vision_model", prefix)
|
287
|
+
)
|
288
|
+
|
289
|
+
@property
|
290
|
+
def device(self) -> torch.device:
|
291
|
+
return self.vision_model.device
|
292
|
+
|
293
|
+
def forward(self, pixel_values: torch.Tensor):
|
294
|
+
return self.vision_model(pixel_values)
|
@@ -0,0 +1,291 @@
|
|
1
|
+
# Copyright 2025 SGLang Team
|
2
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
3
|
+
# you may not use this file except in compliance with the License.
|
4
|
+
# You may obtain a copy of the License at
|
5
|
+
#
|
6
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
7
|
+
#
|
8
|
+
# Unless required by applicable law or agreed to in writing, software
|
9
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
10
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
11
|
+
# See the License for the specific language governing permissions and
|
12
|
+
# limitations under the License.
|
13
|
+
# ==============================================================================
|
14
|
+
|
15
|
+
# Adapted from
|
16
|
+
# https://github.com/vllm-project/vllm/blob/a1a2aaadb9122f05667140e39cf67e5736c8b6d6/vllm/model_executor/models/transformers.py
|
17
|
+
"""Wrapper around `transformers` models"""
|
18
|
+
import logging
|
19
|
+
import re
|
20
|
+
from typing import Iterable, Literal, Optional, Tuple, Union
|
21
|
+
|
22
|
+
import torch
|
23
|
+
from torch import nn
|
24
|
+
from transformers import AutoModel, PretrainedConfig, PreTrainedModel
|
25
|
+
from transformers.modeling_utils import ALL_ATTENTION_FUNCTIONS
|
26
|
+
|
27
|
+
from sglang.srt.distributed import divide, get_tensor_model_parallel_world_size
|
28
|
+
from sglang.srt.layers.linear import (
|
29
|
+
ColumnParallelLinear,
|
30
|
+
ReplicatedLinear,
|
31
|
+
RowParallelLinear,
|
32
|
+
)
|
33
|
+
from sglang.srt.layers.logits_processor import LogitsProcessor, LogitsProcessorOutput
|
34
|
+
from sglang.srt.layers.quantization.base_config import QuantizationConfig
|
35
|
+
from sglang.srt.layers.radix_attention import RadixAttention
|
36
|
+
from sglang.srt.layers.vocab_parallel_embedding import (
|
37
|
+
ParallelLMHead,
|
38
|
+
VocabParallelEmbedding,
|
39
|
+
)
|
40
|
+
from sglang.srt.model_executor.forward_batch_info import ForwardBatch
|
41
|
+
from sglang.srt.model_loader.weight_utils import default_weight_loader
|
42
|
+
|
43
|
+
logger = logging.getLogger(__name__)
|
44
|
+
|
45
|
+
|
46
|
+
def maybe_prefix(prefix: str, name: str) -> str:
|
47
|
+
"""Add a prefix to a name if the prefix is non-empty.
|
48
|
+
|
49
|
+
Args:
|
50
|
+
prefix: The prefix to add. If empty, no prefix will be added.
|
51
|
+
name: The name to potentially prefix.
|
52
|
+
|
53
|
+
Returns:
|
54
|
+
The string "prefix.name" if prefix was non-empty, otherwise just "name".
|
55
|
+
"""
|
56
|
+
return name if not prefix else f"{prefix}.{name}"
|
57
|
+
|
58
|
+
|
59
|
+
def sglang_flash_attention_forward(
|
60
|
+
# Transformers args
|
61
|
+
module: torch.nn.Module,
|
62
|
+
query: torch.Tensor,
|
63
|
+
key: torch.Tensor,
|
64
|
+
value: torch.Tensor,
|
65
|
+
attention_mask: torch.Tensor,
|
66
|
+
# sglang kwargs
|
67
|
+
forward_batch: ForwardBatch,
|
68
|
+
# Transformers kwargs
|
69
|
+
scaling: float = None,
|
70
|
+
attention_instances: list[RadixAttention] = None,
|
71
|
+
**kwargs,
|
72
|
+
):
|
73
|
+
self_attn: RadixAttention = attention_instances[module.layer_idx]
|
74
|
+
if scaling is not None:
|
75
|
+
self_attn.scaling = float(scaling)
|
76
|
+
hidden = query.shape[-2]
|
77
|
+
query, key, value = (x.transpose(1, 2) for x in (query, key, value))
|
78
|
+
query, key, value = (x.reshape(hidden, -1) for x in (query, key, value))
|
79
|
+
return self_attn.forward(query, key, value, forward_batch=forward_batch), None
|
80
|
+
|
81
|
+
|
82
|
+
ALL_ATTENTION_FUNCTIONS["sglang"] = sglang_flash_attention_forward
|
83
|
+
|
84
|
+
|
85
|
+
class HFColumnParallelLinear(ColumnParallelLinear):
|
86
|
+
|
87
|
+
def forward(self, input: torch.Tensor) -> torch.Tensor:
|
88
|
+
return super().forward(input)[0]
|
89
|
+
|
90
|
+
|
91
|
+
class HFRowParallelLinear(RowParallelLinear):
|
92
|
+
|
93
|
+
def forward(self, input: torch.Tensor) -> torch.Tensor:
|
94
|
+
return super().forward(input)[0]
|
95
|
+
|
96
|
+
|
97
|
+
def replace_linear_class(
|
98
|
+
linear: nn.Linear,
|
99
|
+
style: Literal["colwise", "rowwise"],
|
100
|
+
quant_config: QuantizationConfig,
|
101
|
+
) -> Union[ColumnParallelLinear, RowParallelLinear]:
|
102
|
+
"""
|
103
|
+
Replace nn.Linear with one of vLLM's tensor parallel linear classes.
|
104
|
+
|
105
|
+
Args:
|
106
|
+
linear (nn.Linear): `nn.Linear` to be replaced.
|
107
|
+
style (str): Tensor parallel style of the new linear, e.g. "colwise".
|
108
|
+
quant_config (QuantConfig): Quantization config for the new linear.
|
109
|
+
Returns:
|
110
|
+
Union[ColumnParallelLinear, RowParallelLinear]: The new linear.
|
111
|
+
"""
|
112
|
+
|
113
|
+
if not isinstance(style, str):
|
114
|
+
raise ValueError(f"Unsupported parallel style type {type(style)}, expected str")
|
115
|
+
|
116
|
+
sglang_linear_cls = {
|
117
|
+
"colwise": ColumnParallelLinear,
|
118
|
+
"rowwise": RowParallelLinear,
|
119
|
+
}.get(style, ReplicatedLinear)
|
120
|
+
|
121
|
+
class HFCompatibleLinear(sglang_linear_cls):
|
122
|
+
"""
|
123
|
+
Wrapper class that removes `output_bias` from returned output.
|
124
|
+
"""
|
125
|
+
|
126
|
+
@property
|
127
|
+
def parent_cls(self) -> type:
|
128
|
+
return sglang_linear_cls
|
129
|
+
|
130
|
+
def forward(self, input: torch.Tensor) -> torch.Tensor:
|
131
|
+
return super().forward(input)[0]
|
132
|
+
|
133
|
+
return HFCompatibleLinear(
|
134
|
+
input_size=linear.in_features,
|
135
|
+
output_size=linear.out_features,
|
136
|
+
bias=linear.bias is not None,
|
137
|
+
quant_config=quant_config,
|
138
|
+
)
|
139
|
+
|
140
|
+
|
141
|
+
class TransformersForCausalLM(nn.Module):
|
142
|
+
|
143
|
+
def __init__(
|
144
|
+
self,
|
145
|
+
config: PretrainedConfig,
|
146
|
+
quant_config: Optional[QuantizationConfig] = None,
|
147
|
+
prefix: str = "",
|
148
|
+
) -> None:
|
149
|
+
super().__init__()
|
150
|
+
logger.info("Using Transformers backend.")
|
151
|
+
|
152
|
+
self.quant_config = quant_config
|
153
|
+
self.config = config
|
154
|
+
self.vocab_size = config.vocab_size
|
155
|
+
self.unpadded_vocab_size = config.vocab_size
|
156
|
+
|
157
|
+
# model is loaded under set_default_torch_dtype(model_config.dtype)
|
158
|
+
self.model: PreTrainedModel = AutoModel.from_config(
|
159
|
+
self.config,
|
160
|
+
torch_dtype=torch.get_default_dtype(),
|
161
|
+
attn_implementation="sglang",
|
162
|
+
trust_remote_code=True,
|
163
|
+
)
|
164
|
+
|
165
|
+
# Attention modifications (assumes 1 attention op per hidden layer)
|
166
|
+
tp_size = get_tensor_model_parallel_world_size()
|
167
|
+
|
168
|
+
# MLP modifications
|
169
|
+
self.tensor_parallel(tp_size)
|
170
|
+
|
171
|
+
head_dim = (
|
172
|
+
(config.hidden_size // config.num_attention_heads)
|
173
|
+
if not hasattr(config, "head_dim")
|
174
|
+
else config.head_dim
|
175
|
+
)
|
176
|
+
self.attention_instances = [
|
177
|
+
RadixAttention(
|
178
|
+
num_heads=divide(config.num_attention_heads, tp_size),
|
179
|
+
head_dim=head_dim,
|
180
|
+
# NOTE: We use Llama scale as default, if it's set by
|
181
|
+
# Transformers, it's updated in sglang_flash_attention_forward
|
182
|
+
scaling=head_dim**-0.5,
|
183
|
+
num_kv_heads=divide(config.num_key_value_heads, tp_size),
|
184
|
+
layer_id=i,
|
185
|
+
quant_config=self.quant_config,
|
186
|
+
prefix=f"{i}.attn",
|
187
|
+
)
|
188
|
+
for i in range(config.num_hidden_layers)
|
189
|
+
]
|
190
|
+
|
191
|
+
# Model modifications
|
192
|
+
self.replace_vocab_embed_class(self.model)
|
193
|
+
|
194
|
+
# ForCausalLM modifications
|
195
|
+
self.lm_head = ParallelLMHead(
|
196
|
+
config.vocab_size,
|
197
|
+
config.hidden_size,
|
198
|
+
quant_config=self.quant_config,
|
199
|
+
prefix=maybe_prefix(prefix, "lm_head"),
|
200
|
+
)
|
201
|
+
if config.tie_word_embeddings:
|
202
|
+
self.lm_head.weight = self.model.get_input_embeddings().weight
|
203
|
+
|
204
|
+
self.logits_processor = LogitsProcessor(config)
|
205
|
+
|
206
|
+
def log_replacement(self, name: str, old_module: nn.Module, new_module: nn.Module):
|
207
|
+
logger.debug("%s: %s -> %s", name, old_module, new_module)
|
208
|
+
|
209
|
+
def tensor_parallel(self, tp_size: int):
|
210
|
+
"""
|
211
|
+
Apply the model's tensor parallelization plan.
|
212
|
+
Currently only supports linear layers.
|
213
|
+
"""
|
214
|
+
if not self.model.supports_tp_plan:
|
215
|
+
if tp_size <= 1:
|
216
|
+
return
|
217
|
+
|
218
|
+
raise ValueError(
|
219
|
+
f"{type(self.model)} does not support tensor parallel yet!"
|
220
|
+
)
|
221
|
+
|
222
|
+
tp_plan = self.model._tp_plan
|
223
|
+
|
224
|
+
def _tensor_parallel(module: nn.Module, prefix: str = ""):
|
225
|
+
for child_name, child_module in module.named_children():
|
226
|
+
qual_name = maybe_prefix(prefix, child_name)
|
227
|
+
for pattern, style in tp_plan.items():
|
228
|
+
if re.match(pattern, qual_name) and isinstance(
|
229
|
+
child_module, nn.Linear
|
230
|
+
):
|
231
|
+
new_module = replace_linear_class(
|
232
|
+
child_module, style, self.quant_config
|
233
|
+
)
|
234
|
+
setattr(module, child_name, new_module)
|
235
|
+
self.log_replacement(qual_name, child_module, new_module)
|
236
|
+
else:
|
237
|
+
_tensor_parallel(child_module, prefix=qual_name)
|
238
|
+
|
239
|
+
_tensor_parallel(self.model)
|
240
|
+
|
241
|
+
def replace_vocab_embed_class(self, module: nn.Module):
|
242
|
+
# Use native set input embeddings
|
243
|
+
new_module = VocabParallelEmbedding(
|
244
|
+
self.vocab_size,
|
245
|
+
self.config.hidden_size,
|
246
|
+
org_num_embeddings=self.config.vocab_size,
|
247
|
+
quant_config=None,
|
248
|
+
)
|
249
|
+
self.log_replacement(
|
250
|
+
"input embedding", self.model.get_input_embeddings(), new_module
|
251
|
+
)
|
252
|
+
self.model.set_input_embeddings(new_module)
|
253
|
+
|
254
|
+
@torch.no_grad()
|
255
|
+
def forward(
|
256
|
+
self,
|
257
|
+
input_ids: torch.Tensor,
|
258
|
+
positions: torch.Tensor,
|
259
|
+
forward_batch: ForwardBatch,
|
260
|
+
input_embeds: torch.Tensor = None,
|
261
|
+
get_embedding: bool = False,
|
262
|
+
) -> LogitsProcessorOutput:
|
263
|
+
assert get_embedding is False, "embedding is not supported yet"
|
264
|
+
aux_hidden_states = None
|
265
|
+
hidden_states = self.model(
|
266
|
+
input_ids[None, ...],
|
267
|
+
use_cache=False,
|
268
|
+
position_ids=positions[None, ...],
|
269
|
+
forward_batch=forward_batch,
|
270
|
+
attention_instances=self.attention_instances,
|
271
|
+
return_dict=False,
|
272
|
+
)[0][
|
273
|
+
0, ...
|
274
|
+
] # we remove batch dimension for now
|
275
|
+
|
276
|
+
return self.logits_processor(
|
277
|
+
input_ids, hidden_states, self.lm_head, forward_batch, aux_hidden_states
|
278
|
+
)
|
279
|
+
|
280
|
+
def load_weights(self, weights: Iterable[Tuple[str, torch.Tensor]]):
|
281
|
+
params_dict = dict(self.named_parameters())
|
282
|
+
for name, loaded_weight in weights:
|
283
|
+
if name not in params_dict:
|
284
|
+
name = f"{self.model.base_model_prefix}.{name}"
|
285
|
+
if name in params_dict:
|
286
|
+
param = params_dict[name]
|
287
|
+
weight_loader = getattr(param, "weight_loader", default_weight_loader)
|
288
|
+
weight_loader(param, loaded_weight)
|
289
|
+
|
290
|
+
|
291
|
+
EntryClass = [TransformersForCausalLM]
|