vllm-cpu-amxbf16 0.9.1__cp312-cp312-manylinux_2_17_x86_64.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.
- vllm/_C.abi3.so +0 -0
- vllm/__init__.py +53 -0
- vllm/_custom_ops.py +1828 -0
- vllm/_ipex_ops.py +244 -0
- vllm/_version.py +34 -0
- vllm/adapter_commons/__init__.py +0 -0
- vllm/adapter_commons/layers.py +16 -0
- vllm/adapter_commons/models.py +106 -0
- vllm/adapter_commons/request.py +26 -0
- vllm/adapter_commons/utils.py +93 -0
- vllm/adapter_commons/worker_manager.py +39 -0
- vllm/assets/__init__.py +0 -0
- vllm/assets/audio.py +45 -0
- vllm/assets/base.py +41 -0
- vllm/assets/image.py +34 -0
- vllm/assets/video.py +115 -0
- vllm/attention/__init__.py +20 -0
- vllm/attention/backends/__init__.py +0 -0
- vllm/attention/backends/abstract.py +308 -0
- vllm/attention/backends/blocksparse_attn.py +461 -0
- vllm/attention/backends/cpu_mla.py +307 -0
- vllm/attention/backends/dual_chunk_flash_attn.py +1498 -0
- vllm/attention/backends/flash_attn.py +1003 -0
- vllm/attention/backends/flashinfer.py +1104 -0
- vllm/attention/backends/flashmla.py +244 -0
- vllm/attention/backends/hpu_attn.py +313 -0
- vllm/attention/backends/ipex_attn.py +398 -0
- vllm/attention/backends/mla/__init__.py +0 -0
- vllm/attention/backends/mla/common.py +1385 -0
- vllm/attention/backends/pallas.py +351 -0
- vllm/attention/backends/placeholder_attn.py +400 -0
- vllm/attention/backends/rocm_aiter_mla.py +435 -0
- vllm/attention/backends/rocm_flash_attn.py +975 -0
- vllm/attention/backends/torch_sdpa.py +703 -0
- vllm/attention/backends/triton_mla.py +115 -0
- vllm/attention/backends/utils.py +610 -0
- vllm/attention/backends/xformers.py +802 -0
- vllm/attention/layer.py +468 -0
- vllm/attention/ops/__init__.py +0 -0
- vllm/attention/ops/blocksparse_attention/__init__.py +0 -0
- vllm/attention/ops/blocksparse_attention/blocksparse_attention_kernel.py +433 -0
- vllm/attention/ops/blocksparse_attention/interface.py +239 -0
- vllm/attention/ops/blocksparse_attention/utils.py +246 -0
- vllm/attention/ops/chunked_prefill_paged_decode.py +368 -0
- vllm/attention/ops/flashmla.py +116 -0
- vllm/attention/ops/hpu_paged_attn.py +88 -0
- vllm/attention/ops/ipex_attn.py +195 -0
- vllm/attention/ops/merge_attn_states.py +43 -0
- vllm/attention/ops/nki_flash_attn.py +906 -0
- vllm/attention/ops/paged_attn.py +256 -0
- vllm/attention/ops/prefix_prefill.py +902 -0
- vllm/attention/ops/rocm_aiter_mla.py +100 -0
- vllm/attention/ops/rocm_aiter_paged_attn.py +102 -0
- vllm/attention/ops/triton_decode_attention.py +674 -0
- vllm/attention/ops/triton_flash_attention.py +979 -0
- vllm/attention/ops/triton_merge_attn_states.py +97 -0
- vllm/attention/ops/triton_unified_attention.py +334 -0
- vllm/attention/selector.py +187 -0
- vllm/attention/utils/fa_utils.py +55 -0
- vllm/beam_search.py +87 -0
- vllm/benchmarks/__init__.py +0 -0
- vllm/benchmarks/datasets.py +1185 -0
- vllm/benchmarks/endpoint_request_func.py +381 -0
- vllm/benchmarks/latency.py +168 -0
- vllm/benchmarks/serve.py +1135 -0
- vllm/benchmarks/throughput.py +609 -0
- vllm/benchmarks/utils.py +70 -0
- vllm/collect_env.py +820 -0
- vllm/compilation/__init__.py +0 -0
- vllm/compilation/activation_quant_fusion.py +89 -0
- vllm/compilation/backends.py +563 -0
- vllm/compilation/base_piecewise_backend.py +72 -0
- vllm/compilation/collective_fusion.py +127 -0
- vllm/compilation/compiler_interface.py +544 -0
- vllm/compilation/counter.py +38 -0
- vllm/compilation/cuda_piecewise_backend.py +214 -0
- vllm/compilation/decorators.py +250 -0
- vllm/compilation/fix_functionalization.py +191 -0
- vllm/compilation/fusion.py +618 -0
- vllm/compilation/fx_utils.py +62 -0
- vllm/compilation/inductor_pass.py +115 -0
- vllm/compilation/monitor.py +39 -0
- vllm/compilation/multi_output_match.py +109 -0
- vllm/compilation/noop_elimination.py +137 -0
- vllm/compilation/pass_manager.py +78 -0
- vllm/compilation/sequence_parallelism.py +268 -0
- vllm/compilation/torch25_custom_graph_pass.py +42 -0
- vllm/compilation/vllm_inductor_pass.py +67 -0
- vllm/compilation/wrapper.py +135 -0
- vllm/config.py +4746 -0
- vllm/connections.py +174 -0
- vllm/core/__init__.py +0 -0
- vllm/core/block/__init__.py +0 -0
- vllm/core/block/block_table.py +399 -0
- vllm/core/block/common.py +371 -0
- vllm/core/block/cpu_gpu_block_allocator.py +441 -0
- vllm/core/block/interfaces.py +319 -0
- vllm/core/block/naive_block.py +466 -0
- vllm/core/block/prefix_caching_block.py +1135 -0
- vllm/core/block/utils.py +28 -0
- vllm/core/block_manager.py +521 -0
- vllm/core/evictor.py +157 -0
- vllm/core/interfaces.py +135 -0
- vllm/core/placeholder_block_space_manager.py +100 -0
- vllm/core/scheduler.py +2093 -0
- vllm/device_allocator/__init__.py +0 -0
- vllm/device_allocator/cumem.py +281 -0
- vllm/distributed/__init__.py +6 -0
- vllm/distributed/communication_op.py +41 -0
- vllm/distributed/device_communicators/__init__.py +0 -0
- vllm/distributed/device_communicators/all2all.py +264 -0
- vllm/distributed/device_communicators/base_device_communicator.py +260 -0
- vllm/distributed/device_communicators/cpu_communicator.py +145 -0
- vllm/distributed/device_communicators/cuda_communicator.py +176 -0
- vllm/distributed/device_communicators/cuda_wrapper.py +180 -0
- vllm/distributed/device_communicators/custom_all_reduce.py +304 -0
- vllm/distributed/device_communicators/custom_all_reduce_utils.py +259 -0
- vllm/distributed/device_communicators/hpu_communicator.py +46 -0
- vllm/distributed/device_communicators/neuron_communicator.py +20 -0
- vllm/distributed/device_communicators/pynccl.py +218 -0
- vllm/distributed/device_communicators/pynccl_wrapper.py +341 -0
- vllm/distributed/device_communicators/shm_broadcast.py +585 -0
- vllm/distributed/device_communicators/tpu_communicator.py +103 -0
- vllm/distributed/device_communicators/xpu_communicator.py +55 -0
- vllm/distributed/kv_events.py +356 -0
- vllm/distributed/kv_transfer/README.md +29 -0
- vllm/distributed/kv_transfer/__init__.py +12 -0
- vllm/distributed/kv_transfer/disagg_prefill_workflow.jpg +0 -0
- vllm/distributed/kv_transfer/kv_connector/__init__.py +0 -0
- vllm/distributed/kv_transfer/kv_connector/base.py +128 -0
- vllm/distributed/kv_transfer/kv_connector/factory.py +128 -0
- vllm/distributed/kv_transfer/kv_connector/lmcache_connector.py +99 -0
- vllm/distributed/kv_transfer/kv_connector/mooncake_store_connector.py +203 -0
- vllm/distributed/kv_transfer/kv_connector/simple_connector.py +329 -0
- vllm/distributed/kv_transfer/kv_connector/utils.py +108 -0
- vllm/distributed/kv_transfer/kv_connector/v1/__init__.py +6 -0
- vllm/distributed/kv_transfer/kv_connector/v1/base.py +283 -0
- vllm/distributed/kv_transfer/kv_connector/v1/lmcache_connector.py +134 -0
- vllm/distributed/kv_transfer/kv_connector/v1/multi_connector.py +201 -0
- vllm/distributed/kv_transfer/kv_connector/v1/nixl_connector.py +1030 -0
- vllm/distributed/kv_transfer/kv_connector/v1/shared_storage_connector.py +384 -0
- vllm/distributed/kv_transfer/kv_connector_agent.py +77 -0
- vllm/distributed/kv_transfer/kv_lookup_buffer/__init__.py +0 -0
- vllm/distributed/kv_transfer/kv_lookup_buffer/base.py +175 -0
- vllm/distributed/kv_transfer/kv_lookup_buffer/mooncake_store.py +161 -0
- vllm/distributed/kv_transfer/kv_lookup_buffer/simple_buffer.py +237 -0
- vllm/distributed/kv_transfer/kv_pipe/__init__.py +0 -0
- vllm/distributed/kv_transfer/kv_pipe/base.py +67 -0
- vllm/distributed/kv_transfer/kv_pipe/mooncake_pipe.py +280 -0
- vllm/distributed/kv_transfer/kv_pipe/pynccl_pipe.py +280 -0
- vllm/distributed/kv_transfer/kv_transfer_state.py +71 -0
- vllm/distributed/parallel_state.py +1296 -0
- vllm/distributed/tpu_distributed_utils.py +177 -0
- vllm/distributed/utils.py +536 -0
- vllm/engine/__init__.py +0 -0
- vllm/engine/arg_utils.py +1708 -0
- vllm/engine/async_llm_engine.py +1200 -0
- vllm/engine/async_timeout.py +173 -0
- vllm/engine/llm_engine.py +2097 -0
- vllm/engine/metrics.py +629 -0
- vllm/engine/metrics_types.py +94 -0
- vllm/engine/multiprocessing/__init__.py +148 -0
- vllm/engine/multiprocessing/client.py +681 -0
- vllm/engine/multiprocessing/engine.py +460 -0
- vllm/engine/output_processor/__init__.py +0 -0
- vllm/engine/output_processor/interfaces.py +75 -0
- vllm/engine/output_processor/multi_step.py +216 -0
- vllm/engine/output_processor/single_step.py +145 -0
- vllm/engine/output_processor/stop_checker.py +131 -0
- vllm/engine/output_processor/util.py +28 -0
- vllm/engine/protocol.py +317 -0
- vllm/entrypoints/__init__.py +0 -0
- vllm/entrypoints/api_server.py +178 -0
- vllm/entrypoints/chat_utils.py +1299 -0
- vllm/entrypoints/cli/__init__.py +0 -0
- vllm/entrypoints/cli/benchmark/__init__.py +0 -0
- vllm/entrypoints/cli/benchmark/base.py +39 -0
- vllm/entrypoints/cli/benchmark/latency.py +30 -0
- vllm/entrypoints/cli/benchmark/main.py +54 -0
- vllm/entrypoints/cli/benchmark/serve.py +30 -0
- vllm/entrypoints/cli/benchmark/throughput.py +30 -0
- vllm/entrypoints/cli/collect_env.py +35 -0
- vllm/entrypoints/cli/main.py +65 -0
- vllm/entrypoints/cli/openai.py +205 -0
- vllm/entrypoints/cli/run_batch.py +62 -0
- vllm/entrypoints/cli/serve.py +328 -0
- vllm/entrypoints/cli/types.py +25 -0
- vllm/entrypoints/launcher.py +147 -0
- vllm/entrypoints/llm.py +1544 -0
- vllm/entrypoints/logger.py +50 -0
- vllm/entrypoints/openai/__init__.py +0 -0
- vllm/entrypoints/openai/api_server.py +1387 -0
- vllm/entrypoints/openai/cli_args.py +315 -0
- vllm/entrypoints/openai/logits_processors.py +90 -0
- vllm/entrypoints/openai/protocol.py +1913 -0
- vllm/entrypoints/openai/run_batch.py +463 -0
- vllm/entrypoints/openai/serving_chat.py +1221 -0
- vllm/entrypoints/openai/serving_classification.py +160 -0
- vllm/entrypoints/openai/serving_completion.py +592 -0
- vllm/entrypoints/openai/serving_embedding.py +201 -0
- vllm/entrypoints/openai/serving_engine.py +986 -0
- vllm/entrypoints/openai/serving_models.py +315 -0
- vllm/entrypoints/openai/serving_pooling.py +232 -0
- vllm/entrypoints/openai/serving_score.py +433 -0
- vllm/entrypoints/openai/serving_tokenization.py +157 -0
- vllm/entrypoints/openai/serving_transcription.py +424 -0
- vllm/entrypoints/openai/tool_parsers/__init__.py +23 -0
- vllm/entrypoints/openai/tool_parsers/abstract_tool_parser.py +164 -0
- vllm/entrypoints/openai/tool_parsers/deepseekv3_tool_parser.py +370 -0
- vllm/entrypoints/openai/tool_parsers/granite_20b_fc_tool_parser.py +259 -0
- vllm/entrypoints/openai/tool_parsers/granite_tool_parser.py +237 -0
- vllm/entrypoints/openai/tool_parsers/hermes_tool_parser.py +371 -0
- vllm/entrypoints/openai/tool_parsers/internlm2_tool_parser.py +216 -0
- vllm/entrypoints/openai/tool_parsers/jamba_tool_parser.py +308 -0
- vllm/entrypoints/openai/tool_parsers/llama4_pythonic_tool_parser.py +316 -0
- vllm/entrypoints/openai/tool_parsers/llama_tool_parser.py +267 -0
- vllm/entrypoints/openai/tool_parsers/mistral_tool_parser.py +369 -0
- vllm/entrypoints/openai/tool_parsers/phi4mini_tool_parser.py +112 -0
- vllm/entrypoints/openai/tool_parsers/pythonic_tool_parser.py +308 -0
- vllm/entrypoints/openai/tool_parsers/utils.py +124 -0
- vllm/entrypoints/score_utils.py +50 -0
- vllm/entrypoints/ssl.py +75 -0
- vllm/entrypoints/utils.py +233 -0
- vllm/env_override.py +41 -0
- vllm/envs.py +944 -0
- vllm/executor/__init__.py +0 -0
- vllm/executor/executor_base.py +401 -0
- vllm/executor/mp_distributed_executor.py +244 -0
- vllm/executor/msgspec_utils.py +30 -0
- vllm/executor/multiproc_worker_utils.py +313 -0
- vllm/executor/ray_distributed_executor.py +701 -0
- vllm/executor/ray_utils.py +399 -0
- vllm/executor/uniproc_executor.py +139 -0
- vllm/forward_context.py +179 -0
- vllm/inputs/__init__.py +41 -0
- vllm/inputs/data.py +331 -0
- vllm/inputs/parse.py +151 -0
- vllm/inputs/preprocess.py +909 -0
- vllm/inputs/registry.py +237 -0
- vllm/jsontree.py +80 -0
- vllm/logger.py +212 -0
- vllm/logging_utils/__init__.py +8 -0
- vllm/logging_utils/dump_input.py +85 -0
- vllm/logging_utils/formatter.py +18 -0
- vllm/logits_process.py +119 -0
- vllm/lora/__init__.py +0 -0
- vllm/lora/fully_sharded_layers.py +355 -0
- vllm/lora/layers.py +1285 -0
- vllm/lora/lora.py +199 -0
- vllm/lora/models.py +818 -0
- vllm/lora/ops/__init__.py +0 -0
- vllm/lora/ops/torch_ops/__init__.py +16 -0
- vllm/lora/ops/torch_ops/lora_ops.py +119 -0
- vllm/lora/ops/triton_ops/__init__.py +12 -0
- vllm/lora/ops/triton_ops/kernel_utils.py +243 -0
- vllm/lora/ops/triton_ops/lora_expand_op.py +290 -0
- vllm/lora/ops/triton_ops/lora_kernel_metadata.py +148 -0
- vllm/lora/ops/triton_ops/lora_shrink_op.py +244 -0
- vllm/lora/ops/triton_ops/utils.py +120 -0
- vllm/lora/ops/xla_ops/__init__.py +7 -0
- vllm/lora/ops/xla_ops/lora_ops.py +145 -0
- vllm/lora/peft_helper.py +136 -0
- vllm/lora/punica_wrapper/__init__.py +10 -0
- vllm/lora/punica_wrapper/punica_base.py +485 -0
- vllm/lora/punica_wrapper/punica_cpu.py +349 -0
- vllm/lora/punica_wrapper/punica_gpu.py +290 -0
- vllm/lora/punica_wrapper/punica_hpu.py +145 -0
- vllm/lora/punica_wrapper/punica_selector.py +20 -0
- vllm/lora/punica_wrapper/punica_tpu.py +405 -0
- vllm/lora/punica_wrapper/utils.py +164 -0
- vllm/lora/request.py +99 -0
- vllm/lora/resolver.py +85 -0
- vllm/lora/utils.py +240 -0
- vllm/lora/worker_manager.py +259 -0
- vllm/model_executor/__init__.py +16 -0
- vllm/model_executor/custom_op.py +152 -0
- vllm/model_executor/guided_decoding/__init__.py +181 -0
- vllm/model_executor/guided_decoding/guidance_decoding.py +63 -0
- vllm/model_executor/guided_decoding/guidance_logits_processors.py +104 -0
- vllm/model_executor/guided_decoding/guided_fields.py +41 -0
- vllm/model_executor/guided_decoding/lm_format_enforcer_decoding.py +67 -0
- vllm/model_executor/guided_decoding/outlines_decoding.py +155 -0
- vllm/model_executor/guided_decoding/outlines_logits_processors.py +284 -0
- vllm/model_executor/guided_decoding/utils.py +242 -0
- vllm/model_executor/guided_decoding/xgrammar_decoding.py +426 -0
- vllm/model_executor/layers/__init__.py +0 -0
- vllm/model_executor/layers/activation.py +369 -0
- vllm/model_executor/layers/fused_moe/__init__.py +54 -0
- vllm/model_executor/layers/fused_moe/batched_deep_gemm_moe.py +125 -0
- vllm/model_executor/layers/fused_moe/batched_triton_or_deep_gemm_moe.py +117 -0
- vllm/model_executor/layers/fused_moe/configs/E=1,N=14336,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a16.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=1,N=14336,device_name=NVIDIA_A100-SXM4-80GB.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=1,N=1792,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a16.json +218 -0
- vllm/model_executor/layers/fused_moe/configs/E=1,N=1792,device_name=NVIDIA_A100-SXM4-80GB.json +218 -0
- vllm/model_executor/layers/fused_moe/configs/E=1,N=3072,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a16.json +218 -0
- vllm/model_executor/layers/fused_moe/configs/E=1,N=3072,device_name=NVIDIA_H100_80GB_HBM3,dtype=int8_w8a16.json +218 -0
- vllm/model_executor/layers/fused_moe/configs/E=1,N=3072,device_name=NVIDIA_H100_80GB_HBM3.json +218 -0
- vllm/model_executor/layers/fused_moe/configs/E=1,N=3584,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a16.json +218 -0
- vllm/model_executor/layers/fused_moe/configs/E=1,N=3584,device_name=NVIDIA_A100-SXM4-80GB.json +218 -0
- vllm/model_executor/layers/fused_moe/configs/E=1,N=7168,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a16.json +218 -0
- vllm/model_executor/layers/fused_moe/configs/E=1,N=7168,device_name=NVIDIA_A100-SXM4-80GB.json +218 -0
- vllm/model_executor/layers/fused_moe/configs/E=128,N=1024,device_name=AMD_Instinct_MI300X,dtype=fp8_w8a8.json +164 -0
- vllm/model_executor/layers/fused_moe/configs/E=128,N=1024,device_name=AMD_Instinct_MI300X.json +200 -0
- vllm/model_executor/layers/fused_moe/configs/E=128,N=192,device_name=NVIDIA_A100-SXM4-80GB.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=128,N=192,device_name=NVIDIA_H100_80GB_HBM3.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=128,N=192,device_name=NVIDIA_H20-3e.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=128,N=192,device_name=NVIDIA_H20.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=128,N=192,device_name=NVIDIA_H200.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=128,N=384,device_name=AMD_Instinct_MI300X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/fused_moe/configs/E=128,N=384,device_name=NVIDIA_H20,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=128,N=384,device_name=NVIDIA_H20-3e.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=128,N=384,device_name=NVIDIA_H20.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=128,N=384,device_name=NVIDIA_H200,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=128,N=384,device_name=NVIDIA_H200.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=128,N=512,device_name=NVIDIA_H100_80GB_HBM3.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=128,N=768,device_name=AMD_Instinct_MI300X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/fused_moe/configs/E=128,N=768,device_name=NVIDIA_H20,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=128,N=768,device_name=NVIDIA_H20.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=128,N=768,device_name=NVIDIA_H200,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=128,N=768,device_name=NVIDIA_H200.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=128,N=96,device_name=NVIDIA_H20.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=16,N=1024,device_name=AMD_Instinct_MI300X.json +200 -0
- vllm/model_executor/layers/fused_moe/configs/E=16,N=1024,device_name=NVIDIA_H100.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=16,N=1344,device_name=NVIDIA_A100-SXM4-40GB.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=16,N=1344,device_name=NVIDIA_A100-SXM4-80GB.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=16,N=1344,device_name=NVIDIA_H100_80GB_HBM3.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=16,N=14336,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a16.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=16,N=14336,device_name=NVIDIA_A100-SXM4-80GB.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=16,N=1792,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a16.json +218 -0
- vllm/model_executor/layers/fused_moe/configs/E=16,N=1792,device_name=NVIDIA_A100-SXM4-80GB.json +218 -0
- vllm/model_executor/layers/fused_moe/configs/E=16,N=2688,device_name=NVIDIA_A100-SXM4-80GB.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=16,N=2688,device_name=NVIDIA_H100_80GB_HBM3.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=16,N=3072,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a16.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=16,N=3072,device_name=NVIDIA_H100_80GB_HBM3,dtype=int8_w8a16.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=16,N=3200,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8.json +130 -0
- vllm/model_executor/layers/fused_moe/configs/E=16,N=3584,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a16.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=16,N=3584,device_name=NVIDIA_A100-SXM4-80GB.json +218 -0
- vllm/model_executor/layers/fused_moe/configs/E=16,N=6400,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8.json +130 -0
- vllm/model_executor/layers/fused_moe/configs/E=16,N=7168,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a16.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=16,N=7168,device_name=NVIDIA_A100-SXM4-80GB.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=16,N=7168,device_name=NVIDIA_H100_80GB_HBM3,dtype=int8_w8a16.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=16,N=800,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8.json +130 -0
- vllm/model_executor/layers/fused_moe/configs/E=160,N=192,device_name=NVIDIA_A800-SXM4-80GB.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=256,N=1024,device_name=AMD_Instinct_MI325X,block_shape=[128,128].json +200 -0
- vllm/model_executor/layers/fused_moe/configs/E=256,N=1024,device_name=AMD_Instinct_MI325_OAM,dtype=fp8_w8a8,block_shape=[128,128].json +200 -0
- vllm/model_executor/layers/fused_moe/configs/E=256,N=128,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=256,N=128,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a8.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=256,N=128,device_name=NVIDIA_A800-SXM4-80GB,dtype=int8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=256,N=128,device_name=NVIDIA_A800-SXM4-80GB,dtype=int8_w8a8.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=256,N=128,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=256,N=128,device_name=NVIDIA_H20,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=256,N=128,device_name=NVIDIA_L20Y,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=256,N=256,device_name=AMD_Instinct_MI300X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/fused_moe/configs/E=256,N=256,device_name=AMD_Instinct_MI325X,dtype=fp8_w8a8,block_shape=[128,128].json +200 -0
- vllm/model_executor/layers/fused_moe/configs/E=256,N=256,device_name=AMD_Instinct_MI325_OAM,dtype=fp8_w8a8,block_shape=[128,128].json +200 -0
- vllm/model_executor/layers/fused_moe/configs/E=256,N=256,device_name=NVIDIA_B200,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=256,N=256,device_name=NVIDIA_H20,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=256,N=256,device_name=NVIDIA_H20,dtype=int8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=256,N=256,device_name=NVIDIA_H20-3e,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=256,N=256,device_name=NVIDIA_H200,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=256,N=256,device_name=NVIDIA_L20,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=256,N=512,device_name=AMD_Instinct_MI325_OAM,dtype=fp8_w8a8,block_shape=[128,128].json +200 -0
- vllm/model_executor/layers/fused_moe/configs/E=256,N=64,device_name=NVIDIA_A800-SXM4-80GB.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=60,N=1408,device_name=AMD_Instinct_MI300X.json +200 -0
- vllm/model_executor/layers/fused_moe/configs/E=60,N=176,device_name=AMD_Instinct_MI300X.json +200 -0
- vllm/model_executor/layers/fused_moe/configs/E=60,N=352,device_name=AMD_Instinct_MI300X.json +200 -0
- vllm/model_executor/layers/fused_moe/configs/E=60,N=704,device_name=AMD_Instinct_MI300X.json +200 -0
- vllm/model_executor/layers/fused_moe/configs/E=64,N=1280,device_name=NVIDIA_A100-SXM4-80GB.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=64,N=1280,device_name=NVIDIA_A800-SXM4-80GB.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=64,N=1280,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=64,N=1280,device_name=NVIDIA_H100_80GB_HBM3.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=64,N=1280,device_name=NVIDIA_H200,dtype=fp8_w8a8.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=64,N=1280,device_name=NVIDIA_H200.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=64,N=2560,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=64,N=2560,device_name=NVIDIA_H200,dtype=fp8_w8a8.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=64,N=2560,device_name=NVIDIA_H200.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=64,N=320,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=64,N=320,device_name=NVIDIA_H100_80GB_HBM3.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=64,N=320,device_name=NVIDIA_H200,dtype=fp8_w8a8.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=64,N=320,device_name=NVIDIA_H200.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=64,N=640,device_name=NVIDIA_A100-SXM4-80GB.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=64,N=640,device_name=NVIDIA_A800-SXM4-80GB.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=64,N=640,device_name=NVIDIA_GeForce_RTX_4090,dtype=fp8_w8a8.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=64,N=640,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=64,N=640,device_name=NVIDIA_H100_80GB_HBM3.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=64,N=640,device_name=NVIDIA_H200,dtype=fp8_w8a8.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=64,N=640,device_name=NVIDIA_H200.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=64,N=896,device_name=NVIDIA_H20.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=14336,device_name=AMD_Instinct_MI300X,dtype=fp8_w8a8.json +164 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=14336,device_name=AMD_Instinct_MI300X.json +200 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=14336,device_name=AMD_Instinct_MI325X,dtype=fp8_w8a8.json +164 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=14336,device_name=AMD_Instinct_MI325X.json +200 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=14336,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8.json +138 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=14336,device_name=NVIDIA_H200,dtype=fp8_w8a8.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=14336,device_name=NVIDIA_H200.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=16384,device_name=AMD_Instinct_MI300X,dtype=fp8_w8a8.json +164 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=16384,device_name=AMD_Instinct_MI300X.json +200 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=16384,device_name=AMD_Instinct_MI325X,dtype=fp8_w8a8.json +164 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=16384,device_name=AMD_Instinct_MI325X.json +200 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=1792,device_name=AMD_Instinct_MI300X,dtype=fp8_w8a8.json +164 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=1792,device_name=AMD_Instinct_MI300X.json +200 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=1792,device_name=AMD_Instinct_MI325X,dtype=fp8_w8a8.json +164 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=1792,device_name=AMD_Instinct_MI325X.json +200 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=1792,device_name=NVIDIA_A100-SXM4-40GB.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=1792,device_name=NVIDIA_A100-SXM4-80GB.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=1792,device_name=NVIDIA_H100_80GB_HBM3.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=1792,device_name=NVIDIA_H200,dtype=fp8_w8a8.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=1792,device_name=NVIDIA_H200.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=2048,device_name=AMD_Instinct_MI300X,dtype=fp8_w8a8.json +164 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=2048,device_name=AMD_Instinct_MI300X.json +200 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=2048,device_name=AMD_Instinct_MI325X,dtype=fp8_w8a8.json +164 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=2048,device_name=AMD_Instinct_MI325X.json +200 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=2048,device_name=NVIDIA_A100-SXM4-80GB.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=2048,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=2048,device_name=NVIDIA_H100_80GB_HBM3.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=2048,device_name=NVIDIA_H200,dtype=fp8_w8a8.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=2048,device_name=NVIDIA_H200.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=3584,device_name=AMD_Instinct_MI300X,dtype=fp8_w8a8.json +164 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=3584,device_name=AMD_Instinct_MI300X.json +200 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=3584,device_name=AMD_Instinct_MI325X,dtype=fp8_w8a8.json +164 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=3584,device_name=AMD_Instinct_MI325X.json +200 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=3584,device_name=NVIDIA_A100-SXM4-40GB.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=3584,device_name=NVIDIA_A100-SXM4-80GB.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=3584,device_name=NVIDIA_GeForce_RTX_4090,dtype=fp8_w8a8.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=3584,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=3584,device_name=NVIDIA_H100_80GB_HBM3.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=3584,device_name=NVIDIA_H200,dtype=fp8_w8a8.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=3584,device_name=NVIDIA_H200.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=3584,device_name=NVIDIA_L40S.json +173 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=4096,device_name=AMD_Instinct_MI300X,dtype=fp8_w8a8.json +164 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=4096,device_name=AMD_Instinct_MI300X.json +200 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=4096,device_name=AMD_Instinct_MI325X,dtype=fp8_w8a8.json +164 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=4096,device_name=AMD_Instinct_MI325X.json +200 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=4096,device_name=NVIDIA_A100-SXM4-80GB.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=4096,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=4096,device_name=NVIDIA_H100_80GB_HBM3.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=4096,device_name=NVIDIA_H200,dtype=fp8_w8a8.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=4096,device_name=NVIDIA_H200.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=7168,device_name=AMD_Instinct_MI300X,dtype=fp8_w8a8.json +164 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=7168,device_name=AMD_Instinct_MI300X.json +200 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=7168,device_name=AMD_Instinct_MI325X,dtype=fp8_w8a8.json +164 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=7168,device_name=AMD_Instinct_MI325X.json +200 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=7168,device_name=NVIDIA_A100-SXM4-80GB.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=7168,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=7168,device_name=NVIDIA_H100_80GB_HBM3.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=7168,device_name=NVIDIA_H200,dtype=fp8_w8a8.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=7168,device_name=NVIDIA_H200.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=8192,device_name=AMD_Instinct_MI300X,dtype=fp8_w8a8.json +164 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=8192,device_name=AMD_Instinct_MI300X.json +200 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=8192,device_name=AMD_Instinct_MI325X,dtype=fp8_w8a8.json +164 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=8192,device_name=AMD_Instinct_MI325X.json +200 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=8192,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=8192,device_name=NVIDIA_H200,dtype=fp8_w8a8.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/README +12 -0
- vllm/model_executor/layers/fused_moe/cutlass_moe.py +461 -0
- vllm/model_executor/layers/fused_moe/deep_gemm_moe.py +240 -0
- vllm/model_executor/layers/fused_moe/deepep_ht_prepare_finalize.py +240 -0
- vllm/model_executor/layers/fused_moe/deepep_ll_prepare_finalize.py +186 -0
- vllm/model_executor/layers/fused_moe/fused_batched_moe.py +775 -0
- vllm/model_executor/layers/fused_moe/fused_marlin_moe.py +232 -0
- vllm/model_executor/layers/fused_moe/fused_moe.py +1724 -0
- vllm/model_executor/layers/fused_moe/layer.py +1535 -0
- vllm/model_executor/layers/fused_moe/modular_kernel.py +446 -0
- vllm/model_executor/layers/fused_moe/moe_align_block_size.py +243 -0
- vllm/model_executor/layers/fused_moe/moe_pallas.py +80 -0
- vllm/model_executor/layers/fused_moe/moe_permute_unpermute.py +190 -0
- vllm/model_executor/layers/fused_moe/moe_torch_iterative.py +60 -0
- vllm/model_executor/layers/fused_moe/pplx_prepare_finalize.py +159 -0
- vllm/model_executor/layers/fused_moe/prepare_finalize.py +69 -0
- vllm/model_executor/layers/fused_moe/rocm_aiter_fused_moe.py +421 -0
- vllm/model_executor/layers/fused_moe/triton_deep_gemm_moe.py +117 -0
- vllm/model_executor/layers/fused_moe/utils.py +98 -0
- vllm/model_executor/layers/layernorm.py +288 -0
- vllm/model_executor/layers/lightning_attn.py +652 -0
- vllm/model_executor/layers/linear.py +1524 -0
- vllm/model_executor/layers/logits_processor.py +197 -0
- vllm/model_executor/layers/mamba/__init__.py +0 -0
- vllm/model_executor/layers/mamba/mamba2_metadata.py +125 -0
- vllm/model_executor/layers/mamba/mamba_mixer.py +245 -0
- vllm/model_executor/layers/mamba/mamba_mixer2.py +616 -0
- vllm/model_executor/layers/mamba/ops/__init__.py +0 -0
- vllm/model_executor/layers/mamba/ops/causal_conv1d.py +105 -0
- vllm/model_executor/layers/mamba/ops/mamba_ssm.py +414 -0
- vllm/model_executor/layers/mamba/ops/ssd_bmm.py +262 -0
- vllm/model_executor/layers/mamba/ops/ssd_chunk_scan.py +589 -0
- vllm/model_executor/layers/mamba/ops/ssd_chunk_state.py +751 -0
- vllm/model_executor/layers/mamba/ops/ssd_combined.py +232 -0
- vllm/model_executor/layers/mamba/ops/ssd_state_passing.py +206 -0
- vllm/model_executor/layers/pooler.py +350 -0
- vllm/model_executor/layers/quantization/__init__.py +157 -0
- vllm/model_executor/layers/quantization/aqlm.py +376 -0
- vllm/model_executor/layers/quantization/auto_round.py +310 -0
- vllm/model_executor/layers/quantization/awq.py +194 -0
- vllm/model_executor/layers/quantization/awq_marlin.py +519 -0
- vllm/model_executor/layers/quantization/awq_triton.py +320 -0
- vllm/model_executor/layers/quantization/base_config.py +151 -0
- vllm/model_executor/layers/quantization/bitblas.py +461 -0
- vllm/model_executor/layers/quantization/bitsandbytes.py +396 -0
- vllm/model_executor/layers/quantization/compressed_tensors/__init__.py +0 -0
- vllm/model_executor/layers/quantization/compressed_tensors/compressed_tensors.py +668 -0
- vllm/model_executor/layers/quantization/compressed_tensors/compressed_tensors_moe.py +1260 -0
- vllm/model_executor/layers/quantization/compressed_tensors/schemes/__init__.py +24 -0
- vllm/model_executor/layers/quantization/compressed_tensors/schemes/compressed_tensors_24.py +358 -0
- vllm/model_executor/layers/quantization/compressed_tensors/schemes/compressed_tensors_scheme.py +55 -0
- vllm/model_executor/layers/quantization/compressed_tensors/schemes/compressed_tensors_w4a16_24.py +160 -0
- vllm/model_executor/layers/quantization/compressed_tensors/schemes/compressed_tensors_w4a16_nvfp4.py +93 -0
- vllm/model_executor/layers/quantization/compressed_tensors/schemes/compressed_tensors_w4a4_nvfp4.py +178 -0
- vllm/model_executor/layers/quantization/compressed_tensors/schemes/compressed_tensors_w8a16_fp8.py +121 -0
- vllm/model_executor/layers/quantization/compressed_tensors/schemes/compressed_tensors_w8a8_fp8.py +150 -0
- vllm/model_executor/layers/quantization/compressed_tensors/schemes/compressed_tensors_w8a8_int8.py +111 -0
- vllm/model_executor/layers/quantization/compressed_tensors/schemes/compressed_tensors_wNa16.py +201 -0
- vllm/model_executor/layers/quantization/compressed_tensors/triton_scaled_mm.py +206 -0
- vllm/model_executor/layers/quantization/compressed_tensors/utils.py +216 -0
- vllm/model_executor/layers/quantization/deepspeedfp.py +195 -0
- vllm/model_executor/layers/quantization/experts_int8.py +196 -0
- vllm/model_executor/layers/quantization/fbgemm_fp8.py +172 -0
- vllm/model_executor/layers/quantization/fp8.py +906 -0
- vllm/model_executor/layers/quantization/gguf.py +565 -0
- vllm/model_executor/layers/quantization/gptq.py +278 -0
- vllm/model_executor/layers/quantization/gptq_bitblas.py +445 -0
- vllm/model_executor/layers/quantization/gptq_marlin.py +648 -0
- vllm/model_executor/layers/quantization/gptq_marlin_24.py +297 -0
- vllm/model_executor/layers/quantization/hqq_marlin.py +332 -0
- vllm/model_executor/layers/quantization/ipex_quant.py +250 -0
- vllm/model_executor/layers/quantization/kernels/__init__.py +0 -0
- vllm/model_executor/layers/quantization/kernels/mixed_precision/MPLinearKernel.py +90 -0
- vllm/model_executor/layers/quantization/kernels/mixed_precision/__init__.py +83 -0
- vllm/model_executor/layers/quantization/kernels/mixed_precision/allspark.py +116 -0
- vllm/model_executor/layers/quantization/kernels/mixed_precision/bitblas.py +300 -0
- vllm/model_executor/layers/quantization/kernels/mixed_precision/exllama.py +143 -0
- vllm/model_executor/layers/quantization/kernels/mixed_precision/machete.py +120 -0
- vllm/model_executor/layers/quantization/kernels/mixed_precision/marlin.py +131 -0
- vllm/model_executor/layers/quantization/kernels/scaled_mm/ScaledMMLinearKernel.py +67 -0
- vllm/model_executor/layers/quantization/kernels/scaled_mm/__init__.py +87 -0
- vllm/model_executor/layers/quantization/kernels/scaled_mm/aiter.py +120 -0
- vllm/model_executor/layers/quantization/kernels/scaled_mm/cutlass.py +137 -0
- vllm/model_executor/layers/quantization/kernels/scaled_mm/triton.py +41 -0
- vllm/model_executor/layers/quantization/kernels/scaled_mm/xla.py +105 -0
- vllm/model_executor/layers/quantization/kv_cache.py +139 -0
- vllm/model_executor/layers/quantization/marlin.py +261 -0
- vllm/model_executor/layers/quantization/modelopt.py +737 -0
- vllm/model_executor/layers/quantization/moe_wna16.py +449 -0
- vllm/model_executor/layers/quantization/neuron_quant.py +76 -0
- vllm/model_executor/layers/quantization/ptpc_fp8.py +127 -0
- vllm/model_executor/layers/quantization/qqq.py +275 -0
- vllm/model_executor/layers/quantization/quark/__init__.py +0 -0
- vllm/model_executor/layers/quantization/quark/quark.py +441 -0
- vllm/model_executor/layers/quantization/quark/quark_moe.py +237 -0
- vllm/model_executor/layers/quantization/quark/schemes/__init__.py +9 -0
- vllm/model_executor/layers/quantization/quark/schemes/quark_scheme.py +55 -0
- vllm/model_executor/layers/quantization/quark/schemes/quark_w4a4_mxfp4.py +126 -0
- vllm/model_executor/layers/quantization/quark/schemes/quark_w8a8_fp8.py +146 -0
- vllm/model_executor/layers/quantization/quark/schemes/quark_w8a8_int8.py +122 -0
- vllm/model_executor/layers/quantization/quark/utils.py +105 -0
- vllm/model_executor/layers/quantization/schema.py +86 -0
- vllm/model_executor/layers/quantization/torchao.py +161 -0
- vllm/model_executor/layers/quantization/tpu_int8.py +121 -0
- vllm/model_executor/layers/quantization/utils/__init__.py +6 -0
- vllm/model_executor/layers/quantization/utils/allspark_utils.py +52 -0
- vllm/model_executor/layers/quantization/utils/bitblas_utils.py +208 -0
- vllm/model_executor/layers/quantization/utils/configs/N=1536,K=1536,device_name=AMD_Instinct_MI300X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=1536,K=1536,device_name=AMD_Instinct_MI325X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=1536,K=1536,device_name=AMD_Instinct_MI325_OAM,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=1536,K=1536,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=1536,K=1536,device_name=NVIDIA_A800-SXM4-80GB,dtype=int8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=1536,K=1536,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=1536,K=1536,device_name=NVIDIA_H20,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=1536,K=1536,device_name=NVIDIA_L20Y,dtype=fp8_w8a8,block_shape=[128,128].json +26 -0
- vllm/model_executor/layers/quantization/utils/configs/N=1536,K=7168,device_name=AMD_Instinct_MI300X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=1536,K=7168,device_name=AMD_Instinct_MI325X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=1536,K=7168,device_name=AMD_Instinct_MI325_OAM,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=1536,K=7168,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=1536,K=7168,device_name=NVIDIA_A800-SXM4-80GB,dtype=int8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=1536,K=7168,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=1536,K=7168,device_name=NVIDIA_H20,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=1536,K=7168,device_name=NVIDIA_H200,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=1536,K=7168,device_name=NVIDIA_L20,dtype=fp8_w8a8,block_shape=[128,128].json +26 -0
- vllm/model_executor/layers/quantization/utils/configs/N=1536,K=7168,device_name=NVIDIA_L20Y,dtype=fp8_w8a8,block_shape=[128,128].json +26 -0
- vllm/model_executor/layers/quantization/utils/configs/N=2048,K=512,device_name=AMD_Instinct_MI300X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=2048,K=512,device_name=AMD_Instinct_MI325X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=2048,K=512,device_name=AMD_Instinct_MI325_OAM,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=2048,K=512,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=2048,K=512,device_name=NVIDIA_A800-SXM4-80GB,dtype=int8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=2048,K=512,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=2048,K=512,device_name=NVIDIA_H20,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=2048,K=512,device_name=NVIDIA_H200,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=2048,K=512,device_name=NVIDIA_L20Y,dtype=fp8_w8a8,block_shape=[128,128].json +26 -0
- vllm/model_executor/layers/quantization/utils/configs/N=2304,K=7168,device_name=AMD_Instinct_MI300X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=2304,K=7168,device_name=AMD_Instinct_MI325X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=2304,K=7168,device_name=AMD_Instinct_MI325_OAM,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=2304,K=7168,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=2304,K=7168,device_name=NVIDIA_A800-SXM4-80GB,dtype=int8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=2304,K=7168,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=2304,K=7168,device_name=NVIDIA_H20,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=2304,K=7168,device_name=NVIDIA_H200,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=2304,K=7168,device_name=NVIDIA_L20Y,dtype=fp8_w8a8,block_shape=[128,128].json +26 -0
- vllm/model_executor/layers/quantization/utils/configs/N=24576,K=7168,device_name=AMD_Instinct_MI300X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=24576,K=7168,device_name=AMD_Instinct_MI325X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=24576,K=7168,device_name=AMD_Instinct_MI325_OAM,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=24576,K=7168,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=24576,K=7168,device_name=NVIDIA_A800-SXM4-80GB,dtype=int8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=24576,K=7168,device_name=NVIDIA_B200,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=24576,K=7168,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=24576,K=7168,device_name=NVIDIA_H20,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=24576,K=7168,device_name=NVIDIA_H20,dtype=int8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=24576,K=7168,device_name=NVIDIA_H200,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=24576,K=7168,device_name=NVIDIA_L20,dtype=fp8_w8a8,block_shape=[128,128].json +26 -0
- vllm/model_executor/layers/quantization/utils/configs/N=24576,K=7168,device_name=NVIDIA_L20Y,dtype=fp8_w8a8,block_shape=[128,128].json +26 -0
- vllm/model_executor/layers/quantization/utils/configs/N=256,K=7168,device_name=AMD_Instinct_MI300X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=256,K=7168,device_name=AMD_Instinct_MI325X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=256,K=7168,device_name=AMD_Instinct_MI325_OAM,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=256,K=7168,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=256,K=7168,device_name=NVIDIA_A800-SXM4-80GB,dtype=int8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=256,K=7168,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=256,K=7168,device_name=NVIDIA_H20,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=256,K=7168,device_name=NVIDIA_L20Y,dtype=fp8_w8a8,block_shape=[128,128].json +26 -0
- vllm/model_executor/layers/quantization/utils/configs/N=3072,K=1536,device_name=AMD_Instinct_MI300X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=3072,K=1536,device_name=AMD_Instinct_MI325X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=3072,K=1536,device_name=AMD_Instinct_MI325_OAM,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=3072,K=1536,device_name=NVIDIA_B200,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=3072,K=1536,device_name=NVIDIA_H20,dtype=int8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=3072,K=1536,device_name=NVIDIA_H200,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=3072,K=1536,device_name=NVIDIA_L20,dtype=fp8_w8a8,block_shape=[128,128].json +26 -0
- vllm/model_executor/layers/quantization/utils/configs/N=3072,K=7168,device_name=AMD_Instinct_MI300X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=3072,K=7168,device_name=AMD_Instinct_MI325X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=3072,K=7168,device_name=AMD_Instinct_MI325_OAM,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=3072,K=7168,device_name=NVIDIA_B200,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=3072,K=7168,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=3072,K=7168,device_name=NVIDIA_H20,dtype=int8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=3072,K=7168,device_name=NVIDIA_H200,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=3072,K=7168,device_name=NVIDIA_L20,dtype=fp8_w8a8,block_shape=[128,128].json +26 -0
- vllm/model_executor/layers/quantization/utils/configs/N=32768,K=512,device_name=AMD_Instinct_MI300X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=32768,K=512,device_name=AMD_Instinct_MI325X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=32768,K=512,device_name=AMD_Instinct_MI325_OAM,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=32768,K=512,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=32768,K=512,device_name=NVIDIA_A800-SXM4-80GB,dtype=int8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=32768,K=512,device_name=NVIDIA_B200,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=32768,K=512,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=32768,K=512,device_name=NVIDIA_H20,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=32768,K=512,device_name=NVIDIA_H20,dtype=int8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=32768,K=512,device_name=NVIDIA_H200,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=32768,K=512,device_name=NVIDIA_L20,dtype=fp8_w8a8,block_shape=[128,128].json +26 -0
- vllm/model_executor/layers/quantization/utils/configs/N=32768,K=512,device_name=NVIDIA_L20Y,dtype=fp8_w8a8,block_shape=[128,128].json +26 -0
- vllm/model_executor/layers/quantization/utils/configs/N=36864,K=7168,device_name=AMD_Instinct_MI300X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=36864,K=7168,device_name=AMD_Instinct_MI325X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=36864,K=7168,device_name=AMD_Instinct_MI325_OAM,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=36864,K=7168,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=36864,K=7168,device_name=NVIDIA_H200,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=4096,K=512,device_name=AMD_Instinct_MI300X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=4096,K=512,device_name=AMD_Instinct_MI325X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=4096,K=512,device_name=AMD_Instinct_MI325_OAM,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=4096,K=512,device_name=NVIDIA_B200,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=4096,K=512,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=4096,K=512,device_name=NVIDIA_H20,dtype=int8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=4096,K=512,device_name=NVIDIA_H200,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=4096,K=512,device_name=NVIDIA_L20,dtype=fp8_w8a8,block_shape=[128,128].json +26 -0
- vllm/model_executor/layers/quantization/utils/configs/N=4608,K=7168,device_name=AMD_Instinct_MI300X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=4608,K=7168,device_name=AMD_Instinct_MI325X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=4608,K=7168,device_name=AMD_Instinct_MI325_OAM,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=4608,K=7168,device_name=NVIDIA_B200,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=4608,K=7168,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=4608,K=7168,device_name=NVIDIA_H20,dtype=int8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=4608,K=7168,device_name=NVIDIA_H200,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=4608,K=7168,device_name=NVIDIA_L20,dtype=fp8_w8a8,block_shape=[128,128].json +26 -0
- vllm/model_executor/layers/quantization/utils/configs/N=512,K=7168,device_name=AMD_Instinct_MI300X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=512,K=7168,device_name=AMD_Instinct_MI325X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=512,K=7168,device_name=AMD_Instinct_MI325_OAM,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=512,K=7168,device_name=NVIDIA_B200,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=512,K=7168,device_name=NVIDIA_H20,dtype=int8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=512,K=7168,device_name=NVIDIA_H200,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=512,K=7168,device_name=NVIDIA_L20,dtype=fp8_w8a8,block_shape=[128,128].json +26 -0
- vllm/model_executor/layers/quantization/utils/configs/N=576,K=7168,device_name=AMD_Instinct_MI300X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=576,K=7168,device_name=AMD_Instinct_MI325X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=576,K=7168,device_name=AMD_Instinct_MI325_OAM,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=576,K=7168,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=576,K=7168,device_name=NVIDIA_A800-SXM4-80GB,dtype=int8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=576,K=7168,device_name=NVIDIA_B200,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=576,K=7168,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=576,K=7168,device_name=NVIDIA_H20,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=576,K=7168,device_name=NVIDIA_H20,dtype=int8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=576,K=7168,device_name=NVIDIA_H200,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=576,K=7168,device_name=NVIDIA_L20,dtype=fp8_w8a8,block_shape=[128,128].json +18 -0
- vllm/model_executor/layers/quantization/utils/configs/N=576,K=7168,device_name=NVIDIA_L20Y,dtype=fp8_w8a8,block_shape=[128,128].json +26 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=1024,device_name=AMD_Instinct_MI300X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=1024,device_name=AMD_Instinct_MI325X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=1024,device_name=AMD_Instinct_MI325_OAM,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=1024,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=1024,device_name=NVIDIA_A800-SXM4-80GB,dtype=int8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=1024,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=1024,device_name=NVIDIA_H20,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=1024,device_name=NVIDIA_H200,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=1024,device_name=NVIDIA_L20Y,dtype=fp8_w8a8,block_shape=[128,128].json +26 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=1152,device_name=AMD_Instinct_MI300X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=1152,device_name=AMD_Instinct_MI325X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=1152,device_name=AMD_Instinct_MI325_OAM,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=1152,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=1152,device_name=NVIDIA_A800-SXM4-80GB,dtype=int8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=1152,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=1152,device_name=NVIDIA_H20,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=1152,device_name=NVIDIA_H200,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=1152,device_name=NVIDIA_L20Y,dtype=fp8_w8a8,block_shape=[128,128].json +26 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=128,device_name=AMD_Instinct_MI300X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=128,device_name=AMD_Instinct_MI325X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=128,device_name=AMD_Instinct_MI325_OAM,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=128,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=128,device_name=NVIDIA_A800-SXM4-80GB,dtype=int8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=128,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=128,device_name=NVIDIA_H20,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=128,device_name=NVIDIA_L20Y,dtype=fp8_w8a8,block_shape=[128,128].json +26 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=16384,device_name=AMD_Instinct_MI300X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=16384,device_name=AMD_Instinct_MI325X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=16384,device_name=AMD_Instinct_MI325_OAM,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=16384,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=16384,device_name=NVIDIA_A800-SXM4-80GB,dtype=int8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=16384,device_name=NVIDIA_B200,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=16384,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=16384,device_name=NVIDIA_H20,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=16384,device_name=NVIDIA_H20,dtype=int8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=16384,device_name=NVIDIA_H200,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=16384,device_name=NVIDIA_L20,dtype=fp8_w8a8,block_shape=[128,128].json +26 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=16384,device_name=NVIDIA_L20Y,dtype=fp8_w8a8,block_shape=[128,128].json +26 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=18432,device_name=AMD_Instinct_MI300X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=18432,device_name=AMD_Instinct_MI325X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=18432,device_name=AMD_Instinct_MI325_OAM,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=18432,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=18432,device_name=NVIDIA_A800-SXM4-80GB,dtype=int8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=18432,device_name=NVIDIA_B200,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=18432,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=18432,device_name=NVIDIA_H20,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=18432,device_name=NVIDIA_H20,dtype=int8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=18432,device_name=NVIDIA_H200,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=18432,device_name=NVIDIA_L20,dtype=fp8_w8a8,block_shape=[128,128].json +26 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=18432,device_name=NVIDIA_L20Y,dtype=fp8_w8a8,block_shape=[128,128].json +26 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=2048,device_name=AMD_Instinct_MI300X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=2048,device_name=AMD_Instinct_MI325X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=2048,device_name=AMD_Instinct_MI325_OAM,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=2048,device_name=NVIDIA_B200,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=2048,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=2048,device_name=NVIDIA_H20,dtype=int8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=2048,device_name=NVIDIA_H200,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=2048,device_name=NVIDIA_L20,dtype=fp8_w8a8,block_shape=[128,128].json +26 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=2304,device_name=AMD_Instinct_MI300X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=2304,device_name=AMD_Instinct_MI325X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=2304,device_name=AMD_Instinct_MI325_OAM,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=2304,device_name=NVIDIA_B200,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=2304,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=2304,device_name=NVIDIA_H20,dtype=int8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=2304,device_name=NVIDIA_H200,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=2304,device_name=NVIDIA_L20,dtype=fp8_w8a8,block_shape=[128,128].json +26 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=256,device_name=AMD_Instinct_MI300X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=256,device_name=AMD_Instinct_MI325X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=256,device_name=AMD_Instinct_MI325_OAM,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=256,device_name=NVIDIA_B200,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=256,device_name=NVIDIA_H20,dtype=int8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=256,device_name=NVIDIA_H200,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=256,device_name=NVIDIA_L20,dtype=fp8_w8a8,block_shape=[128,128].json +26 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=8192,device_name=AMD_Instinct_MI300X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=8192,device_name=AMD_Instinct_MI325X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=8192,device_name=AMD_Instinct_MI325_OAM,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=8192,K=1536,device_name=AMD_Instinct_MI300X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=8192,K=1536,device_name=AMD_Instinct_MI325X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=8192,K=1536,device_name=AMD_Instinct_MI325_OAM,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/fp8_utils.py +618 -0
- vllm/model_executor/layers/quantization/utils/gptq_utils.py +95 -0
- vllm/model_executor/layers/quantization/utils/int8_utils.py +485 -0
- vllm/model_executor/layers/quantization/utils/layer_utils.py +40 -0
- vllm/model_executor/layers/quantization/utils/machete_utils.py +33 -0
- vllm/model_executor/layers/quantization/utils/marlin_utils.py +476 -0
- vllm/model_executor/layers/quantization/utils/marlin_utils_fp4.py +283 -0
- vllm/model_executor/layers/quantization/utils/marlin_utils_fp8.py +325 -0
- vllm/model_executor/layers/quantization/utils/marlin_utils_test.py +165 -0
- vllm/model_executor/layers/quantization/utils/marlin_utils_test_24.py +464 -0
- vllm/model_executor/layers/quantization/utils/marlin_utils_test_qqq.py +126 -0
- vllm/model_executor/layers/quantization/utils/mxfp4_utils.py +45 -0
- vllm/model_executor/layers/quantization/utils/nvfp4_emulation_utils.py +104 -0
- vllm/model_executor/layers/quantization/utils/quant_utils.py +573 -0
- vllm/model_executor/layers/quantization/utils/w8a8_utils.py +405 -0
- vllm/model_executor/layers/rejection_sampler.py +406 -0
- vllm/model_executor/layers/resampler.py +270 -0
- vllm/model_executor/layers/rotary_embedding.py +1862 -0
- vllm/model_executor/layers/sampler.py +1204 -0
- vllm/model_executor/layers/spec_decode_base_sampler.py +259 -0
- vllm/model_executor/layers/typical_acceptance_sampler.py +166 -0
- vllm/model_executor/layers/utils.py +95 -0
- vllm/model_executor/layers/vocab_parallel_embedding.py +487 -0
- vllm/model_executor/model_loader/__init__.py +76 -0
- vllm/model_executor/model_loader/base_loader.py +43 -0
- vllm/model_executor/model_loader/bitsandbytes_loader.py +570 -0
- vllm/model_executor/model_loader/default_loader.py +282 -0
- vllm/model_executor/model_loader/dummy_loader.py +27 -0
- vllm/model_executor/model_loader/gguf_loader.py +120 -0
- vllm/model_executor/model_loader/neuron.py +476 -0
- vllm/model_executor/model_loader/neuronx_distributed.py +685 -0
- vllm/model_executor/model_loader/runai_streamer_loader.py +109 -0
- vllm/model_executor/model_loader/sharded_state_loader.py +201 -0
- vllm/model_executor/model_loader/tensorizer.py +600 -0
- vllm/model_executor/model_loader/tensorizer_loader.py +123 -0
- vllm/model_executor/model_loader/tpu.py +112 -0
- vllm/model_executor/model_loader/utils.py +302 -0
- vllm/model_executor/model_loader/weight_utils.py +782 -0
- vllm/model_executor/models/__init__.py +28 -0
- vllm/model_executor/models/adapters.py +248 -0
- vllm/model_executor/models/aimv2.py +246 -0
- vllm/model_executor/models/arctic.py +559 -0
- vllm/model_executor/models/aria.py +657 -0
- vllm/model_executor/models/aya_vision.py +466 -0
- vllm/model_executor/models/baichuan.py +474 -0
- vllm/model_executor/models/bamba.py +543 -0
- vllm/model_executor/models/bart.py +938 -0
- vllm/model_executor/models/bert.py +523 -0
- vllm/model_executor/models/bert_with_rope.py +769 -0
- vllm/model_executor/models/blip.py +339 -0
- vllm/model_executor/models/blip2.py +718 -0
- vllm/model_executor/models/bloom.py +373 -0
- vllm/model_executor/models/chameleon.py +1136 -0
- vllm/model_executor/models/chatglm.py +478 -0
- vllm/model_executor/models/clip.py +407 -0
- vllm/model_executor/models/commandr.py +472 -0
- vllm/model_executor/models/constant_size_cache.py +137 -0
- vllm/model_executor/models/dbrx.py +472 -0
- vllm/model_executor/models/deepseek.py +486 -0
- vllm/model_executor/models/deepseek_mtp.py +269 -0
- vllm/model_executor/models/deepseek_v2.py +843 -0
- vllm/model_executor/models/deepseek_vl2.py +648 -0
- vllm/model_executor/models/eagle.py +260 -0
- vllm/model_executor/models/exaone.py +551 -0
- vllm/model_executor/models/fairseq2_llama.py +154 -0
- vllm/model_executor/models/falcon.py +510 -0
- vllm/model_executor/models/falcon_h1.py +685 -0
- vllm/model_executor/models/florence2.py +1103 -0
- vllm/model_executor/models/fuyu.py +389 -0
- vllm/model_executor/models/gemma.py +425 -0
- vllm/model_executor/models/gemma2.py +425 -0
- vllm/model_executor/models/gemma3.py +533 -0
- vllm/model_executor/models/gemma3_mm.py +709 -0
- vllm/model_executor/models/glm.py +23 -0
- vllm/model_executor/models/glm4.py +305 -0
- vllm/model_executor/models/glm4v.py +648 -0
- vllm/model_executor/models/gpt2.py +328 -0
- vllm/model_executor/models/gpt_bigcode.py +335 -0
- vllm/model_executor/models/gpt_j.py +339 -0
- vllm/model_executor/models/gpt_neox.py +332 -0
- vllm/model_executor/models/granite.py +493 -0
- vllm/model_executor/models/granite_speech.py +779 -0
- vllm/model_executor/models/granitemoe.py +437 -0
- vllm/model_executor/models/granitemoehybrid.py +586 -0
- vllm/model_executor/models/granitemoeshared.py +341 -0
- vllm/model_executor/models/gritlm.py +224 -0
- vllm/model_executor/models/grok1.py +546 -0
- vllm/model_executor/models/h2ovl.py +546 -0
- vllm/model_executor/models/idefics2_vision_model.py +389 -0
- vllm/model_executor/models/idefics3.py +776 -0
- vllm/model_executor/models/interfaces.py +572 -0
- vllm/model_executor/models/interfaces_base.py +164 -0
- vllm/model_executor/models/intern_vit.py +480 -0
- vllm/model_executor/models/internlm2.py +455 -0
- vllm/model_executor/models/internlm2_ve.py +147 -0
- vllm/model_executor/models/internvl.py +1418 -0
- vllm/model_executor/models/jais.py +373 -0
- vllm/model_executor/models/jamba.py +592 -0
- vllm/model_executor/models/kimi_vl.py +577 -0
- vllm/model_executor/models/llama.py +644 -0
- vllm/model_executor/models/llama4.py +532 -0
- vllm/model_executor/models/llama_eagle.py +165 -0
- vllm/model_executor/models/llama_eagle3.py +263 -0
- vllm/model_executor/models/llava.py +866 -0
- vllm/model_executor/models/llava_next.py +586 -0
- vllm/model_executor/models/llava_next_video.py +471 -0
- vllm/model_executor/models/llava_onevision.py +956 -0
- vllm/model_executor/models/mamba.py +273 -0
- vllm/model_executor/models/mamba2.py +308 -0
- vllm/model_executor/models/mamba_cache.py +76 -0
- vllm/model_executor/models/medusa.py +219 -0
- vllm/model_executor/models/mimo.py +192 -0
- vllm/model_executor/models/mimo_mtp.py +285 -0
- vllm/model_executor/models/minicpm.py +592 -0
- vllm/model_executor/models/minicpm3.py +230 -0
- vllm/model_executor/models/minicpm_eagle.py +391 -0
- vllm/model_executor/models/minicpmo.py +759 -0
- vllm/model_executor/models/minicpmv.py +1287 -0
- vllm/model_executor/models/minimax_cache.py +36 -0
- vllm/model_executor/models/minimax_text_01.py +1301 -0
- vllm/model_executor/models/minimax_vl_01.py +364 -0
- vllm/model_executor/models/mistral3.py +604 -0
- vllm/model_executor/models/mixtral.py +488 -0
- vllm/model_executor/models/mixtral_quant.py +453 -0
- vllm/model_executor/models/mllama.py +1624 -0
- vllm/model_executor/models/mllama4.py +938 -0
- vllm/model_executor/models/mlp_speculator.py +206 -0
- vllm/model_executor/models/modernbert.py +331 -0
- vllm/model_executor/models/module_mapping.py +72 -0
- vllm/model_executor/models/molmo.py +1568 -0
- vllm/model_executor/models/moonvit.py +630 -0
- vllm/model_executor/models/mpt.py +331 -0
- vllm/model_executor/models/nemotron.py +508 -0
- vllm/model_executor/models/nemotron_h.py +573 -0
- vllm/model_executor/models/nemotron_nas.py +484 -0
- vllm/model_executor/models/nvlm_d.py +216 -0
- vllm/model_executor/models/olmo.py +389 -0
- vllm/model_executor/models/olmo2.py +414 -0
- vllm/model_executor/models/olmoe.py +468 -0
- vllm/model_executor/models/opt.py +412 -0
- vllm/model_executor/models/orion.py +349 -0
- vllm/model_executor/models/ovis.py +567 -0
- vllm/model_executor/models/paligemma.py +398 -0
- vllm/model_executor/models/persimmon.py +344 -0
- vllm/model_executor/models/phi.py +356 -0
- vllm/model_executor/models/phi3.py +19 -0
- vllm/model_executor/models/phi3_small.py +465 -0
- vllm/model_executor/models/phi3v.py +723 -0
- vllm/model_executor/models/phi4mm.py +1246 -0
- vllm/model_executor/models/phi4mm_audio.py +1233 -0
- vllm/model_executor/models/phi4mm_utils.py +1884 -0
- vllm/model_executor/models/phimoe.py +665 -0
- vllm/model_executor/models/pixtral.py +1316 -0
- vllm/model_executor/models/plamo2.py +738 -0
- vllm/model_executor/models/prithvi_geospatial_mae.py +232 -0
- vllm/model_executor/models/qwen.py +362 -0
- vllm/model_executor/models/qwen2.py +497 -0
- vllm/model_executor/models/qwen2_5_omni_thinker.py +904 -0
- vllm/model_executor/models/qwen2_5_vl.py +1166 -0
- vllm/model_executor/models/qwen2_audio.py +410 -0
- vllm/model_executor/models/qwen2_moe.py +540 -0
- vllm/model_executor/models/qwen2_rm.py +132 -0
- vllm/model_executor/models/qwen2_vl.py +1405 -0
- vllm/model_executor/models/qwen3.py +321 -0
- vllm/model_executor/models/qwen3_moe.py +535 -0
- vllm/model_executor/models/qwen_vl.py +785 -0
- vllm/model_executor/models/registry.py +622 -0
- vllm/model_executor/models/roberta.py +276 -0
- vllm/model_executor/models/siglip.py +524 -0
- vllm/model_executor/models/skyworkr1v.py +951 -0
- vllm/model_executor/models/smolvlm.py +52 -0
- vllm/model_executor/models/solar.py +506 -0
- vllm/model_executor/models/stablelm.py +343 -0
- vllm/model_executor/models/starcoder2.py +356 -0
- vllm/model_executor/models/tarsier.py +643 -0
- vllm/model_executor/models/telechat2.py +140 -0
- vllm/model_executor/models/teleflm.py +79 -0
- vllm/model_executor/models/transformers.py +508 -0
- vllm/model_executor/models/ultravox.py +656 -0
- vllm/model_executor/models/utils.py +731 -0
- vllm/model_executor/models/vision.py +147 -0
- vllm/model_executor/models/whisper.py +747 -0
- vllm/model_executor/models/zamba2.py +1009 -0
- vllm/model_executor/parameter.py +459 -0
- vllm/model_executor/pooling_metadata.py +72 -0
- vllm/model_executor/sampling_metadata.py +597 -0
- vllm/model_executor/utils.py +77 -0
- vllm/multimodal/__init__.py +33 -0
- vllm/multimodal/audio.py +106 -0
- vllm/multimodal/base.py +219 -0
- vllm/multimodal/hasher.py +118 -0
- vllm/multimodal/image.py +97 -0
- vllm/multimodal/inputs.py +876 -0
- vllm/multimodal/parse.py +461 -0
- vllm/multimodal/processing.py +1895 -0
- vllm/multimodal/profiling.py +258 -0
- vllm/multimodal/registry.py +331 -0
- vllm/multimodal/utils.py +436 -0
- vllm/multimodal/video.py +198 -0
- vllm/outputs.py +512 -0
- vllm/platforms/__init__.py +291 -0
- vllm/platforms/cpu.py +266 -0
- vllm/platforms/cuda.py +526 -0
- vllm/platforms/hpu.py +106 -0
- vllm/platforms/interface.py +538 -0
- vllm/platforms/neuron.py +150 -0
- vllm/platforms/rocm.py +435 -0
- vllm/platforms/tpu.py +216 -0
- vllm/platforms/xpu.py +156 -0
- vllm/plugins/__init__.py +94 -0
- vllm/plugins/lora_resolvers/README.md +15 -0
- vllm/plugins/lora_resolvers/__init__.py +0 -0
- vllm/plugins/lora_resolvers/filesystem_resolver.py +50 -0
- vllm/pooling_params.py +54 -0
- vllm/profiler/__init__.py +0 -0
- vllm/profiler/layerwise_profile.py +375 -0
- vllm/profiler/utils.py +148 -0
- vllm/prompt_adapter/__init__.py +0 -0
- vllm/prompt_adapter/layers.py +83 -0
- vllm/prompt_adapter/models.py +358 -0
- vllm/prompt_adapter/request.py +37 -0
- vllm/prompt_adapter/utils.py +98 -0
- vllm/prompt_adapter/worker_manager.py +179 -0
- vllm/py.typed +2 -0
- vllm/reasoning/__init__.py +15 -0
- vllm/reasoning/abs_reasoning_parsers.py +192 -0
- vllm/reasoning/deepseek_r1_reasoning_parser.py +173 -0
- vllm/reasoning/granite_reasoning_parser.py +363 -0
- vllm/reasoning/qwen3_reasoning_parser.py +151 -0
- vllm/sampling_params.py +602 -0
- vllm/scalar_type.py +347 -0
- vllm/scripts.py +15 -0
- vllm/sequence.py +1568 -0
- vllm/spec_decode/__init__.py +0 -0
- vllm/spec_decode/batch_expansion.py +506 -0
- vllm/spec_decode/draft_model_runner.py +349 -0
- vllm/spec_decode/interfaces.py +99 -0
- vllm/spec_decode/medusa_worker.py +138 -0
- vllm/spec_decode/metrics.py +213 -0
- vllm/spec_decode/mlp_speculator_worker.py +94 -0
- vllm/spec_decode/mqa_scorer.py +160 -0
- vllm/spec_decode/multi_step_worker.py +423 -0
- vllm/spec_decode/ngram_worker.py +196 -0
- vllm/spec_decode/proposer_worker_base.py +59 -0
- vllm/spec_decode/smaller_tp_proposer_worker.py +196 -0
- vllm/spec_decode/spec_decode_worker.py +1326 -0
- vllm/spec_decode/target_model_runner.py +45 -0
- vllm/spec_decode/top1_proposer.py +275 -0
- vllm/spec_decode/util.py +277 -0
- vllm/test_utils.py +130 -0
- vllm/third_party/__init__.py +0 -0
- vllm/third_party/pynvml.py +6140 -0
- vllm/tracing.py +131 -0
- vllm/transformers_utils/__init__.py +24 -0
- vllm/transformers_utils/chat_templates/__init__.py +5 -0
- vllm/transformers_utils/chat_templates/registry.py +60 -0
- vllm/transformers_utils/chat_templates/template_basic.jinja +3 -0
- vllm/transformers_utils/chat_templates/template_blip2.jinja +11 -0
- vllm/transformers_utils/chat_templates/template_chatml.jinja +10 -0
- vllm/transformers_utils/chat_templates/template_deepseek_vl2.jinja +23 -0
- vllm/transformers_utils/chat_templates/template_fuyu.jinja +3 -0
- vllm/transformers_utils/config.py +887 -0
- vllm/transformers_utils/configs/__init__.py +61 -0
- vllm/transformers_utils/configs/arctic.py +207 -0
- vllm/transformers_utils/configs/chatglm.py +72 -0
- vllm/transformers_utils/configs/cohere2.py +195 -0
- vllm/transformers_utils/configs/dbrx.py +280 -0
- vllm/transformers_utils/configs/deepseek_vl2.py +216 -0
- vllm/transformers_utils/configs/eagle.py +85 -0
- vllm/transformers_utils/configs/exaone.py +190 -0
- vllm/transformers_utils/configs/falcon.py +90 -0
- vllm/transformers_utils/configs/h2ovl.py +16 -0
- vllm/transformers_utils/configs/internvl.py +54 -0
- vllm/transformers_utils/configs/jais.py +238 -0
- vllm/transformers_utils/configs/kimi_vl.py +37 -0
- vllm/transformers_utils/configs/medusa.py +63 -0
- vllm/transformers_utils/configs/minimax_text_01.py +70 -0
- vllm/transformers_utils/configs/minimax_vl_01.py +71 -0
- vllm/transformers_utils/configs/mllama.py +31 -0
- vllm/transformers_utils/configs/mlp_speculator.py +68 -0
- vllm/transformers_utils/configs/moonvit.py +33 -0
- vllm/transformers_utils/configs/mpt.py +180 -0
- vllm/transformers_utils/configs/nemotron.py +205 -0
- vllm/transformers_utils/configs/nemotron_h.py +258 -0
- vllm/transformers_utils/configs/nvlm_d.py +15 -0
- vllm/transformers_utils/configs/ovis.py +184 -0
- vllm/transformers_utils/configs/skyworkr1v.py +54 -0
- vllm/transformers_utils/configs/solar.py +247 -0
- vllm/transformers_utils/configs/telechat2.py +64 -0
- vllm/transformers_utils/configs/ultravox.py +108 -0
- vllm/transformers_utils/detokenizer.py +168 -0
- vllm/transformers_utils/detokenizer_utils.py +189 -0
- vllm/transformers_utils/processor.py +221 -0
- vllm/transformers_utils/processors/__init__.py +8 -0
- vllm/transformers_utils/processors/deepseek_vl2.py +363 -0
- vllm/transformers_utils/processors/ovis.py +420 -0
- vllm/transformers_utils/s3_utils.py +162 -0
- vllm/transformers_utils/tokenizer.py +302 -0
- vllm/transformers_utils/tokenizer_base.py +149 -0
- vllm/transformers_utils/tokenizer_group.py +120 -0
- vllm/transformers_utils/tokenizers/__init__.py +10 -0
- vllm/transformers_utils/tokenizers/mistral.py +493 -0
- vllm/transformers_utils/utils.py +99 -0
- vllm/triton_utils/__init__.py +14 -0
- vllm/triton_utils/importing.py +50 -0
- vllm/usage/__init__.py +0 -0
- vllm/usage/usage_lib.py +256 -0
- vllm/utils.py +2910 -0
- vllm/v1/__init__.py +0 -0
- vllm/v1/attention/__init__.py +0 -0
- vllm/v1/attention/backends/__init__.py +0 -0
- vllm/v1/attention/backends/cpu_attn.py +163 -0
- vllm/v1/attention/backends/flash_attn.py +869 -0
- vllm/v1/attention/backends/flashinfer.py +651 -0
- vllm/v1/attention/backends/flex_attention.py +477 -0
- vllm/v1/attention/backends/mla/__init__.py +0 -0
- vllm/v1/attention/backends/mla/common.py +931 -0
- vllm/v1/attention/backends/mla/cutlass_mla.py +97 -0
- vllm/v1/attention/backends/mla/flashmla.py +152 -0
- vllm/v1/attention/backends/mla/rocm_aiter_mla.py +220 -0
- vllm/v1/attention/backends/mla/triton_mla.py +120 -0
- vllm/v1/attention/backends/pallas.py +240 -0
- vllm/v1/attention/backends/triton_attn.py +285 -0
- vllm/v1/attention/backends/utils.py +52 -0
- vllm/v1/core/__init__.py +0 -0
- vllm/v1/core/block_pool.py +349 -0
- vllm/v1/core/encoder_cache_manager.py +150 -0
- vllm/v1/core/kv_cache_coordinator.py +363 -0
- vllm/v1/core/kv_cache_manager.py +392 -0
- vllm/v1/core/kv_cache_utils.py +996 -0
- vllm/v1/core/sched/__init__.py +0 -0
- vllm/v1/core/sched/interface.py +150 -0
- vllm/v1/core/sched/output.py +154 -0
- vllm/v1/core/sched/scheduler.py +1044 -0
- vllm/v1/core/sched/utils.py +23 -0
- vllm/v1/core/single_type_kv_cache_manager.py +403 -0
- vllm/v1/engine/__init__.py +173 -0
- vllm/v1/engine/async_llm.py +558 -0
- vllm/v1/engine/coordinator.py +253 -0
- vllm/v1/engine/core.py +961 -0
- vllm/v1/engine/core_client.py +1129 -0
- vllm/v1/engine/detokenizer.py +261 -0
- vllm/v1/engine/exceptions.py +17 -0
- vllm/v1/engine/llm_engine.py +317 -0
- vllm/v1/engine/logprobs.py +199 -0
- vllm/v1/engine/mm_input_cache.py +91 -0
- vllm/v1/engine/output_processor.py +428 -0
- vllm/v1/engine/parallel_sampling.py +133 -0
- vllm/v1/engine/processor.py +407 -0
- vllm/v1/executor/__init__.py +0 -0
- vllm/v1/executor/abstract.py +113 -0
- vllm/v1/executor/multiproc_executor.py +537 -0
- vllm/v1/executor/ray_distributed_executor.py +62 -0
- vllm/v1/kv_cache_interface.py +194 -0
- vllm/v1/metrics/__init__.py +0 -0
- vllm/v1/metrics/loggers.py +523 -0
- vllm/v1/metrics/prometheus.py +82 -0
- vllm/v1/metrics/ray_wrappers.py +131 -0
- vllm/v1/metrics/reader.py +246 -0
- vllm/v1/metrics/stats.py +239 -0
- vllm/v1/outputs.py +116 -0
- vllm/v1/request.py +193 -0
- vllm/v1/sample/__init__.py +0 -0
- vllm/v1/sample/metadata.py +44 -0
- vllm/v1/sample/ops/__init__.py +0 -0
- vllm/v1/sample/ops/bad_words.py +39 -0
- vllm/v1/sample/ops/penalties.py +59 -0
- vllm/v1/sample/ops/topk_topp_sampler.py +293 -0
- vllm/v1/sample/rejection_sampler.py +631 -0
- vllm/v1/sample/sampler.py +286 -0
- vllm/v1/sample/tpu/__init__.py +0 -0
- vllm/v1/sample/tpu/metadata.py +124 -0
- vllm/v1/sample/tpu/sampler.py +145 -0
- vllm/v1/serial_utils.py +315 -0
- vllm/v1/spec_decode/__init__.py +0 -0
- vllm/v1/spec_decode/eagle.py +432 -0
- vllm/v1/spec_decode/medusa.py +62 -0
- vllm/v1/spec_decode/metadata.py +62 -0
- vllm/v1/spec_decode/metrics.py +178 -0
- vllm/v1/spec_decode/ngram_proposer.py +132 -0
- vllm/v1/spec_decode/utils.py +46 -0
- vllm/v1/structured_output/__init__.py +222 -0
- vllm/v1/structured_output/backend_guidance.py +245 -0
- vllm/v1/structured_output/backend_types.py +134 -0
- vllm/v1/structured_output/backend_xgrammar.py +318 -0
- vllm/v1/structured_output/request.py +86 -0
- vllm/v1/structured_output/utils.py +175 -0
- vllm/v1/utils.py +743 -0
- vllm/v1/worker/__init__.py +0 -0
- vllm/v1/worker/block_table.py +142 -0
- vllm/v1/worker/cpu_model_runner.py +86 -0
- vllm/v1/worker/cpu_worker.py +152 -0
- vllm/v1/worker/gpu_input_batch.py +681 -0
- vllm/v1/worker/gpu_model_runner.py +2320 -0
- vllm/v1/worker/gpu_worker.py +393 -0
- vllm/v1/worker/lora_model_runner_mixin.py +173 -0
- vllm/v1/worker/tpu_model_runner.py +1673 -0
- vllm/v1/worker/tpu_worker.py +299 -0
- vllm/v1/worker/utils.py +111 -0
- vllm/v1/worker/worker_base.py +65 -0
- vllm/version.py +41 -0
- vllm/vllm_flash_attn/.gitkeep +0 -0
- vllm/worker/__init__.py +0 -0
- vllm/worker/cache_engine.py +145 -0
- vllm/worker/cpu_enc_dec_model_runner.py +326 -0
- vllm/worker/cpu_model_runner.py +671 -0
- vllm/worker/cpu_pooling_model_runner.py +125 -0
- vllm/worker/cpu_worker.py +450 -0
- vllm/worker/enc_dec_model_runner.py +555 -0
- vllm/worker/hpu_model_runner.py +2320 -0
- vllm/worker/hpu_worker.py +484 -0
- vllm/worker/model_runner.py +2178 -0
- vllm/worker/model_runner_base.py +282 -0
- vllm/worker/multi_step_hpu_worker.py +123 -0
- vllm/worker/multi_step_model_runner.py +911 -0
- vllm/worker/multi_step_neuron_model_runner.py +84 -0
- vllm/worker/multi_step_neuronx_distributed_model_runner.py +63 -0
- vllm/worker/multi_step_tpu_worker.py +108 -0
- vllm/worker/multi_step_worker.py +197 -0
- vllm/worker/neuron_model_runner.py +460 -0
- vllm/worker/neuron_worker.py +193 -0
- vllm/worker/neuronx_distributed_model_runner.py +294 -0
- vllm/worker/pooling_model_runner.py +211 -0
- vllm/worker/tpu_model_runner.py +909 -0
- vllm/worker/tpu_worker.py +337 -0
- vllm/worker/utils.py +53 -0
- vllm/worker/worker.py +577 -0
- vllm/worker/worker_base.py +646 -0
- vllm/worker/xpu_model_runner.py +606 -0
- vllm/worker/xpu_worker.py +186 -0
- vllm_cpu_amxbf16-0.9.1.dist-info/METADATA +305 -0
- vllm_cpu_amxbf16-0.9.1.dist-info/RECORD +1197 -0
- vllm_cpu_amxbf16-0.9.1.dist-info/WHEEL +5 -0
- vllm_cpu_amxbf16-0.9.1.dist-info/entry_points.txt +5 -0
- vllm_cpu_amxbf16-0.9.1.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,1166 @@
|
|
|
1
|
+
# SPDX-License-Identifier: Apache-2.0
|
|
2
|
+
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
|
|
3
|
+
|
|
4
|
+
# Adapted from
|
|
5
|
+
# https://github.com/huggingface/transformers/blob/main/src/transformers/models/qwen2_5_vl/modeling_qwen2_5_vl.py
|
|
6
|
+
# Copyright 2025 The vLLM team.
|
|
7
|
+
# Copyright 2025 The Qwen Team.
|
|
8
|
+
# Copyright 2025 The HuggingFace Inc. team.
|
|
9
|
+
# All rights reserved.
|
|
10
|
+
#
|
|
11
|
+
# This code is based on EleutherAI's GPT-NeoX library and the GPT-NeoX
|
|
12
|
+
# and OPT implementations in this library. It has been modified from its
|
|
13
|
+
# original forms to accommodate minor architectural differences compared
|
|
14
|
+
# to GPT-NeoX and OPT used by the Meta AI team that trained the model.
|
|
15
|
+
#
|
|
16
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
17
|
+
# you may not use this file except in compliance with the License.
|
|
18
|
+
# You may obtain a copy of the License at
|
|
19
|
+
#
|
|
20
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
21
|
+
#
|
|
22
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
23
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
24
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
25
|
+
# See the License for the specific language governing permissions and
|
|
26
|
+
# limitations under the License.
|
|
27
|
+
"""Inference-only Qwen2.5-VL model compatible with HuggingFace weights."""
|
|
28
|
+
from collections.abc import Iterable, Mapping
|
|
29
|
+
from functools import lru_cache, partial
|
|
30
|
+
from typing import Callable, Literal, Optional, TypedDict, Union
|
|
31
|
+
|
|
32
|
+
import torch
|
|
33
|
+
import torch.nn as nn
|
|
34
|
+
import torch.nn.functional as F
|
|
35
|
+
from einops import rearrange
|
|
36
|
+
from transformers import BatchFeature
|
|
37
|
+
from transformers.models.qwen2_5_vl import Qwen2_5_VLProcessor
|
|
38
|
+
from transformers.models.qwen2_5_vl.configuration_qwen2_5_vl import (
|
|
39
|
+
Qwen2_5_VLConfig, Qwen2_5_VLVisionConfig)
|
|
40
|
+
|
|
41
|
+
from vllm.config import VllmConfig
|
|
42
|
+
from vllm.distributed import parallel_state
|
|
43
|
+
from vllm.distributed import utils as dist_utils
|
|
44
|
+
from vllm.logger import init_logger
|
|
45
|
+
from vllm.model_executor import SamplingMetadata
|
|
46
|
+
from vllm.model_executor.layers.activation import _ACTIVATION_REGISTRY
|
|
47
|
+
from vllm.model_executor.layers.layernorm import RMSNorm
|
|
48
|
+
from vllm.model_executor.layers.linear import (ColumnParallelLinear,
|
|
49
|
+
QKVParallelLinear,
|
|
50
|
+
RowParallelLinear)
|
|
51
|
+
from vllm.model_executor.layers.quantization import QuantizationConfig
|
|
52
|
+
from vllm.model_executor.layers.quantization.gptq import GPTQConfig
|
|
53
|
+
from vllm.model_executor.layers.quantization.gptq_marlin import (
|
|
54
|
+
GPTQMarlinConfig)
|
|
55
|
+
from vllm.model_executor.model_loader.weight_utils import default_weight_loader
|
|
56
|
+
from vllm.model_executor.models.module_mapping import MultiModelKeys
|
|
57
|
+
from vllm.multimodal import MULTIMODAL_REGISTRY
|
|
58
|
+
from vllm.multimodal.inputs import MultiModalFieldConfig
|
|
59
|
+
from vllm.platforms import _Backend
|
|
60
|
+
from vllm.sequence import IntermediateTensors
|
|
61
|
+
from vllm.transformers_utils.config import uses_mrope
|
|
62
|
+
|
|
63
|
+
from .interfaces import (MultiModalEmbeddings, SupportsLoRA,
|
|
64
|
+
SupportsMultiModal, SupportsPP)
|
|
65
|
+
from .qwen2_vl import Qwen2VLDummyInputsBuilder as Qwen2_5_VLDummyInputsBuilder
|
|
66
|
+
from .qwen2_vl import (Qwen2VLMultiModalProcessor, Qwen2VLProcessingInfo,
|
|
67
|
+
apply_rotary_pos_emb_vision)
|
|
68
|
+
from .utils import (AutoWeightsLoader, WeightsMapper, cast_overflow_tensors,
|
|
69
|
+
init_vllm_registered_model, maybe_prefix,
|
|
70
|
+
merge_multimodal_embeddings)
|
|
71
|
+
from .vision import get_vit_attn_backend
|
|
72
|
+
|
|
73
|
+
logger = init_logger(__name__)
|
|
74
|
+
|
|
75
|
+
# === Vision Inputs === #
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
class Qwen2_5_VLImagePixelInputs(TypedDict):
|
|
79
|
+
type: Literal["pixel_values"]
|
|
80
|
+
pixel_values: torch.Tensor
|
|
81
|
+
"""Shape:
|
|
82
|
+
`(num_patches, num_channels * patch_size * patch_size)`
|
|
83
|
+
"""
|
|
84
|
+
|
|
85
|
+
image_grid_thw: torch.Tensor
|
|
86
|
+
"""Shape: `(num_images, 3)`
|
|
87
|
+
This should be in `(grid_t, grid_h, grid_w)` format.
|
|
88
|
+
"""
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
class Qwen2_5_VLImageEmbeddingInputs(TypedDict):
|
|
92
|
+
type: Literal["image_embeds"]
|
|
93
|
+
image_embeds: torch.Tensor
|
|
94
|
+
"""Supported types:
|
|
95
|
+
- list[`torch.Tensor`]: A list of tensors holding all images' features.
|
|
96
|
+
Each tensor holds an image's features.
|
|
97
|
+
- `torch.Tensor`: A tensor holding all images' features
|
|
98
|
+
(concatenation of all images' feature tensors).
|
|
99
|
+
|
|
100
|
+
Tensor shape: `(num_image_features, hidden_size)`
|
|
101
|
+
- `num_image_features` varies based on
|
|
102
|
+
the number and resolution of the images.
|
|
103
|
+
- `hidden_size` must match the hidden size of language model backbone.
|
|
104
|
+
"""
|
|
105
|
+
|
|
106
|
+
image_grid_thw: torch.Tensor
|
|
107
|
+
"""Shape: `(num_images, 3)`
|
|
108
|
+
This should be in `(grid_t, grid_h, grid_w)` format.
|
|
109
|
+
"""
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
Qwen2_5_VLImageInputs = Union[Qwen2_5_VLImagePixelInputs,
|
|
113
|
+
Qwen2_5_VLImageEmbeddingInputs]
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
class Qwen2_5_VLVideoPixelInputs(TypedDict):
|
|
117
|
+
type: Literal["pixel_values_videos"]
|
|
118
|
+
pixel_values_videos: torch.Tensor
|
|
119
|
+
"""Shape:
|
|
120
|
+
`(num_patches,
|
|
121
|
+
num_channels * temporal_patch_size * patch_size * patch_size)`
|
|
122
|
+
"""
|
|
123
|
+
|
|
124
|
+
video_grid_thw: torch.Tensor
|
|
125
|
+
"""Shape: `(num_videos, 3)`
|
|
126
|
+
|
|
127
|
+
This should be in `(grid_t, grid_h, grid_w)` format.
|
|
128
|
+
"""
|
|
129
|
+
|
|
130
|
+
second_per_grid_ts: torch.Tensor
|
|
131
|
+
"""
|
|
132
|
+
The video time interval (in seconds) for each grid along the temporal
|
|
133
|
+
dimension in the 3D position IDs. Returned when `videos` is not `None`.
|
|
134
|
+
"""
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
class Qwen2_5_VLVideoEmbeddingInputs(TypedDict):
|
|
138
|
+
type: Literal["video_embeds"]
|
|
139
|
+
video_embeds: torch.Tensor
|
|
140
|
+
"""Supported types:
|
|
141
|
+
- list[`torch.Tensor`]: A list of tensors holding all videos' features.
|
|
142
|
+
Each tensor holds an video's features.
|
|
143
|
+
- `torch.Tensor`: A tensor holding all videos' features
|
|
144
|
+
(concatenation of all videos' feature tensors).
|
|
145
|
+
|
|
146
|
+
Tensor shape: `(num_image_features, hidden_size)`
|
|
147
|
+
- `num_image_features` varies based on
|
|
148
|
+
the number and resolution of the videos.
|
|
149
|
+
- `hidden_size` must match the hidden size of language model backbone.
|
|
150
|
+
"""
|
|
151
|
+
|
|
152
|
+
video_grid_thw: torch.Tensor
|
|
153
|
+
"""Shape: `(num_videos, 3)`
|
|
154
|
+
This should be in `(grid_t, grid_h, grid_w)` format.
|
|
155
|
+
"""
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
Qwen2_5_VLVideoInputs = Union[Qwen2_5_VLVideoPixelInputs,
|
|
159
|
+
Qwen2_5_VLVideoEmbeddingInputs]
|
|
160
|
+
|
|
161
|
+
# === Vision Encoder === #
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
class Qwen2_5_VisionMLP(nn.Module):
|
|
165
|
+
|
|
166
|
+
def __init__(self,
|
|
167
|
+
in_features: int,
|
|
168
|
+
hidden_features: int,
|
|
169
|
+
bias: bool = False,
|
|
170
|
+
act_fn: Callable[[torch.Tensor], torch.Tensor] = F.silu,
|
|
171
|
+
quant_config: Optional[QuantizationConfig] = None,
|
|
172
|
+
prefix: str = ""):
|
|
173
|
+
super().__init__()
|
|
174
|
+
self.gate_proj = ColumnParallelLinear(in_features,
|
|
175
|
+
hidden_features,
|
|
176
|
+
bias=bias,
|
|
177
|
+
quant_config=quant_config,
|
|
178
|
+
prefix=f"{prefix}.gate_proj")
|
|
179
|
+
self.up_proj = ColumnParallelLinear(in_features,
|
|
180
|
+
hidden_features,
|
|
181
|
+
bias=bias,
|
|
182
|
+
quant_config=quant_config,
|
|
183
|
+
prefix=f"{prefix}.up_proj")
|
|
184
|
+
self.down_proj = RowParallelLinear(hidden_features,
|
|
185
|
+
in_features,
|
|
186
|
+
bias=bias,
|
|
187
|
+
quant_config=quant_config,
|
|
188
|
+
prefix=f"{prefix}.down_proj")
|
|
189
|
+
self.act_fn = act_fn
|
|
190
|
+
|
|
191
|
+
def forward(self, x: torch.Tensor):
|
|
192
|
+
x_gate, _ = self.gate_proj(x)
|
|
193
|
+
x_gate = self.act_fn(x_gate)
|
|
194
|
+
x_up, _ = self.up_proj(x)
|
|
195
|
+
x_down, _ = self.down_proj(x_gate * x_up)
|
|
196
|
+
return x_down
|
|
197
|
+
|
|
198
|
+
|
|
199
|
+
def all_gather_interleave(local_tensor, hidden_size: int, tp_size: int):
|
|
200
|
+
"""All-gather the input tensor interleavely across model parallel group."""
|
|
201
|
+
import torch.distributed as dist
|
|
202
|
+
gathered_tensors = [torch.zeros_like(local_tensor) for _ in range(tp_size)]
|
|
203
|
+
dist.all_gather(gathered_tensors,
|
|
204
|
+
local_tensor,
|
|
205
|
+
group=parallel_state.get_tp_group().device_group)
|
|
206
|
+
|
|
207
|
+
gathered_tensors_split = [
|
|
208
|
+
torch.split(tensor, hidden_size // tp_size, -1)
|
|
209
|
+
for tensor in gathered_tensors
|
|
210
|
+
]
|
|
211
|
+
ordered_tensors = [
|
|
212
|
+
tensor for pair in zip(*gathered_tensors_split) for tensor in pair
|
|
213
|
+
]
|
|
214
|
+
result_tensor = torch.cat(ordered_tensors, dim=-1)
|
|
215
|
+
return result_tensor
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
class Qwen2_5_VisionAttention(nn.Module):
|
|
219
|
+
|
|
220
|
+
def __init__(
|
|
221
|
+
self,
|
|
222
|
+
embed_dim: int,
|
|
223
|
+
num_heads: int,
|
|
224
|
+
projection_size: int,
|
|
225
|
+
quant_config: Optional[QuantizationConfig] = None,
|
|
226
|
+
prefix: str = "",
|
|
227
|
+
) -> None:
|
|
228
|
+
super().__init__()
|
|
229
|
+
# Per attention head and per partition values.
|
|
230
|
+
self.tp_size = parallel_state.get_tensor_model_parallel_world_size()
|
|
231
|
+
self.tp_rank = parallel_state.get_tensor_model_parallel_rank()
|
|
232
|
+
self.hidden_size_per_attention_head = dist_utils.divide(
|
|
233
|
+
projection_size, num_heads)
|
|
234
|
+
self.num_attention_heads_per_partition = dist_utils.divide(
|
|
235
|
+
num_heads, self.tp_size)
|
|
236
|
+
|
|
237
|
+
self.qkv = QKVParallelLinear(
|
|
238
|
+
hidden_size=embed_dim,
|
|
239
|
+
head_size=self.hidden_size_per_attention_head,
|
|
240
|
+
total_num_heads=num_heads,
|
|
241
|
+
total_num_kv_heads=num_heads,
|
|
242
|
+
bias=True,
|
|
243
|
+
quant_config=quant_config,
|
|
244
|
+
prefix=f"{prefix}.qkv")
|
|
245
|
+
self.proj = RowParallelLinear(input_size=projection_size,
|
|
246
|
+
output_size=embed_dim,
|
|
247
|
+
quant_config=quant_config,
|
|
248
|
+
prefix=f"{prefix}.proj")
|
|
249
|
+
|
|
250
|
+
# Detect attention implementation.
|
|
251
|
+
self.attn_backend: _Backend = get_vit_attn_backend(support_fa=True)
|
|
252
|
+
if self.attn_backend not in {
|
|
253
|
+
_Backend.FLASH_ATTN, _Backend.TORCH_SDPA, _Backend.XFORMERS
|
|
254
|
+
}:
|
|
255
|
+
raise RuntimeError(
|
|
256
|
+
f"Qwen2.5-VL does not support {self.attn_backend} backend now."
|
|
257
|
+
)
|
|
258
|
+
|
|
259
|
+
def split_qkv(self, qkv: torch.Tensor) -> tuple[torch.Tensor, ...]:
|
|
260
|
+
# [s, b, 3 * head * head_dim]
|
|
261
|
+
seq_len, bs, _ = qkv.shape
|
|
262
|
+
if self.tp_size > 1:
|
|
263
|
+
qkv = all_gather_interleave(qkv, self.qkv.hidden_size,
|
|
264
|
+
self.tp_size)
|
|
265
|
+
|
|
266
|
+
# [s, b, 3 * head * head_dim] -> 3 * [s, b, head * head_dim]
|
|
267
|
+
q, k, v = qkv.chunk(3, dim=2)
|
|
268
|
+
|
|
269
|
+
# 3 * [s, b, head * head_dim]
|
|
270
|
+
if self.tp_size > 1:
|
|
271
|
+
splitter = partial(dist_utils.split_tensor_along_last_dim,
|
|
272
|
+
num_partitions=self.tp_size)
|
|
273
|
+
q = splitter(q)[self.tp_rank]
|
|
274
|
+
k = splitter(k)[self.tp_rank]
|
|
275
|
+
v = splitter(v)[self.tp_rank]
|
|
276
|
+
|
|
277
|
+
# 3 * [s, b, head * head_dim] -> 3 * [s, b, head, head_dim]
|
|
278
|
+
new_shape = (seq_len, bs, self.num_attention_heads_per_partition,
|
|
279
|
+
self.hidden_size_per_attention_head)
|
|
280
|
+
q, k, v = (x.view(*new_shape) for x in (q, k, v))
|
|
281
|
+
return q, k, v
|
|
282
|
+
|
|
283
|
+
def forward(
|
|
284
|
+
self,
|
|
285
|
+
x: torch.Tensor,
|
|
286
|
+
cu_seqlens: torch.Tensor,
|
|
287
|
+
rotary_pos_emb: torch.Tensor,
|
|
288
|
+
max_seqlen: Optional[int] = None, # Only used for Flash Attention
|
|
289
|
+
seqlens: Optional[list[int]] = None, # Only used for xFormers
|
|
290
|
+
) -> torch.Tensor:
|
|
291
|
+
# [s, b, c] --> [s, b, head * 3 * head_dim]
|
|
292
|
+
x, _ = self.qkv(x)
|
|
293
|
+
|
|
294
|
+
# [s, b, 3 * head * head_dim] -> 3 * [s, b, head, head_dim]
|
|
295
|
+
q, k, v = self.split_qkv(x)
|
|
296
|
+
batch_size = q.shape[1]
|
|
297
|
+
|
|
298
|
+
q, k, v = (rearrange(x, "s b ... -> b s ...").contiguous()
|
|
299
|
+
for x in (q, k, v))
|
|
300
|
+
if rotary_pos_emb is not None:
|
|
301
|
+
q = apply_rotary_pos_emb_vision(q, rotary_pos_emb)
|
|
302
|
+
k = apply_rotary_pos_emb_vision(k, rotary_pos_emb)
|
|
303
|
+
|
|
304
|
+
if self.attn_backend == _Backend.FLASH_ATTN:
|
|
305
|
+
# from vllm_flash_attn.flash_attn_interface import (
|
|
306
|
+
# flash_attn_varlen_func)
|
|
307
|
+
from flash_attn import flash_attn_varlen_func
|
|
308
|
+
|
|
309
|
+
q, k, v = (rearrange(x, "b s ... -> (b s) ...") for x in [q, k, v])
|
|
310
|
+
|
|
311
|
+
output = flash_attn_varlen_func(q,
|
|
312
|
+
k,
|
|
313
|
+
v,
|
|
314
|
+
cu_seqlens_q=cu_seqlens,
|
|
315
|
+
cu_seqlens_k=cu_seqlens,
|
|
316
|
+
max_seqlen_q=max_seqlen,
|
|
317
|
+
max_seqlen_k=max_seqlen,
|
|
318
|
+
dropout_p=0,
|
|
319
|
+
causal=False)
|
|
320
|
+
|
|
321
|
+
context_layer = rearrange(output,
|
|
322
|
+
"(b s) ... -> b s ...",
|
|
323
|
+
b=batch_size)
|
|
324
|
+
elif self.attn_backend == _Backend.TORCH_SDPA:
|
|
325
|
+
# Execute attention entry by entry for speed & less VRAM.
|
|
326
|
+
outputs = []
|
|
327
|
+
for i in range(1, len(cu_seqlens)):
|
|
328
|
+
start_idx = cu_seqlens[i - 1]
|
|
329
|
+
end_idx = cu_seqlens[i]
|
|
330
|
+
q_i = q[:, start_idx:end_idx]
|
|
331
|
+
k_i = k[:, start_idx:end_idx]
|
|
332
|
+
v_i = v[:, start_idx:end_idx]
|
|
333
|
+
q_i, k_i, v_i = (rearrange(x, "b s h d -> b h s d")
|
|
334
|
+
for x in [q_i, k_i, v_i])
|
|
335
|
+
output_i = F.scaled_dot_product_attention(q_i,
|
|
336
|
+
k_i,
|
|
337
|
+
v_i,
|
|
338
|
+
dropout_p=0.0)
|
|
339
|
+
output_i = rearrange(output_i, "b h s d -> b s h d ")
|
|
340
|
+
outputs.append(output_i)
|
|
341
|
+
context_layer = torch.cat(outputs, dim=1)
|
|
342
|
+
elif self.attn_backend == _Backend.XFORMERS:
|
|
343
|
+
from xformers import ops as xops
|
|
344
|
+
from xformers.ops.fmha.attn_bias import BlockDiagonalMask
|
|
345
|
+
|
|
346
|
+
attn_bias = BlockDiagonalMask.from_seqlens(q_seqlen=seqlens,
|
|
347
|
+
kv_seqlen=None,
|
|
348
|
+
device=q.device)
|
|
349
|
+
|
|
350
|
+
context_layer = xops.memory_efficient_attention_forward(
|
|
351
|
+
q, k, v, attn_bias=attn_bias, p=0, scale=None)
|
|
352
|
+
context_layer = rearrange(context_layer,
|
|
353
|
+
"b s h d -> s b (h d)").contiguous()
|
|
354
|
+
|
|
355
|
+
output, _ = self.proj(context_layer)
|
|
356
|
+
return output
|
|
357
|
+
|
|
358
|
+
|
|
359
|
+
class Qwen2_5_VisionBlock(nn.Module):
|
|
360
|
+
|
|
361
|
+
def __init__(
|
|
362
|
+
self,
|
|
363
|
+
dim: int,
|
|
364
|
+
num_heads: int,
|
|
365
|
+
mlp_hidden_dim: int,
|
|
366
|
+
act_fn: Callable[[torch.Tensor], torch.Tensor] = F.silu,
|
|
367
|
+
norm_layer: Optional[Callable[[int], nn.Module]] = None,
|
|
368
|
+
quant_config: Optional[QuantizationConfig] = None,
|
|
369
|
+
prefix: str = "",
|
|
370
|
+
) -> None:
|
|
371
|
+
super().__init__()
|
|
372
|
+
if norm_layer is None:
|
|
373
|
+
norm_layer = partial(nn.LayerNorm, eps=1e-6)
|
|
374
|
+
self.norm1 = norm_layer(dim)
|
|
375
|
+
self.norm2 = norm_layer(dim)
|
|
376
|
+
self.attn = Qwen2_5_VisionAttention(embed_dim=dim,
|
|
377
|
+
num_heads=num_heads,
|
|
378
|
+
projection_size=dim,
|
|
379
|
+
quant_config=quant_config,
|
|
380
|
+
prefix=f"{prefix}.attn")
|
|
381
|
+
self.mlp = Qwen2_5_VisionMLP(dim,
|
|
382
|
+
mlp_hidden_dim,
|
|
383
|
+
act_fn=act_fn,
|
|
384
|
+
bias=True,
|
|
385
|
+
quant_config=quant_config,
|
|
386
|
+
prefix=f"{prefix}.mlp")
|
|
387
|
+
|
|
388
|
+
def forward(
|
|
389
|
+
self,
|
|
390
|
+
x: torch.Tensor,
|
|
391
|
+
cu_seqlens: torch.Tensor,
|
|
392
|
+
rotary_pos_emb: torch.Tensor,
|
|
393
|
+
max_seqlen: Optional[int] = None, # Only used for Flash Attention
|
|
394
|
+
seqlens: Optional[list[int]] = None, # Only used for xFormers
|
|
395
|
+
) -> torch.Tensor:
|
|
396
|
+
x = x + self.attn(self.norm1(x),
|
|
397
|
+
cu_seqlens=cu_seqlens,
|
|
398
|
+
rotary_pos_emb=rotary_pos_emb,
|
|
399
|
+
max_seqlen=max_seqlen,
|
|
400
|
+
seqlens=seqlens)
|
|
401
|
+
|
|
402
|
+
x = x + self.mlp(self.norm2(x))
|
|
403
|
+
return x
|
|
404
|
+
|
|
405
|
+
|
|
406
|
+
class Qwen2_5_VisionPatchEmbed(nn.Module):
|
|
407
|
+
|
|
408
|
+
def __init__(
|
|
409
|
+
self,
|
|
410
|
+
patch_size: int = 14,
|
|
411
|
+
temporal_patch_size: int = 2,
|
|
412
|
+
in_channels: int = 3,
|
|
413
|
+
hidden_size: int = 1152,
|
|
414
|
+
) -> None:
|
|
415
|
+
super().__init__()
|
|
416
|
+
self.patch_size = patch_size
|
|
417
|
+
self.temporal_patch_size = temporal_patch_size
|
|
418
|
+
self.hidden_size = hidden_size
|
|
419
|
+
|
|
420
|
+
kernel_size = (temporal_patch_size, patch_size, patch_size)
|
|
421
|
+
self.proj = nn.Conv3d(in_channels,
|
|
422
|
+
hidden_size,
|
|
423
|
+
kernel_size=kernel_size,
|
|
424
|
+
stride=kernel_size,
|
|
425
|
+
bias=False)
|
|
426
|
+
|
|
427
|
+
def forward(self, x: torch.Tensor) -> torch.Tensor:
|
|
428
|
+
L, C = x.shape
|
|
429
|
+
x = x.view(L, -1, self.temporal_patch_size, self.patch_size,
|
|
430
|
+
self.patch_size)
|
|
431
|
+
x = self.proj(x).view(L, self.hidden_size)
|
|
432
|
+
return x
|
|
433
|
+
|
|
434
|
+
|
|
435
|
+
class Qwen2_5_VisionPatchMerger(nn.Module):
|
|
436
|
+
|
|
437
|
+
def __init__(
|
|
438
|
+
self,
|
|
439
|
+
d_model: int,
|
|
440
|
+
context_dim: int,
|
|
441
|
+
norm_layer: Optional[Callable[[int], nn.Module]] = None,
|
|
442
|
+
spatial_merge_size: int = 2,
|
|
443
|
+
quant_config: Optional[QuantizationConfig] = None,
|
|
444
|
+
prefix: str = "",
|
|
445
|
+
) -> None:
|
|
446
|
+
super().__init__()
|
|
447
|
+
self.hidden_size = context_dim * (spatial_merge_size**2)
|
|
448
|
+
if norm_layer is None:
|
|
449
|
+
norm_layer = partial(nn.LayerNorm, eps=1e-6)
|
|
450
|
+
self.ln_q = norm_layer(context_dim)
|
|
451
|
+
self.mlp = nn.ModuleList([
|
|
452
|
+
ColumnParallelLinear(self.hidden_size,
|
|
453
|
+
self.hidden_size,
|
|
454
|
+
bias=True,
|
|
455
|
+
quant_config=quant_config,
|
|
456
|
+
prefix=f"{prefix}.mlp.0"),
|
|
457
|
+
nn.GELU(),
|
|
458
|
+
RowParallelLinear(self.hidden_size,
|
|
459
|
+
d_model,
|
|
460
|
+
bias=True,
|
|
461
|
+
quant_config=quant_config,
|
|
462
|
+
prefix=f"{prefix}.mlp.2"),
|
|
463
|
+
])
|
|
464
|
+
|
|
465
|
+
def forward(self, x: torch.Tensor) -> torch.Tensor:
|
|
466
|
+
x = self.ln_q(x)
|
|
467
|
+
x = x.view(-1, self.hidden_size)
|
|
468
|
+
|
|
469
|
+
mlp_fc1, mlp_act, mlp_fc2 = self.mlp
|
|
470
|
+
x_parallel, _ = mlp_fc1(x)
|
|
471
|
+
x_parallel = mlp_act(x_parallel)
|
|
472
|
+
out, _ = mlp_fc2(x_parallel)
|
|
473
|
+
return out
|
|
474
|
+
|
|
475
|
+
|
|
476
|
+
class Qwen2_5_VisionRotaryEmbedding(nn.Module):
|
|
477
|
+
|
|
478
|
+
def __init__(self, dim: int, theta: float = 10000.0) -> None:
|
|
479
|
+
super().__init__()
|
|
480
|
+
self.dim = dim
|
|
481
|
+
self.theta = theta
|
|
482
|
+
inv_freq = 1.0 / (theta**(
|
|
483
|
+
torch.arange(0, dim, 2, dtype=torch.float, device='cpu') / dim))
|
|
484
|
+
self.register_buffer("inv_freq", inv_freq, persistent=False)
|
|
485
|
+
self._seq_len_cached = 0
|
|
486
|
+
self._freqs_cached = None
|
|
487
|
+
|
|
488
|
+
def update_freqs_cache(self, seqlen: int) -> None:
|
|
489
|
+
if seqlen > self._seq_len_cached:
|
|
490
|
+
seqlen *= 2
|
|
491
|
+
self._seq_len_cached = seqlen
|
|
492
|
+
self.inv_freq = 1.0 / (self.theta**(torch.arange(
|
|
493
|
+
0, self.dim, 2, dtype=torch.float, device=self.inv_freq.device)
|
|
494
|
+
/ self.dim))
|
|
495
|
+
seq = torch.arange(seqlen,
|
|
496
|
+
device=self.inv_freq.device,
|
|
497
|
+
dtype=self.inv_freq.dtype)
|
|
498
|
+
freqs = torch.outer(seq, self.inv_freq)
|
|
499
|
+
self._freqs_cached = freqs
|
|
500
|
+
|
|
501
|
+
def forward(self, seqlen: int) -> torch.Tensor:
|
|
502
|
+
self.update_freqs_cache(seqlen)
|
|
503
|
+
return self._freqs_cached[:seqlen]
|
|
504
|
+
|
|
505
|
+
|
|
506
|
+
class Qwen2_5_VisionTransformer(nn.Module):
|
|
507
|
+
|
|
508
|
+
def __init__(
|
|
509
|
+
self,
|
|
510
|
+
vision_config: Qwen2_5_VLVisionConfig,
|
|
511
|
+
norm_eps: float = 1e-6,
|
|
512
|
+
quant_config: Optional[QuantizationConfig] = None,
|
|
513
|
+
prefix: str = "",
|
|
514
|
+
) -> None:
|
|
515
|
+
super().__init__()
|
|
516
|
+
|
|
517
|
+
patch_size = vision_config.patch_size
|
|
518
|
+
temporal_patch_size = vision_config.temporal_patch_size
|
|
519
|
+
in_channels = vision_config.in_channels
|
|
520
|
+
depth = vision_config.depth
|
|
521
|
+
self.hidden_size = vision_config.hidden_size
|
|
522
|
+
self.num_heads = vision_config.num_heads
|
|
523
|
+
|
|
524
|
+
# args for get_window_index_thw
|
|
525
|
+
self.window_size = vision_config.window_size
|
|
526
|
+
self.patch_size = vision_config.patch_size
|
|
527
|
+
self.spatial_merge_size = vision_config.spatial_merge_size
|
|
528
|
+
self.fullatt_block_indexes = vision_config.fullatt_block_indexes
|
|
529
|
+
self.spatial_merge_unit = self.spatial_merge_size**2
|
|
530
|
+
|
|
531
|
+
self.patch_embed = Qwen2_5_VisionPatchEmbed(
|
|
532
|
+
patch_size=patch_size,
|
|
533
|
+
temporal_patch_size=temporal_patch_size,
|
|
534
|
+
in_channels=in_channels,
|
|
535
|
+
hidden_size=self.hidden_size,
|
|
536
|
+
)
|
|
537
|
+
|
|
538
|
+
norm_layer = partial(RMSNorm, eps=norm_eps)
|
|
539
|
+
head_dim = self.hidden_size // self.num_heads
|
|
540
|
+
self.rotary_pos_emb = Qwen2_5_VisionRotaryEmbedding(head_dim // 2)
|
|
541
|
+
|
|
542
|
+
self.blocks = nn.ModuleList([
|
|
543
|
+
Qwen2_5_VisionBlock(
|
|
544
|
+
dim=self.hidden_size,
|
|
545
|
+
num_heads=self.num_heads,
|
|
546
|
+
mlp_hidden_dim=vision_config.intermediate_size,
|
|
547
|
+
act_fn=_ACTIVATION_REGISTRY[vision_config.hidden_act],
|
|
548
|
+
norm_layer=norm_layer,
|
|
549
|
+
quant_config=quant_config,
|
|
550
|
+
prefix=f"{prefix}.blocks.{layer_idx}")
|
|
551
|
+
for layer_idx in range(depth)
|
|
552
|
+
])
|
|
553
|
+
self.merger = Qwen2_5_VisionPatchMerger(
|
|
554
|
+
d_model=vision_config.out_hidden_size,
|
|
555
|
+
context_dim=self.hidden_size,
|
|
556
|
+
norm_layer=norm_layer,
|
|
557
|
+
spatial_merge_size=self.spatial_merge_size,
|
|
558
|
+
quant_config=quant_config,
|
|
559
|
+
prefix=f"{prefix}.merger",
|
|
560
|
+
)
|
|
561
|
+
self.attn_backend: _Backend = get_vit_attn_backend(support_fa=True)
|
|
562
|
+
|
|
563
|
+
@property
|
|
564
|
+
def dtype(self) -> torch.dtype:
|
|
565
|
+
return self.patch_embed.proj.weight.dtype
|
|
566
|
+
|
|
567
|
+
@property
|
|
568
|
+
def device(self) -> torch.device:
|
|
569
|
+
return self.patch_embed.proj.weight.device
|
|
570
|
+
|
|
571
|
+
def rotary_pos_emb_thw(self, t, h, w):
|
|
572
|
+
hpos_ids = torch.arange(h).unsqueeze(1).expand(-1, w)
|
|
573
|
+
wpos_ids = torch.arange(w).unsqueeze(0).expand(h, -1)
|
|
574
|
+
hpos_ids = hpos_ids.reshape(
|
|
575
|
+
h // self.spatial_merge_size,
|
|
576
|
+
self.spatial_merge_size,
|
|
577
|
+
w // self.spatial_merge_size,
|
|
578
|
+
self.spatial_merge_size,
|
|
579
|
+
).permute(0, 2, 1, 3).flatten()
|
|
580
|
+
wpos_ids = wpos_ids.reshape(
|
|
581
|
+
h // self.spatial_merge_size,
|
|
582
|
+
self.spatial_merge_size,
|
|
583
|
+
w // self.spatial_merge_size,
|
|
584
|
+
self.spatial_merge_size,
|
|
585
|
+
).permute(0, 2, 1, 3).flatten()
|
|
586
|
+
pos_ids = torch.stack([hpos_ids, wpos_ids], dim=-1).repeat(t, 1)
|
|
587
|
+
max_size = max(h, w)
|
|
588
|
+
rotary_pos_emb_full = self.rotary_pos_emb(max_size)
|
|
589
|
+
rotary_pos_emb = rotary_pos_emb_full[pos_ids].flatten(1)
|
|
590
|
+
rotary_pos_emb = rotary_pos_emb.reshape(
|
|
591
|
+
rotary_pos_emb.shape[0] // self.spatial_merge_unit,
|
|
592
|
+
self.spatial_merge_unit, -1)
|
|
593
|
+
|
|
594
|
+
return rotary_pos_emb
|
|
595
|
+
|
|
596
|
+
def get_window_index_thw(self, grid_t, grid_h, grid_w):
|
|
597
|
+
vit_merger_window_size = (self.window_size //
|
|
598
|
+
self.spatial_merge_size // self.patch_size)
|
|
599
|
+
|
|
600
|
+
llm_grid_h = grid_h // self.spatial_merge_size
|
|
601
|
+
llm_grid_w = grid_w // self.spatial_merge_size
|
|
602
|
+
index = torch.arange(grid_t * llm_grid_h * llm_grid_w).reshape(
|
|
603
|
+
grid_t, llm_grid_h, llm_grid_w)
|
|
604
|
+
pad_h = vit_merger_window_size - llm_grid_h % vit_merger_window_size
|
|
605
|
+
pad_w = vit_merger_window_size - llm_grid_w % vit_merger_window_size
|
|
606
|
+
num_windows_h = (llm_grid_h + pad_h) // vit_merger_window_size
|
|
607
|
+
num_windows_w = (llm_grid_w + pad_w) // vit_merger_window_size
|
|
608
|
+
index_padded = F.pad(index, (0, pad_w, 0, pad_h), 'constant', -100)
|
|
609
|
+
index_padded = index_padded.reshape(grid_t, num_windows_h,
|
|
610
|
+
vit_merger_window_size,
|
|
611
|
+
num_windows_w,
|
|
612
|
+
vit_merger_window_size)
|
|
613
|
+
index_padded = index_padded.permute(0, 1, 3, 2, 4).reshape(
|
|
614
|
+
grid_t, num_windows_h * num_windows_w, vit_merger_window_size,
|
|
615
|
+
vit_merger_window_size)
|
|
616
|
+
seqlens = (index_padded != -100).sum([2, 3]).reshape(-1)
|
|
617
|
+
index_padded = index_padded.reshape(-1)
|
|
618
|
+
index_new = index_padded[index_padded != -100]
|
|
619
|
+
cu_seqlens_tmp = seqlens.cumsum(0) * self.spatial_merge_unit
|
|
620
|
+
cu_seqlens_tmp = cu_seqlens_tmp.to(dtype=torch.int32)
|
|
621
|
+
cu_seqlens_tmp = torch.unique_consecutive(cu_seqlens_tmp)
|
|
622
|
+
|
|
623
|
+
return index_new, cu_seqlens_tmp
|
|
624
|
+
|
|
625
|
+
@lru_cache(maxsize=1024) # noqa: B019
|
|
626
|
+
def get_rope_by_thw(self, t, h, w):
|
|
627
|
+
window_index_thw, cu_seqlens_window_thw = self.get_window_index_thw(
|
|
628
|
+
t, h, w)
|
|
629
|
+
rotary_pos_emb_thw = self.rotary_pos_emb_thw(t, h, w)
|
|
630
|
+
rotary_pos_emb_thw = rotary_pos_emb_thw[window_index_thw, :, :]
|
|
631
|
+
rotary_pos_emb_thw = rotary_pos_emb_thw.flatten(start_dim=0, end_dim=1)
|
|
632
|
+
cu_seqlens_thw = torch.repeat_interleave(
|
|
633
|
+
torch.tensor([h * w], dtype=torch.int32), t)
|
|
634
|
+
return (rotary_pos_emb_thw, window_index_thw, cu_seqlens_window_thw,
|
|
635
|
+
cu_seqlens_thw)
|
|
636
|
+
|
|
637
|
+
def compute_attn_mask_seqlen(
|
|
638
|
+
self,
|
|
639
|
+
cu_seqlens: torch.Tensor,
|
|
640
|
+
) -> tuple[Optional[int], Optional[list[int]]]:
|
|
641
|
+
max_seqlen, seqlens = None, None
|
|
642
|
+
if self.attn_backend == _Backend.FLASH_ATTN:
|
|
643
|
+
max_seqlen = (cu_seqlens[1:] - cu_seqlens[:-1]).max().item()
|
|
644
|
+
elif self.attn_backend == _Backend.XFORMERS:
|
|
645
|
+
seqlens = (cu_seqlens[1:] - cu_seqlens[:-1]).tolist()
|
|
646
|
+
return max_seqlen, seqlens
|
|
647
|
+
|
|
648
|
+
def forward(
|
|
649
|
+
self,
|
|
650
|
+
x: torch.Tensor,
|
|
651
|
+
grid_thw: list[list[int]],
|
|
652
|
+
) -> torch.Tensor:
|
|
653
|
+
# patchify
|
|
654
|
+
seq_len, _ = x.size()
|
|
655
|
+
rotary_pos_emb = []
|
|
656
|
+
window_index: list = []
|
|
657
|
+
cu_window_seqlens: list = [torch.tensor([0], dtype=torch.int32)]
|
|
658
|
+
cu_seqlens: list = []
|
|
659
|
+
|
|
660
|
+
hidden_states = x.to(device=self.device, dtype=self.dtype)
|
|
661
|
+
hidden_states = self.patch_embed(hidden_states)
|
|
662
|
+
|
|
663
|
+
window_index_id = 0
|
|
664
|
+
cu_window_seqlens_last = 0
|
|
665
|
+
for t, h, w in grid_thw:
|
|
666
|
+
t, h, w = int(t), int(h), int(w)
|
|
667
|
+
llm_h = h // self.spatial_merge_size
|
|
668
|
+
llm_w = w // self.spatial_merge_size
|
|
669
|
+
|
|
670
|
+
(
|
|
671
|
+
rotary_pos_emb_thw,
|
|
672
|
+
window_index_thw,
|
|
673
|
+
cu_seqlens_window_thw,
|
|
674
|
+
cu_seqlens_thw,
|
|
675
|
+
) = self.get_rope_by_thw(t, h, w)
|
|
676
|
+
|
|
677
|
+
window_index.append(window_index_thw + window_index_id)
|
|
678
|
+
window_index_id += (t * llm_h * llm_w)
|
|
679
|
+
|
|
680
|
+
cu_seqlens_window_thw = (cu_seqlens_window_thw +
|
|
681
|
+
cu_window_seqlens_last)
|
|
682
|
+
cu_window_seqlens_last = cu_seqlens_window_thw[-1]
|
|
683
|
+
cu_window_seqlens.append(cu_seqlens_window_thw)
|
|
684
|
+
|
|
685
|
+
rotary_pos_emb.append(rotary_pos_emb_thw)
|
|
686
|
+
|
|
687
|
+
cu_seqlens.append(cu_seqlens_thw)
|
|
688
|
+
|
|
689
|
+
rotary_pos_emb = torch.cat(rotary_pos_emb)
|
|
690
|
+
window_index = torch.cat(window_index)
|
|
691
|
+
cu_window_seqlens = torch.cat(cu_window_seqlens)
|
|
692
|
+
cu_window_seqlens = torch.unique_consecutive(cu_window_seqlens)
|
|
693
|
+
cu_seqlens = torch.cat(cu_seqlens)
|
|
694
|
+
cu_seqlens = torch.cumsum(cu_seqlens, dim=0, dtype=torch.int32)
|
|
695
|
+
cu_seqlens = F.pad(cu_seqlens, (1, 0), "constant", 0)
|
|
696
|
+
|
|
697
|
+
# transformers
|
|
698
|
+
# pre-compute seqlens for window/full attn to reduce cuMemcpy operations
|
|
699
|
+
max_seqlen_full, seqlens_full = self.compute_attn_mask_seqlen(
|
|
700
|
+
cu_seqlens)
|
|
701
|
+
max_seqlen_window, seqlens_window = self.compute_attn_mask_seqlen(
|
|
702
|
+
cu_window_seqlens)
|
|
703
|
+
|
|
704
|
+
cu_seqlens = cu_seqlens.to(device=self.device, non_blocking=True)
|
|
705
|
+
cu_window_seqlens = cu_window_seqlens.to(device=self.device,
|
|
706
|
+
non_blocking=True)
|
|
707
|
+
rotary_pos_emb = rotary_pos_emb.to(device=self.device,
|
|
708
|
+
non_blocking=True)
|
|
709
|
+
window_index = window_index.to(device=hidden_states.device,
|
|
710
|
+
non_blocking=True)
|
|
711
|
+
|
|
712
|
+
hidden_states = hidden_states.reshape(
|
|
713
|
+
seq_len // self.spatial_merge_unit, self.spatial_merge_unit, -1)
|
|
714
|
+
hidden_states = hidden_states[window_index, :, :]
|
|
715
|
+
hidden_states = hidden_states.reshape(seq_len, -1)
|
|
716
|
+
|
|
717
|
+
hidden_states = hidden_states.unsqueeze(1)
|
|
718
|
+
|
|
719
|
+
for layer_num, blk in enumerate(self.blocks):
|
|
720
|
+
if layer_num in self.fullatt_block_indexes:
|
|
721
|
+
cu_seqlens_now = cu_seqlens
|
|
722
|
+
max_seqlen_now = max_seqlen_full
|
|
723
|
+
seqlens_now = seqlens_full
|
|
724
|
+
else:
|
|
725
|
+
cu_seqlens_now = cu_window_seqlens
|
|
726
|
+
max_seqlen_now = max_seqlen_window
|
|
727
|
+
seqlens_now = seqlens_window
|
|
728
|
+
|
|
729
|
+
hidden_states = blk(
|
|
730
|
+
hidden_states,
|
|
731
|
+
cu_seqlens=cu_seqlens_now,
|
|
732
|
+
rotary_pos_emb=rotary_pos_emb,
|
|
733
|
+
max_seqlen=max_seqlen_now,
|
|
734
|
+
seqlens=seqlens_now,
|
|
735
|
+
)
|
|
736
|
+
|
|
737
|
+
# For Qwen2.5-VL-3B, float16 will overflow at last block
|
|
738
|
+
# for long visual tokens sequences.
|
|
739
|
+
if hidden_states.dtype == torch.float16:
|
|
740
|
+
hidden_states = cast_overflow_tensors(hidden_states)
|
|
741
|
+
|
|
742
|
+
# adapter
|
|
743
|
+
hidden_states = self.merger(hidden_states)
|
|
744
|
+
reverse_indices = torch.argsort(window_index)
|
|
745
|
+
hidden_states = hidden_states[reverse_indices, :]
|
|
746
|
+
return hidden_states
|
|
747
|
+
|
|
748
|
+
def load_weights(self, weights: Iterable[tuple[str,
|
|
749
|
+
torch.Tensor]]) -> set[str]:
|
|
750
|
+
stacked_params_mapping = [
|
|
751
|
+
# (param_name, shard_name, shard_id)
|
|
752
|
+
("attn.qkv.", "attn.q.", "q"),
|
|
753
|
+
("attn.qkv.", "attn.k.", "k"),
|
|
754
|
+
("attn.qkv.", "attn.v.", "v"),
|
|
755
|
+
]
|
|
756
|
+
params_dict = dict(self.named_parameters(remove_duplicate=False))
|
|
757
|
+
loaded_params: set[str] = set()
|
|
758
|
+
|
|
759
|
+
for name, loaded_weight in weights:
|
|
760
|
+
for (param_name, weight_name, shard_id) in stacked_params_mapping:
|
|
761
|
+
if weight_name not in name:
|
|
762
|
+
continue
|
|
763
|
+
name = name.replace(weight_name, param_name)
|
|
764
|
+
|
|
765
|
+
param = params_dict[name]
|
|
766
|
+
weight_loader = param.weight_loader
|
|
767
|
+
weight_loader(param, loaded_weight, shard_id)
|
|
768
|
+
break
|
|
769
|
+
else:
|
|
770
|
+
param = params_dict[name]
|
|
771
|
+
weight_loader = getattr(param, "weight_loader",
|
|
772
|
+
default_weight_loader)
|
|
773
|
+
weight_loader(param, loaded_weight)
|
|
774
|
+
loaded_params.add(name)
|
|
775
|
+
return loaded_params
|
|
776
|
+
|
|
777
|
+
|
|
778
|
+
class Qwen2_5_VLProcessingInfo(Qwen2VLProcessingInfo):
|
|
779
|
+
|
|
780
|
+
def get_hf_config(self):
|
|
781
|
+
return self.ctx.get_hf_config(Qwen2_5_VLConfig)
|
|
782
|
+
|
|
783
|
+
def get_hf_processor(
|
|
784
|
+
self,
|
|
785
|
+
*,
|
|
786
|
+
min_pixels: Optional[int] = None,
|
|
787
|
+
max_pixels: Optional[int] = None,
|
|
788
|
+
size: Optional[dict[str, int]] = None,
|
|
789
|
+
fps: Optional[Union[float, list[float]]] = None,
|
|
790
|
+
**kwargs: object,
|
|
791
|
+
) -> Qwen2_5_VLProcessor:
|
|
792
|
+
if fps is not None:
|
|
793
|
+
kwargs["fps"] = fps
|
|
794
|
+
|
|
795
|
+
return self.ctx.get_hf_processor(
|
|
796
|
+
Qwen2_5_VLProcessor,
|
|
797
|
+
image_processor=self.get_image_processor(
|
|
798
|
+
min_pixels=min_pixels,
|
|
799
|
+
max_pixels=max_pixels,
|
|
800
|
+
size=size,
|
|
801
|
+
use_fast=kwargs.get("use_fast")),
|
|
802
|
+
**kwargs,
|
|
803
|
+
)
|
|
804
|
+
|
|
805
|
+
|
|
806
|
+
class Qwen2_5_VLMultiModalProcessor(Qwen2VLMultiModalProcessor):
|
|
807
|
+
|
|
808
|
+
def _get_mm_fields_config(
|
|
809
|
+
self,
|
|
810
|
+
hf_inputs: BatchFeature,
|
|
811
|
+
hf_processor_mm_kwargs: Mapping[str, object],
|
|
812
|
+
) -> Mapping[str, MultiModalFieldConfig]:
|
|
813
|
+
return dict(
|
|
814
|
+
**super()._get_mm_fields_config(hf_inputs, hf_processor_mm_kwargs),
|
|
815
|
+
second_per_grid_ts=MultiModalFieldConfig.batched("video"),
|
|
816
|
+
)
|
|
817
|
+
|
|
818
|
+
|
|
819
|
+
@MULTIMODAL_REGISTRY.register_processor(
|
|
820
|
+
Qwen2_5_VLMultiModalProcessor,
|
|
821
|
+
info=Qwen2_5_VLProcessingInfo,
|
|
822
|
+
dummy_inputs=Qwen2_5_VLDummyInputsBuilder)
|
|
823
|
+
class Qwen2_5_VLForConditionalGeneration(nn.Module, SupportsMultiModal,
|
|
824
|
+
SupportsLoRA, SupportsPP):
|
|
825
|
+
|
|
826
|
+
# To ensure correct weight loading and mapping.
|
|
827
|
+
hf_to_vllm_mapper = WeightsMapper(
|
|
828
|
+
orig_to_new_prefix={
|
|
829
|
+
# mapping for new names in checkpoint saved after transformers v4.52
|
|
830
|
+
"model.language_model.": "language_model.model.",
|
|
831
|
+
"model.visual.": "visual.",
|
|
832
|
+
# mapping for original checkpoint
|
|
833
|
+
"lm_head.": "language_model.lm_head.",
|
|
834
|
+
"model.": "language_model.model.",
|
|
835
|
+
})
|
|
836
|
+
|
|
837
|
+
def __init__(self, *, vllm_config: VllmConfig, prefix: str = ""):
|
|
838
|
+
super().__init__()
|
|
839
|
+
config: Qwen2_5_VLConfig = vllm_config.model_config.hf_config
|
|
840
|
+
quant_config = vllm_config.quant_config
|
|
841
|
+
multimodal_config = vllm_config.model_config.multimodal_config
|
|
842
|
+
|
|
843
|
+
self.config = config
|
|
844
|
+
self.multimodal_config = multimodal_config
|
|
845
|
+
|
|
846
|
+
self.visual = Qwen2_5_VisionTransformer(
|
|
847
|
+
config.vision_config,
|
|
848
|
+
norm_eps=getattr(config, "rms_norm_eps", 1e-6),
|
|
849
|
+
quant_config=self._maybe_ignore_quant_config(quant_config),
|
|
850
|
+
prefix=maybe_prefix(prefix, "visual"),
|
|
851
|
+
)
|
|
852
|
+
|
|
853
|
+
self.language_model = init_vllm_registered_model(
|
|
854
|
+
vllm_config=vllm_config,
|
|
855
|
+
prefix=maybe_prefix(prefix, "language_model"),
|
|
856
|
+
architectures=["Qwen2ForCausalLM"],
|
|
857
|
+
)
|
|
858
|
+
|
|
859
|
+
self.make_empty_intermediate_tensors = (
|
|
860
|
+
self.language_model.make_empty_intermediate_tensors)
|
|
861
|
+
|
|
862
|
+
def _maybe_ignore_quant_config(self, quant_config: QuantizationConfig):
|
|
863
|
+
# GPTQ configs do not have a list of ignored modules, however AutoGPTQ
|
|
864
|
+
# seems to avoid vision encoder sections for some models.
|
|
865
|
+
if isinstance(quant_config, (GPTQConfig, GPTQMarlinConfig)):
|
|
866
|
+
return None
|
|
867
|
+
return quant_config
|
|
868
|
+
|
|
869
|
+
def _validate_and_reshape_mm_tensor(self, mm_input: object,
|
|
870
|
+
name: str) -> torch.Tensor:
|
|
871
|
+
if not isinstance(mm_input, (torch.Tensor, list)):
|
|
872
|
+
raise ValueError(f"Incorrect type of {name}. "
|
|
873
|
+
f"Got type: {type(mm_input)}")
|
|
874
|
+
if isinstance(mm_input, torch.Tensor):
|
|
875
|
+
if mm_input.ndim == 2:
|
|
876
|
+
return mm_input
|
|
877
|
+
if mm_input.ndim != 3:
|
|
878
|
+
raise ValueError(f"{name} should be 2D or batched 3D tensor. "
|
|
879
|
+
f"Got ndim: {mm_input.ndim} "
|
|
880
|
+
f"(shape={mm_input.shape})")
|
|
881
|
+
return torch.concat(list(mm_input))
|
|
882
|
+
else:
|
|
883
|
+
return torch.concat(mm_input)
|
|
884
|
+
|
|
885
|
+
def _parse_and_validate_image_input(
|
|
886
|
+
self, **kwargs: object) -> Optional[Qwen2_5_VLImageInputs]:
|
|
887
|
+
pixel_values = kwargs.pop("pixel_values", None)
|
|
888
|
+
image_embeds = kwargs.pop("image_embeds", None)
|
|
889
|
+
image_grid_thw = kwargs.pop("image_grid_thw", None)
|
|
890
|
+
|
|
891
|
+
if pixel_values is None and image_embeds is None:
|
|
892
|
+
return None
|
|
893
|
+
|
|
894
|
+
if pixel_values is not None:
|
|
895
|
+
pixel_values = self._validate_and_reshape_mm_tensor(
|
|
896
|
+
pixel_values, "image pixel values")
|
|
897
|
+
image_grid_thw = self._validate_and_reshape_mm_tensor(
|
|
898
|
+
image_grid_thw, "image grid_thw")
|
|
899
|
+
|
|
900
|
+
if not isinstance(pixel_values, (torch.Tensor, list)):
|
|
901
|
+
raise ValueError("Incorrect type of image pixel values. "
|
|
902
|
+
f"Got type: {type(pixel_values)}")
|
|
903
|
+
|
|
904
|
+
return Qwen2_5_VLImagePixelInputs(type="pixel_values",
|
|
905
|
+
pixel_values=pixel_values,
|
|
906
|
+
image_grid_thw=image_grid_thw)
|
|
907
|
+
|
|
908
|
+
if image_embeds is not None:
|
|
909
|
+
image_embeds = self._validate_and_reshape_mm_tensor(
|
|
910
|
+
image_embeds, "image embeds")
|
|
911
|
+
image_grid_thw = self._validate_and_reshape_mm_tensor(
|
|
912
|
+
image_grid_thw, "image grid_thw")
|
|
913
|
+
|
|
914
|
+
if not isinstance(image_embeds, torch.Tensor):
|
|
915
|
+
raise ValueError("Incorrect type of image embeddings. "
|
|
916
|
+
f"Got type: {type(image_embeds)}")
|
|
917
|
+
return Qwen2_5_VLImageEmbeddingInputs(
|
|
918
|
+
type="image_embeds",
|
|
919
|
+
image_embeds=image_embeds,
|
|
920
|
+
image_grid_thw=image_grid_thw)
|
|
921
|
+
|
|
922
|
+
def _parse_and_validate_video_input(
|
|
923
|
+
self, **kwargs: object) -> Optional[Qwen2_5_VLVideoInputs]:
|
|
924
|
+
pixel_values_videos = kwargs.pop("pixel_values_videos", None)
|
|
925
|
+
video_embeds = kwargs.pop("video_embeds", None)
|
|
926
|
+
video_grid_thw = kwargs.pop("video_grid_thw", None)
|
|
927
|
+
second_per_grid_ts = kwargs.pop("second_per_grid_ts", None)
|
|
928
|
+
|
|
929
|
+
if pixel_values_videos is None and video_embeds is None:
|
|
930
|
+
return None
|
|
931
|
+
|
|
932
|
+
if pixel_values_videos is not None:
|
|
933
|
+
pixel_values_videos = self._validate_and_reshape_mm_tensor(
|
|
934
|
+
pixel_values_videos, "video pixel values")
|
|
935
|
+
video_grid_thw = self._validate_and_reshape_mm_tensor(
|
|
936
|
+
video_grid_thw, "video grid_thw")
|
|
937
|
+
|
|
938
|
+
return Qwen2_5_VLVideoPixelInputs(
|
|
939
|
+
type="pixel_values_videos",
|
|
940
|
+
pixel_values_videos=pixel_values_videos,
|
|
941
|
+
video_grid_thw=video_grid_thw,
|
|
942
|
+
second_per_grid_ts=second_per_grid_ts,
|
|
943
|
+
)
|
|
944
|
+
|
|
945
|
+
if video_embeds is not None:
|
|
946
|
+
video_embeds = self._validate_and_reshape_mm_tensor(
|
|
947
|
+
video_embeds, "video embeds")
|
|
948
|
+
video_grid_thw = self._validate_and_reshape_mm_tensor(
|
|
949
|
+
video_grid_thw, "video grid_thw")
|
|
950
|
+
|
|
951
|
+
if not isinstance(video_embeds, torch.Tensor):
|
|
952
|
+
raise ValueError("Incorrect type of video embeddings. "
|
|
953
|
+
f"Got type: {type(video_embeds)}")
|
|
954
|
+
return Qwen2_5_VLVideoEmbeddingInputs(
|
|
955
|
+
type="video_embeds",
|
|
956
|
+
video_embeds=video_embeds,
|
|
957
|
+
video_grid_thw=video_grid_thw)
|
|
958
|
+
|
|
959
|
+
def _process_image_input(
|
|
960
|
+
self,
|
|
961
|
+
image_input: Qwen2_5_VLImageInputs) -> tuple[torch.Tensor, ...]:
|
|
962
|
+
|
|
963
|
+
grid_thw = image_input["image_grid_thw"]
|
|
964
|
+
assert grid_thw.ndim == 2
|
|
965
|
+
grid_thw_list = grid_thw.tolist()
|
|
966
|
+
|
|
967
|
+
if image_input["type"] == "image_embeds":
|
|
968
|
+
image_embeds = image_input["image_embeds"].type(self.visual.dtype)
|
|
969
|
+
else:
|
|
970
|
+
pixel_values = image_input["pixel_values"].type(self.visual.dtype)
|
|
971
|
+
image_embeds = self.visual(pixel_values, grid_thw=grid_thw_list)
|
|
972
|
+
|
|
973
|
+
# Split concatenated embeddings for each image item.
|
|
974
|
+
merge_size = self.visual.spatial_merge_size
|
|
975
|
+
sizes = grid_thw.prod(-1) // merge_size // merge_size
|
|
976
|
+
|
|
977
|
+
return image_embeds.split(sizes.tolist())
|
|
978
|
+
|
|
979
|
+
def _process_video_input(
|
|
980
|
+
self,
|
|
981
|
+
video_input: Qwen2_5_VLVideoInputs) -> tuple[torch.Tensor, ...]:
|
|
982
|
+
|
|
983
|
+
grid_thw = video_input["video_grid_thw"]
|
|
984
|
+
assert grid_thw.ndim == 2
|
|
985
|
+
grid_thw_list = grid_thw.tolist()
|
|
986
|
+
|
|
987
|
+
if video_input["type"] == "video_embeds":
|
|
988
|
+
video_embeds = video_input["video_embeds"].type(self.visual.dtype)
|
|
989
|
+
else:
|
|
990
|
+
pixel_values_videos = video_input["pixel_values_videos"].type(
|
|
991
|
+
self.visual.dtype)
|
|
992
|
+
video_embeds = self.visual(pixel_values_videos,
|
|
993
|
+
grid_thw=grid_thw_list)
|
|
994
|
+
|
|
995
|
+
# Split concatenated embeddings for each video item.
|
|
996
|
+
merge_size = self.visual.spatial_merge_size
|
|
997
|
+
sizes = grid_thw.prod(-1) // merge_size // merge_size
|
|
998
|
+
|
|
999
|
+
return video_embeds.split(sizes.tolist())
|
|
1000
|
+
|
|
1001
|
+
def _parse_and_validate_multimodal_inputs(self, **kwargs: object) -> dict:
|
|
1002
|
+
mm_input_by_modality = {}
|
|
1003
|
+
|
|
1004
|
+
# Preserve the order of modalities if there are multiple of them
|
|
1005
|
+
# from the order of kwargs.
|
|
1006
|
+
for input_key in kwargs:
|
|
1007
|
+
if input_key in ("pixel_values", "image_embeds"
|
|
1008
|
+
) and "image" not in mm_input_by_modality:
|
|
1009
|
+
mm_input_by_modality[
|
|
1010
|
+
"image"] = self._parse_and_validate_image_input(**kwargs)
|
|
1011
|
+
if input_key in ("pixel_values_videos", "video_embeds"
|
|
1012
|
+
) and "video" not in mm_input_by_modality:
|
|
1013
|
+
mm_input_by_modality[
|
|
1014
|
+
"video"] = self._parse_and_validate_video_input(**kwargs)
|
|
1015
|
+
return mm_input_by_modality
|
|
1016
|
+
|
|
1017
|
+
def get_language_model(self) -> torch.nn.Module:
|
|
1018
|
+
return self.language_model
|
|
1019
|
+
|
|
1020
|
+
def get_multimodal_embeddings(
|
|
1021
|
+
self, **kwargs: object) -> Optional[MultiModalEmbeddings]:
|
|
1022
|
+
|
|
1023
|
+
mm_input_by_modality = self._parse_and_validate_multimodal_inputs(
|
|
1024
|
+
**kwargs)
|
|
1025
|
+
if not mm_input_by_modality:
|
|
1026
|
+
return None
|
|
1027
|
+
|
|
1028
|
+
# The result multimodal_embeddings is tuple of tensors, with each
|
|
1029
|
+
# tensor correspoending to a multimodal data item (image or video).
|
|
1030
|
+
multimodal_embeddings: tuple[torch.Tensor, ...] = ()
|
|
1031
|
+
|
|
1032
|
+
# NOTE: It is important to iterate over the keys in this dictionary
|
|
1033
|
+
# to preserve the order of the modalities.
|
|
1034
|
+
for modality in mm_input_by_modality:
|
|
1035
|
+
multimodal_input = mm_input_by_modality[modality]
|
|
1036
|
+
if modality == "image":
|
|
1037
|
+
vision_embeddings = self._process_image_input(multimodal_input)
|
|
1038
|
+
multimodal_embeddings += vision_embeddings
|
|
1039
|
+
if modality == "video":
|
|
1040
|
+
video_embeddings = self._process_video_input(multimodal_input)
|
|
1041
|
+
multimodal_embeddings += video_embeddings
|
|
1042
|
+
return multimodal_embeddings
|
|
1043
|
+
|
|
1044
|
+
def get_input_embeddings(
|
|
1045
|
+
self,
|
|
1046
|
+
input_ids: torch.Tensor,
|
|
1047
|
+
multimodal_embeddings: Optional[MultiModalEmbeddings] = None,
|
|
1048
|
+
) -> torch.Tensor:
|
|
1049
|
+
inputs_embeds = self.language_model.get_input_embeddings(input_ids)
|
|
1050
|
+
if multimodal_embeddings is not None:
|
|
1051
|
+
inputs_embeds = merge_multimodal_embeddings(
|
|
1052
|
+
input_ids, inputs_embeds, multimodal_embeddings,
|
|
1053
|
+
[self.config.image_token_id, self.config.video_token_id])
|
|
1054
|
+
return inputs_embeds
|
|
1055
|
+
|
|
1056
|
+
def get_input_embeddings_v0(
|
|
1057
|
+
self,
|
|
1058
|
+
input_ids: torch.Tensor,
|
|
1059
|
+
image_input: Optional[Qwen2_5_VLImageInputs] = None,
|
|
1060
|
+
video_input: Optional[Qwen2_5_VLVideoInputs] = None,
|
|
1061
|
+
) -> torch.Tensor:
|
|
1062
|
+
inputs_embeds = self.get_input_embeddings(input_ids)
|
|
1063
|
+
if image_input is not None:
|
|
1064
|
+
image_embeds = self._process_image_input(image_input)
|
|
1065
|
+
inputs_embeds = merge_multimodal_embeddings(
|
|
1066
|
+
input_ids,
|
|
1067
|
+
inputs_embeds,
|
|
1068
|
+
image_embeds,
|
|
1069
|
+
placeholder_token_id=self.config.image_token_id,
|
|
1070
|
+
)
|
|
1071
|
+
|
|
1072
|
+
if video_input is not None:
|
|
1073
|
+
video_embeds = self._process_video_input(video_input)
|
|
1074
|
+
inputs_embeds = merge_multimodal_embeddings(
|
|
1075
|
+
input_ids,
|
|
1076
|
+
inputs_embeds,
|
|
1077
|
+
video_embeds,
|
|
1078
|
+
placeholder_token_id=self.config.video_token_id,
|
|
1079
|
+
)
|
|
1080
|
+
return inputs_embeds
|
|
1081
|
+
|
|
1082
|
+
def forward(
|
|
1083
|
+
self,
|
|
1084
|
+
input_ids: torch.Tensor,
|
|
1085
|
+
positions: torch.Tensor,
|
|
1086
|
+
intermediate_tensors: Optional[IntermediateTensors] = None,
|
|
1087
|
+
inputs_embeds: Optional[torch.Tensor] = None,
|
|
1088
|
+
**kwargs: object,
|
|
1089
|
+
) -> Union[torch.Tensor, IntermediateTensors]:
|
|
1090
|
+
"""Run forward pass for Qwen2.5-VL.
|
|
1091
|
+
|
|
1092
|
+
Args:
|
|
1093
|
+
input_ids: Flattened (concatenated) input_ids corresponding to a
|
|
1094
|
+
batch.
|
|
1095
|
+
positions: Flattened (concatenated) position ids corresponding to a
|
|
1096
|
+
batch.
|
|
1097
|
+
**NOTE**: If mrope is enabled (default setting for Qwen2.5-VL
|
|
1098
|
+
opensource models), the shape will be `(3, seq_len)`,
|
|
1099
|
+
otherwise it will be `(seq_len,).
|
|
1100
|
+
pixel_values: Pixel values to be fed to a model.
|
|
1101
|
+
`None` if no images are passed.
|
|
1102
|
+
image_grid_thw: Tensor `(n_images, 3)` of image 3D grid in LLM.
|
|
1103
|
+
`None` if no images are passed.
|
|
1104
|
+
pixel_values_videos: Pixel values of videos to be fed to a model.
|
|
1105
|
+
`None` if no videos are passed.
|
|
1106
|
+
video_grid_thw: Tensor `(n_videos, 3)` of video 3D grid in LLM.
|
|
1107
|
+
`None` if no videos are passed.
|
|
1108
|
+
second_per_grid_ts: Tensor `(num_videos)` of video time interval (
|
|
1109
|
+
in seconds) for each grid along the temporal dimension in the
|
|
1110
|
+
3D position IDs. `None` if no videos are passed.
|
|
1111
|
+
"""
|
|
1112
|
+
|
|
1113
|
+
if intermediate_tensors is not None:
|
|
1114
|
+
inputs_embeds = None
|
|
1115
|
+
|
|
1116
|
+
# NOTE: In v1, inputs_embeds is always generated at model runner from
|
|
1117
|
+
# `get_multimodal_embeddings` and `get_input_embeddings`, this
|
|
1118
|
+
# condition is only for v0 compatibility.
|
|
1119
|
+
elif inputs_embeds is None:
|
|
1120
|
+
image_input = self._parse_and_validate_image_input(**kwargs)
|
|
1121
|
+
video_input = self._parse_and_validate_video_input(**kwargs)
|
|
1122
|
+
|
|
1123
|
+
if image_input is None and video_input is None:
|
|
1124
|
+
inputs_embeds = None
|
|
1125
|
+
else:
|
|
1126
|
+
if uses_mrope(self.config):
|
|
1127
|
+
assert positions.ndim == 2 and positions.size(0) == 3, (
|
|
1128
|
+
"multimodal section rotary embedding requires "
|
|
1129
|
+
f"(3, seq_len) positions, but got {positions.size()}")
|
|
1130
|
+
inputs_embeds = self.get_input_embeddings_v0(
|
|
1131
|
+
input_ids,
|
|
1132
|
+
image_input=image_input,
|
|
1133
|
+
video_input=video_input)
|
|
1134
|
+
input_ids = None
|
|
1135
|
+
|
|
1136
|
+
hidden_states = self.language_model.model(
|
|
1137
|
+
input_ids=input_ids,
|
|
1138
|
+
positions=positions,
|
|
1139
|
+
intermediate_tensors=intermediate_tensors,
|
|
1140
|
+
inputs_embeds=inputs_embeds,
|
|
1141
|
+
)
|
|
1142
|
+
return hidden_states
|
|
1143
|
+
|
|
1144
|
+
def compute_logits(
|
|
1145
|
+
self,
|
|
1146
|
+
hidden_states: torch.Tensor,
|
|
1147
|
+
sampling_metadata: SamplingMetadata,
|
|
1148
|
+
) -> Optional[torch.Tensor]:
|
|
1149
|
+
return self.language_model.compute_logits(hidden_states,
|
|
1150
|
+
sampling_metadata)
|
|
1151
|
+
|
|
1152
|
+
def load_weights(self, weights: Iterable[tuple[str,
|
|
1153
|
+
torch.Tensor]]) -> set[str]:
|
|
1154
|
+
|
|
1155
|
+
loader = AutoWeightsLoader(self)
|
|
1156
|
+
return loader.load_weights(weights, mapper=self.hf_to_vllm_mapper)
|
|
1157
|
+
|
|
1158
|
+
def get_mm_mapping(self) -> MultiModelKeys:
|
|
1159
|
+
"""
|
|
1160
|
+
Get the module prefix in multimodal models
|
|
1161
|
+
"""
|
|
1162
|
+
return MultiModelKeys.from_string_field(
|
|
1163
|
+
language_model="language_model",
|
|
1164
|
+
connector="visual.merger.",
|
|
1165
|
+
tower_model="visual.",
|
|
1166
|
+
)
|