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/mistral.py
CHANGED
@@ -13,6 +13,12 @@
|
|
13
13
|
# ==============================================================================
|
14
14
|
"""Inference-only Mistral model."""
|
15
15
|
|
16
|
+
from typing import List, Union
|
17
|
+
|
18
|
+
import torch
|
19
|
+
from transformers.models.mistral3.modeling_mistral3 import Mistral3MultiModalProjector
|
20
|
+
|
21
|
+
from sglang.srt.managers.schedule_batch import MultimodalDataItem
|
16
22
|
from sglang.srt.models.llama import LlamaForCausalLM
|
17
23
|
|
18
24
|
|
@@ -20,4 +26,68 @@ class MistralForCausalLM(LlamaForCausalLM):
|
|
20
26
|
pass
|
21
27
|
|
22
28
|
|
23
|
-
|
29
|
+
class Mistral3ForConditionalGeneration:
|
30
|
+
MULTIMODAL_PROJECTOR_TYPE = Mistral3MultiModalProjector
|
31
|
+
|
32
|
+
def __init__(self, **kwargs):
|
33
|
+
# lazy load inner class
|
34
|
+
# to bypass circular import
|
35
|
+
from sglang.srt.models.llava import LlavaForConditionalGeneration
|
36
|
+
|
37
|
+
# override config: mistral's projector adds patchmerger that doesn't require padding
|
38
|
+
kwargs["config"].vision_config.pad_image_border = False
|
39
|
+
|
40
|
+
self.inner = LlavaForConditionalGeneration(**kwargs)
|
41
|
+
self.inner.multi_modal_projector = self.MULTIMODAL_PROJECTOR_TYPE(
|
42
|
+
kwargs["config"]
|
43
|
+
)
|
44
|
+
self.inner.get_image_feature = self.get_image_feature
|
45
|
+
|
46
|
+
def get_image_feature(self, items: List[MultimodalDataItem]) -> torch.Tensor:
|
47
|
+
"""Extract features from image inputs.
|
48
|
+
|
49
|
+
Args:
|
50
|
+
items: List of MultimodalDataItem objects containing image data
|
51
|
+
Note that an item can be either "image" or "multi-images"
|
52
|
+
|
53
|
+
Returns:
|
54
|
+
torch.Tensor: features from image inputs, concatenated
|
55
|
+
"""
|
56
|
+
features = []
|
57
|
+
for item in items:
|
58
|
+
# in each item, we assume pixel_values is always batched
|
59
|
+
pixel_values, image_sizes = item.pixel_values, item.image_sizes
|
60
|
+
image_outputs = self.vision_tower(
|
61
|
+
pixel_values, image_sizes, output_hidden_states=True
|
62
|
+
)
|
63
|
+
selected_image_feature = image_outputs.hidden_states[
|
64
|
+
self.vision_feature_layer
|
65
|
+
]
|
66
|
+
|
67
|
+
if self.vision_feature_select_strategy in ["default", "patch"]:
|
68
|
+
selected_image_feature = selected_image_feature[:, 1:]
|
69
|
+
elif self.vision_feature_select_strategy == "full":
|
70
|
+
selected_image_feature = selected_image_feature
|
71
|
+
else:
|
72
|
+
raise ValueError(
|
73
|
+
f"Unexpected select feature: {self.vision_feature_select_strategy}"
|
74
|
+
)
|
75
|
+
features.append(
|
76
|
+
self.multi_modal_projector(
|
77
|
+
selected_image_feature.squeeze(0), image_sizes
|
78
|
+
)
|
79
|
+
)
|
80
|
+
ret = torch.cat(features, dim=0)
|
81
|
+
return ret
|
82
|
+
|
83
|
+
def __getattr__(self, name):
|
84
|
+
return getattr(self.inner, name)
|
85
|
+
|
86
|
+
def __hasattr__(self, name):
|
87
|
+
return hasattr(self.inner, name)
|
88
|
+
|
89
|
+
def __call__(self, *args, **kwargs):
|
90
|
+
return self.inner(*args, **kwargs)
|
91
|
+
|
92
|
+
|
93
|
+
EntryClass = [MistralForCausalLM, Mistral3ForConditionalGeneration]
|
sglang/srt/models/mllama.py
CHANGED
@@ -836,7 +836,6 @@ class MllamaForConditionalGeneration(nn.Module):
|
|
836
836
|
prefix="multi_modal_projector",
|
837
837
|
)
|
838
838
|
self.logits_processor = LogitsProcessor(config.text_config)
|
839
|
-
self.capture_mode = False
|
840
839
|
|
841
840
|
def pad_input_ids(self, input_ids: List[int], mm_inputs: MultimodalInputs):
|
842
841
|
pixel_values = torch.cat(
|
@@ -865,7 +864,6 @@ class MllamaForConditionalGeneration(nn.Module):
|
|
865
864
|
pixel_values = torch.cat(
|
866
865
|
[item.pixel_values for item in mm_input.mm_items], dim=0
|
867
866
|
)
|
868
|
-
# max_num_images = max(max_num_images, sum(1 if item.is_image() else 0 for item in mm_input.items))
|
869
867
|
max_num_images = max(max_num_images, pixel_values.shape[1])
|
870
868
|
|
871
869
|
max_num_tiles = max(max_num_tiles, pixel_values.shape[2])
|
@@ -970,6 +968,8 @@ class MllamaForConditionalGeneration(nn.Module):
|
|
970
968
|
positions: torch.Tensor,
|
971
969
|
forward_batch: ForwardBatch,
|
972
970
|
) -> Union[Tuple, CausalLMOutputWithPast]:
|
971
|
+
from sglang.srt.model_executor.cuda_graph_runner import get_is_capture_mode
|
972
|
+
|
973
973
|
batched_images, batched_ar_ids, batched_ar_mask, encoder_lens_need = (
|
974
974
|
self._batch_image_inputs(forward_batch)
|
975
975
|
)
|
@@ -978,7 +978,7 @@ class MllamaForConditionalGeneration(nn.Module):
|
|
978
978
|
cross_attention_mask = None
|
979
979
|
cross_attention_states = None
|
980
980
|
|
981
|
-
if
|
981
|
+
if get_is_capture_mode():
|
982
982
|
# NOTE: when doing cuda graph capture, we do not want to skip cross attention
|
983
983
|
# Make is a constant value to avoid cuda graph capture issue
|
984
984
|
skip_cross_attention = False
|
@@ -0,0 +1,512 @@
|
|
1
|
+
# Copyright 2024 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
|
+
# Adapted from
|
15
|
+
# https://github.com/vllm-project/vllm/blob/6071e989df1531b59ef35568f83f7351afb0b51e/vllm/model_executor/models/phi4mm.py
|
16
|
+
# https://huggingface.co/microsoft/Phi-4-multimodal-instruct/blob/main/processing_phi4mm.py
|
17
|
+
|
18
|
+
import logging
|
19
|
+
import math
|
20
|
+
import re
|
21
|
+
from collections.abc import Iterable
|
22
|
+
from typing import List, Optional, Tuple
|
23
|
+
|
24
|
+
import numpy as np
|
25
|
+
import torch
|
26
|
+
from torch import nn
|
27
|
+
from transformers import PretrainedConfig, SiglipVisionConfig
|
28
|
+
|
29
|
+
from sglang.srt.layers.quantization import QuantizationConfig
|
30
|
+
from sglang.srt.managers.mm_utils import (
|
31
|
+
MultiModalityDataPaddingPatternMultimodalTokens,
|
32
|
+
general_mm_embed_routine,
|
33
|
+
)
|
34
|
+
from sglang.srt.managers.schedule_batch import MultimodalDataItem, MultimodalInputs
|
35
|
+
from sglang.srt.model_executor.forward_batch_info import ForwardBatch
|
36
|
+
from sglang.srt.model_loader.weight_utils import default_weight_loader
|
37
|
+
from sglang.srt.models.idefics2 import Idefics2VisionTransformer
|
38
|
+
from sglang.srt.models.llama import LlamaForCausalLM
|
39
|
+
|
40
|
+
logger = logging.getLogger(__name__)
|
41
|
+
|
42
|
+
SIGLIP_NAME = "siglip-so400m-patch14-448"
|
43
|
+
VISION_ENCODER_TO_PROCESSING_CONFIG = {
|
44
|
+
"siglip-so400m-patch14-448": {
|
45
|
+
"vit_image_size": 448,
|
46
|
+
"vit_patch_size": 14,
|
47
|
+
"token_compression_factor": 2,
|
48
|
+
},
|
49
|
+
}
|
50
|
+
|
51
|
+
|
52
|
+
def get_navit_vision_model():
|
53
|
+
vision_config = {
|
54
|
+
"hidden_size": 1152,
|
55
|
+
"image_size": 448,
|
56
|
+
"intermediate_size": 4304,
|
57
|
+
"model_type": "siglip_vision_model",
|
58
|
+
"num_attention_heads": 16,
|
59
|
+
"num_hidden_layers": 26, # Model is originally 27-layer, we only need the first 26 layers for feature extraction.
|
60
|
+
"patch_size": 14,
|
61
|
+
}
|
62
|
+
model_config = SiglipVisionConfig(**vision_config)
|
63
|
+
|
64
|
+
vision_model = Idefics2VisionTransformer(
|
65
|
+
config=model_config, require_post_norm=False
|
66
|
+
)
|
67
|
+
|
68
|
+
return vision_model
|
69
|
+
|
70
|
+
|
71
|
+
class Phi4MMImageEncoder(nn.Module):
|
72
|
+
"""Image embedding."""
|
73
|
+
|
74
|
+
def __init__(
|
75
|
+
self,
|
76
|
+
config: PretrainedConfig,
|
77
|
+
quant_config: Optional[QuantizationConfig],
|
78
|
+
prefix: str = "",
|
79
|
+
model_dir: str = "",
|
80
|
+
) -> None:
|
81
|
+
super().__init__()
|
82
|
+
|
83
|
+
# n_embed or hidden_size
|
84
|
+
hidden_size = config.n_embd if hasattr(config, "n_embd") else config.hidden_size
|
85
|
+
self.type_feature = "patch"
|
86
|
+
|
87
|
+
self.img_processor = get_navit_vision_model()
|
88
|
+
|
89
|
+
pe_weight = self.img_processor.embeddings.position_embedding.weight
|
90
|
+
L, D = pe_weight.size()
|
91
|
+
H = int(math.sqrt(L))
|
92
|
+
assert H**2 == L, f"position embedding size {L} is not square"
|
93
|
+
if H % 2 != 0:
|
94
|
+
self.img_processor_padding = nn.ReflectionPad2d((0, 1, 0, 1))
|
95
|
+
H += 1
|
96
|
+
image_dim_out = D
|
97
|
+
# ((448/14)//2)**2
|
98
|
+
self.num_img_tokens = (H // 2) ** 2
|
99
|
+
self.base_feat_height_target = H
|
100
|
+
|
101
|
+
self.image_dim_out = image_dim_out
|
102
|
+
self.img_sizes = None
|
103
|
+
self.image_attention_mask = None
|
104
|
+
|
105
|
+
# global_gn and sub_gn for hd transform, serves as line separator
|
106
|
+
self.use_hd_transform = True
|
107
|
+
self.with_learnable_separator = True
|
108
|
+
self.hd_transform_order = "sub_glb"
|
109
|
+
self.freeze_img_processor = False
|
110
|
+
self.crop_size = 448
|
111
|
+
|
112
|
+
# image token compression
|
113
|
+
self.image_token_compression_cls = "avg_pool_2d"
|
114
|
+
self.image_token_compression = nn.AvgPool2d(kernel_size=2, stride=2)
|
115
|
+
self.base_feat_height_reduction = 1
|
116
|
+
self.base_feat_height_target = self.base_feat_height_target // 2
|
117
|
+
|
118
|
+
# with_hd_transform and with_learnable_separator should have same value
|
119
|
+
assert (
|
120
|
+
self.use_hd_transform == self.with_learnable_separator
|
121
|
+
), "use_hd_transform and with_learnable_separator should have same value"
|
122
|
+
assert self.use_hd_transform, "learnable separator is only for hd transform"
|
123
|
+
# 1024 * 4, merge spatial to channel dimension
|
124
|
+
self.glb_GN = nn.Parameter(
|
125
|
+
torch.zeros([1, 1, self.image_dim_out * self.base_feat_height_reduction**2])
|
126
|
+
)
|
127
|
+
self.sub_GN = nn.Parameter(
|
128
|
+
torch.zeros(
|
129
|
+
[1, 1, 1, self.image_dim_out * self.base_feat_height_reduction**2]
|
130
|
+
)
|
131
|
+
)
|
132
|
+
|
133
|
+
dim_projection = hidden_size
|
134
|
+
depth = 2
|
135
|
+
layers = [
|
136
|
+
nn.Linear(
|
137
|
+
image_dim_out * self.base_feat_height_reduction**2, dim_projection
|
138
|
+
)
|
139
|
+
]
|
140
|
+
for _ in range(1, depth):
|
141
|
+
layers.extend([nn.GELU(), nn.Linear(dim_projection, dim_projection)])
|
142
|
+
self.img_projection = nn.Sequential(*layers)
|
143
|
+
|
144
|
+
self.vocab_size = config.vocab_size
|
145
|
+
self.img_features = None
|
146
|
+
|
147
|
+
self.use_out_place_operations = False
|
148
|
+
|
149
|
+
def get_img_features(
|
150
|
+
self, img_embeds: torch.FloatTensor, attention_mask=None
|
151
|
+
) -> torch.FloatTensor:
|
152
|
+
img_feature = self.img_processor(
|
153
|
+
img_embeds, patch_attention_mask=attention_mask
|
154
|
+
)
|
155
|
+
|
156
|
+
patch_feature = img_feature
|
157
|
+
|
158
|
+
use_token_compression = self.image_token_compression is not None
|
159
|
+
use_padding = getattr(self, "img_processor_padding", None) is not None
|
160
|
+
if use_token_compression or use_padding:
|
161
|
+
# reshape to 2D tensor
|
162
|
+
width = int(math.sqrt(patch_feature.size(1)))
|
163
|
+
patch_feature = patch_feature.view(-1, width, width, patch_feature.size(-1))
|
164
|
+
# convert to NCHW
|
165
|
+
patch_feature = patch_feature.permute(0, 3, 1, 2)
|
166
|
+
|
167
|
+
if use_padding:
|
168
|
+
patch_feature = self.img_processor_padding(patch_feature)
|
169
|
+
if use_token_compression:
|
170
|
+
patch_feature = self.image_token_compression(patch_feature)
|
171
|
+
|
172
|
+
# convert to NHWC
|
173
|
+
patch_feature = patch_feature.permute(0, 2, 3, 1)
|
174
|
+
patch_feature = patch_feature.view(
|
175
|
+
-1,
|
176
|
+
patch_feature.size(1) * patch_feature.size(2),
|
177
|
+
patch_feature.size(-1),
|
178
|
+
)
|
179
|
+
|
180
|
+
return patch_feature
|
181
|
+
|
182
|
+
def forward(
|
183
|
+
self,
|
184
|
+
pixel_values: torch.FloatTensor,
|
185
|
+
image_sizes: torch.Tensor,
|
186
|
+
image_attention_mask: torch.Tensor,
|
187
|
+
) -> list[torch.FloatTensor]:
|
188
|
+
"""
|
189
|
+
process image and return vision embeddings.
|
190
|
+
|
191
|
+
pixel_values: (num_images, num_crops, c, h, w)
|
192
|
+
image_sizes: [[h1, w1], [h2, w2]]
|
193
|
+
image_attention_mask: num_images x num_crops x 32 x 32
|
194
|
+
output: (num_images, num_img_tokens, hidden_size)
|
195
|
+
"""
|
196
|
+
|
197
|
+
# eg
|
198
|
+
# pixel_values: torch.Size([1, 7, 3, 448, 448])
|
199
|
+
# image_sizes: tensor([[ 896, 1344]], device='cuda:0')
|
200
|
+
# output: torch.Size([1, 1841, 3072])
|
201
|
+
|
202
|
+
img_projection_params = next(self.img_projection.parameters())
|
203
|
+
target_device = img_projection_params.device
|
204
|
+
target_dtype = img_projection_params.dtype
|
205
|
+
|
206
|
+
img_sizes = image_sizes
|
207
|
+
num_images, num_crops, c, h, w = pixel_values.shape
|
208
|
+
bs = num_images
|
209
|
+
pixel_values = pixel_values.flatten(0, 1)
|
210
|
+
|
211
|
+
img_features = self.get_img_features(
|
212
|
+
pixel_values,
|
213
|
+
image_attention_mask.type(torch.BoolTensor).flatten(0, 1).to(target_device),
|
214
|
+
)
|
215
|
+
|
216
|
+
base_feat_height_target = self.base_feat_height_target
|
217
|
+
base_resolution = self.crop_size
|
218
|
+
base_feat_height_reduction = self.base_feat_height_reduction
|
219
|
+
|
220
|
+
base_feat_height = base_feat_width = int(np.sqrt(img_features.shape[1]))
|
221
|
+
assert (
|
222
|
+
base_feat_height == base_feat_height_target
|
223
|
+
and base_feat_width == base_feat_height_target
|
224
|
+
), f'base_feat_height: {base_feat_height},"\
|
225
|
+
f" base_feat_width: {base_feat_width}, "\
|
226
|
+
f"expect {base_feat_height_target} features for hd transform'
|
227
|
+
|
228
|
+
# bs x max_num_crops x (24x24) x C
|
229
|
+
img_features = img_features.view(
|
230
|
+
bs, -1, base_feat_height * base_feat_width, self.image_dim_out
|
231
|
+
)
|
232
|
+
C = self.image_dim_out
|
233
|
+
H = base_feat_height
|
234
|
+
|
235
|
+
output_imgs = []
|
236
|
+
output_len = []
|
237
|
+
# training is tensor, inference is list
|
238
|
+
if isinstance(img_sizes, torch.Tensor):
|
239
|
+
img_sizes = img_sizes.view(-1, 2)
|
240
|
+
for _bs in range(bs):
|
241
|
+
h, w = img_sizes[_bs]
|
242
|
+
h = h // base_resolution
|
243
|
+
w = w // base_resolution
|
244
|
+
B_ = h * w
|
245
|
+
|
246
|
+
# 1 x (24x24) x 1024
|
247
|
+
global_img_feature = img_features[_bs, :1]
|
248
|
+
|
249
|
+
# 1 x 12 x 12 x 4096
|
250
|
+
glb_img = (
|
251
|
+
global_img_feature.reshape(1, H, H, C)
|
252
|
+
.reshape(
|
253
|
+
1,
|
254
|
+
H // base_feat_height_reduction,
|
255
|
+
base_feat_height_reduction,
|
256
|
+
H // base_feat_height_reduction,
|
257
|
+
base_feat_height_reduction,
|
258
|
+
C,
|
259
|
+
)
|
260
|
+
.contiguous()
|
261
|
+
.permute(0, 1, 3, 2, 4, 5)
|
262
|
+
.reshape(
|
263
|
+
1,
|
264
|
+
H // base_feat_height_reduction,
|
265
|
+
H // base_feat_height_reduction,
|
266
|
+
base_feat_height_reduction * base_feat_height_reduction * C,
|
267
|
+
)
|
268
|
+
.contiguous()
|
269
|
+
)
|
270
|
+
temp_glb_GN = self.sub_GN.repeat(1, H // base_feat_height_reduction, 1, 1)
|
271
|
+
|
272
|
+
# 1 x 156 x 4096
|
273
|
+
glb_img = torch.cat([glb_img, temp_glb_GN], dim=2).reshape(
|
274
|
+
1, -1, base_feat_height_reduction * base_feat_height_reduction * C
|
275
|
+
)
|
276
|
+
|
277
|
+
# (max_num_crops-1) x (12x12) x C
|
278
|
+
sub_img = img_features[_bs, 1:]
|
279
|
+
# 16x574x1024
|
280
|
+
# get rid of padding sub_img
|
281
|
+
sub_img = sub_img[:B_]
|
282
|
+
|
283
|
+
# (num_crops, 12, 2, 12, 2, 1024) ->
|
284
|
+
# (num_crops, 12, 12, 2, 2, 1024) -> (num_crops, 12*12, 4*1024)
|
285
|
+
sub_img = (
|
286
|
+
sub_img.reshape(B_, H, H, C)
|
287
|
+
.reshape(
|
288
|
+
B_,
|
289
|
+
H // base_feat_height_reduction,
|
290
|
+
base_feat_height_reduction,
|
291
|
+
H // base_feat_height_reduction,
|
292
|
+
base_feat_height_reduction,
|
293
|
+
C,
|
294
|
+
)
|
295
|
+
.contiguous()
|
296
|
+
.permute(0, 1, 3, 2, 4, 5)
|
297
|
+
.reshape(
|
298
|
+
B_, -1, base_feat_height_reduction * base_feat_height_reduction * C
|
299
|
+
)
|
300
|
+
.contiguous()
|
301
|
+
)
|
302
|
+
sub_img = (
|
303
|
+
sub_img.reshape(
|
304
|
+
1,
|
305
|
+
h,
|
306
|
+
w,
|
307
|
+
base_feat_height // base_feat_height_reduction,
|
308
|
+
base_feat_width // base_feat_height_reduction,
|
309
|
+
-1,
|
310
|
+
)
|
311
|
+
.permute(0, 1, 3, 2, 4, 5)
|
312
|
+
.reshape(
|
313
|
+
1,
|
314
|
+
h * base_feat_height // base_feat_height_reduction,
|
315
|
+
w * base_feat_width // base_feat_height_reduction,
|
316
|
+
base_feat_height_reduction * base_feat_height_reduction * C,
|
317
|
+
)
|
318
|
+
)
|
319
|
+
|
320
|
+
if image_attention_mask is not None and len(image_attention_mask) > 0:
|
321
|
+
reshaped_image_attention_mask = (
|
322
|
+
image_attention_mask[_bs, 1 : B_ + 1, 0::2, 0::2]
|
323
|
+
.reshape(
|
324
|
+
1,
|
325
|
+
h,
|
326
|
+
w,
|
327
|
+
base_feat_height // base_feat_height_reduction,
|
328
|
+
base_feat_width // base_feat_height_reduction,
|
329
|
+
)
|
330
|
+
.permute(0, 1, 3, 2, 4)
|
331
|
+
.reshape(
|
332
|
+
1,
|
333
|
+
h * base_feat_height // base_feat_height_reduction,
|
334
|
+
w * base_feat_width // base_feat_height_reduction,
|
335
|
+
)
|
336
|
+
)
|
337
|
+
useful_height = int(reshaped_image_attention_mask[0, :, 0].sum().item())
|
338
|
+
useful_width = int(reshaped_image_attention_mask[0, 0, :].sum().item())
|
339
|
+
sub_img = sub_img[:, :useful_height, :useful_width]
|
340
|
+
temp_sub_GN = self.sub_GN.repeat(1, useful_height, 1, 1)
|
341
|
+
temp_len = (
|
342
|
+
int(image_attention_mask[_bs, : B_ + 1, 0::2, 0::2].sum().item())
|
343
|
+
+ (useful_height + 1)
|
344
|
+
+ base_feat_height // base_feat_height_reduction
|
345
|
+
)
|
346
|
+
else:
|
347
|
+
temp_sub_GN = self.sub_GN.repeat(
|
348
|
+
1, h * base_feat_height // base_feat_height_reduction, 1, 1
|
349
|
+
)
|
350
|
+
temp_len = int(
|
351
|
+
(h * w + 1) * self.num_img_tokens
|
352
|
+
+ 1
|
353
|
+
+ (h + 1) * base_feat_height // base_feat_height_reduction
|
354
|
+
)
|
355
|
+
|
356
|
+
sub_img = torch.cat([sub_img, temp_sub_GN], dim=2).reshape(
|
357
|
+
1, -1, base_feat_height_reduction * base_feat_height_reduction * C
|
358
|
+
)
|
359
|
+
# (1, num_img_tokens, 1024*4)
|
360
|
+
|
361
|
+
# glb + sub
|
362
|
+
if self.hd_transform_order == "glb_sub":
|
363
|
+
output_imgs.append(torch.cat([glb_img, self.glb_GN, sub_img], dim=1))
|
364
|
+
elif self.hd_transform_order == "sub_glb":
|
365
|
+
output_imgs.append(torch.cat([sub_img, self.glb_GN, glb_img], dim=1))
|
366
|
+
else:
|
367
|
+
raise NotImplementedError(
|
368
|
+
f'hd_transform_order = {self.hd_transform_order}, "\
|
369
|
+
"not implemented'
|
370
|
+
)
|
371
|
+
|
372
|
+
# temp_len = int((h*w+1)*144 + 1 + (h+1)*12)
|
373
|
+
assert (
|
374
|
+
temp_len == output_imgs[-1].shape[1]
|
375
|
+
), f'temp_len: {temp_len}, output_imgs[-1].shape[1]: "\
|
376
|
+
"{output_imgs[-1].shape[1]}'
|
377
|
+
|
378
|
+
output_len.append(temp_len)
|
379
|
+
|
380
|
+
img_set_tensor = []
|
381
|
+
for _output_img in output_imgs:
|
382
|
+
img_feature_proj = self.img_projection(
|
383
|
+
_output_img.to(target_device).to(target_dtype)
|
384
|
+
)
|
385
|
+
img_set_tensor.append(img_feature_proj.squeeze(0))
|
386
|
+
|
387
|
+
return img_set_tensor
|
388
|
+
|
389
|
+
|
390
|
+
class Phi4MMForCausalLM(nn.Module):
|
391
|
+
packed_modules_mapping = {
|
392
|
+
"qkv_proj": ["q_proj", "k_proj", "v_proj"],
|
393
|
+
"gate_up_proj": ["gate_proj", "up_proj"],
|
394
|
+
}
|
395
|
+
|
396
|
+
lora_pattern = re.compile(
|
397
|
+
r"^language_model\.model\.layers\.(\d+)\.(?:self_attn|mlp)\.(?:qkv_proj|o_proj|down_proj|gate_up_proj)"
|
398
|
+
)
|
399
|
+
|
400
|
+
def __init__(
|
401
|
+
self,
|
402
|
+
config: PretrainedConfig,
|
403
|
+
quant_config: Optional[QuantizationConfig] = None,
|
404
|
+
prefix: str = "",
|
405
|
+
):
|
406
|
+
super().__init__()
|
407
|
+
|
408
|
+
self.language_model = LlamaForCausalLM(
|
409
|
+
config=config, quant_config=quant_config, prefix=prefix
|
410
|
+
)
|
411
|
+
|
412
|
+
self.vision_encoder = Phi4MMImageEncoder(
|
413
|
+
config,
|
414
|
+
quant_config,
|
415
|
+
prefix="model.vision_embed_tokens",
|
416
|
+
model_dir=config._name_or_path,
|
417
|
+
)
|
418
|
+
|
419
|
+
def get_image_feature(self, items: List[MultimodalDataItem]) -> torch.Tensor:
|
420
|
+
dtype = next(self.vision_encoder.parameters()).dtype
|
421
|
+
pixel_values = torch.cat([item.pixel_values for item in items], dim=0).type(
|
422
|
+
dtype
|
423
|
+
)
|
424
|
+
image_attention_mask = torch.cat([item.image_emb_mask for item in items], dim=0)
|
425
|
+
image_sizes = torch.cat([item.image_sizes for item in items], dim=0)
|
426
|
+
image_embeds = self.vision_encoder(
|
427
|
+
pixel_values, image_sizes, image_attention_mask
|
428
|
+
)
|
429
|
+
return torch.cat(image_embeds).type(dtype)
|
430
|
+
|
431
|
+
def forward(
|
432
|
+
self,
|
433
|
+
input_ids: torch.Tensor,
|
434
|
+
positions: torch.Tensor,
|
435
|
+
forward_batch: ForwardBatch,
|
436
|
+
**kwargs: object,
|
437
|
+
) -> torch.Tensor:
|
438
|
+
hidden_states = general_mm_embed_routine(
|
439
|
+
input_ids=input_ids,
|
440
|
+
forward_batch=forward_batch,
|
441
|
+
language_model=self.language_model,
|
442
|
+
image_data_embedding_func=self.get_image_feature,
|
443
|
+
positions=positions,
|
444
|
+
)
|
445
|
+
|
446
|
+
return hidden_states
|
447
|
+
|
448
|
+
def pad_input_ids(self, input_ids: List[int], mm_inputs: MultimodalInputs):
|
449
|
+
# Get all special token IDs
|
450
|
+
im_token_id: int = mm_inputs.im_token_id
|
451
|
+
pattern = MultiModalityDataPaddingPatternMultimodalTokens([im_token_id])
|
452
|
+
return pattern.pad_input_tokens(input_ids, mm_inputs)
|
453
|
+
|
454
|
+
def should_apply_lora(self, module_name: str) -> bool:
|
455
|
+
return bool(self.lora_pattern.match(module_name))
|
456
|
+
|
457
|
+
def load_weights(self, weights: Iterable[Tuple[str, torch.Tensor]]):
|
458
|
+
stacked_params_mapping = [
|
459
|
+
# (param_name, shard_name, shard_id)
|
460
|
+
(".self_attn.qkv_proj", ".self_attn.q_proj", "q"),
|
461
|
+
(".self_attn.qkv_proj", ".self_attn.k_proj", "k"),
|
462
|
+
(".self_attn.qkv_proj", ".self_attn.v_proj", "v"),
|
463
|
+
]
|
464
|
+
prefix_mapping = {
|
465
|
+
"model.embed_tokens_extend.image_embed.": "vision_encoder.",
|
466
|
+
"model.": "language_model.model.",
|
467
|
+
}
|
468
|
+
|
469
|
+
skip_list = [
|
470
|
+
"img_processor.encoder.layers.26",
|
471
|
+
"img_processor.head",
|
472
|
+
"img_processor.post_layernorm",
|
473
|
+
"audio",
|
474
|
+
]
|
475
|
+
|
476
|
+
def _should_skip(name: str) -> bool:
|
477
|
+
return any(substr in name for substr in skip_list)
|
478
|
+
|
479
|
+
params_dict = dict(self.named_parameters())
|
480
|
+
for name, loaded_weight in weights:
|
481
|
+
# Skip the last layer
|
482
|
+
if _should_skip(name):
|
483
|
+
continue
|
484
|
+
|
485
|
+
for old_name, new_name in prefix_mapping.items():
|
486
|
+
if name.startswith(old_name):
|
487
|
+
name = name.replace(old_name, new_name)
|
488
|
+
break
|
489
|
+
|
490
|
+
# Adapt to VisionAttention
|
491
|
+
name = name.replace(r"self_attn.out_proj", r"self_attn.proj")
|
492
|
+
name = name.replace(r"base_layer.", r"")
|
493
|
+
|
494
|
+
for param_name, weight_name, shard_id in stacked_params_mapping:
|
495
|
+
if weight_name not in name:
|
496
|
+
continue
|
497
|
+
name = name.replace(weight_name, param_name)
|
498
|
+
param = params_dict[name]
|
499
|
+
weight_loader = param.weight_loader
|
500
|
+
weight_loader(param, loaded_weight, shard_id)
|
501
|
+
break
|
502
|
+
else:
|
503
|
+
param = params_dict.get(name)
|
504
|
+
if param is None:
|
505
|
+
if "lora" not in name:
|
506
|
+
logger.warning("Warning: {name} not found in model parameters")
|
507
|
+
continue
|
508
|
+
weight_loader = getattr(param, "weight_loader", default_weight_loader)
|
509
|
+
weight_loader(param, loaded_weight)
|
510
|
+
|
511
|
+
|
512
|
+
EntryClass = [Phi4MMForCausalLM]
|