vllm-cpu-amxbf16 0.11.2.post2__cp310-cp310-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 +225 -0
- vllm/_aiter_ops.py +983 -0
- vllm/_bc_linter.py +54 -0
- vllm/_custom_ops.py +2863 -0
- vllm/_ipex_ops.py +457 -0
- vllm/_version.py +34 -0
- vllm/assets/__init__.py +0 -0
- vllm/assets/audio.py +43 -0
- vllm/assets/base.py +40 -0
- vllm/assets/image.py +59 -0
- vllm/assets/video.py +149 -0
- vllm/attention/__init__.py +18 -0
- vllm/attention/backends/__init__.py +0 -0
- vllm/attention/backends/abstract.py +391 -0
- vllm/attention/backends/registry.py +195 -0
- vllm/attention/backends/utils.py +33 -0
- vllm/attention/layer.py +1052 -0
- vllm/attention/layers/__init__.py +0 -0
- vllm/attention/layers/chunked_local_attention.py +121 -0
- vllm/attention/layers/cross_attention.py +178 -0
- vllm/attention/layers/encoder_only_attention.py +103 -0
- vllm/attention/ops/__init__.py +0 -0
- vllm/attention/ops/chunked_prefill_paged_decode.py +401 -0
- vllm/attention/ops/common.py +414 -0
- vllm/attention/ops/flashmla.py +251 -0
- vllm/attention/ops/merge_attn_states.py +47 -0
- vllm/attention/ops/paged_attn.py +262 -0
- vllm/attention/ops/pallas_kv_cache_update.py +130 -0
- vllm/attention/ops/prefix_prefill.py +814 -0
- vllm/attention/ops/rocm_aiter_paged_attn.py +123 -0
- vllm/attention/ops/triton_decode_attention.py +712 -0
- vllm/attention/ops/triton_merge_attn_states.py +105 -0
- vllm/attention/ops/triton_reshape_and_cache_flash.py +184 -0
- vllm/attention/ops/triton_unified_attention.py +941 -0
- vllm/attention/ops/vit_attn_wrappers.py +178 -0
- vllm/attention/selector.py +231 -0
- vllm/attention/utils/__init__.py +0 -0
- vllm/attention/utils/fa_utils.py +109 -0
- vllm/attention/utils/kv_sharing_utils.py +33 -0
- vllm/attention/utils/kv_transfer_utils.py +60 -0
- vllm/beam_search.py +88 -0
- vllm/benchmarks/__init__.py +0 -0
- vllm/benchmarks/datasets.py +3222 -0
- vllm/benchmarks/latency.py +172 -0
- vllm/benchmarks/lib/__init__.py +3 -0
- vllm/benchmarks/lib/endpoint_request_func.py +777 -0
- vllm/benchmarks/lib/ready_checker.py +72 -0
- vllm/benchmarks/lib/utils.py +79 -0
- vllm/benchmarks/serve.py +1531 -0
- vllm/benchmarks/sweep/__init__.py +0 -0
- vllm/benchmarks/sweep/cli.py +38 -0
- vllm/benchmarks/sweep/param_sweep.py +91 -0
- vllm/benchmarks/sweep/plot.py +580 -0
- vllm/benchmarks/sweep/serve.py +416 -0
- vllm/benchmarks/sweep/serve_sla.py +492 -0
- vllm/benchmarks/sweep/server.py +114 -0
- vllm/benchmarks/sweep/sla_sweep.py +132 -0
- vllm/benchmarks/sweep/utils.py +4 -0
- vllm/benchmarks/throughput.py +799 -0
- vllm/collect_env.py +857 -0
- vllm/compilation/__init__.py +0 -0
- vllm/compilation/activation_quant_fusion.py +209 -0
- vllm/compilation/backends.py +759 -0
- vllm/compilation/base_static_graph.py +57 -0
- vllm/compilation/caching.py +178 -0
- vllm/compilation/collective_fusion.py +1234 -0
- vllm/compilation/compiler_interface.py +639 -0
- vllm/compilation/counter.py +48 -0
- vllm/compilation/cuda_graph.py +208 -0
- vllm/compilation/decorators.py +571 -0
- vllm/compilation/fix_functionalization.py +253 -0
- vllm/compilation/fusion.py +374 -0
- vllm/compilation/fusion_attn.py +359 -0
- vllm/compilation/fx_utils.py +91 -0
- vllm/compilation/inductor_pass.py +133 -0
- vllm/compilation/matcher_utils.py +317 -0
- vllm/compilation/monitor.py +62 -0
- vllm/compilation/noop_elimination.py +134 -0
- vllm/compilation/partition_rules.py +72 -0
- vllm/compilation/pass_manager.py +135 -0
- vllm/compilation/piecewise_backend.py +121 -0
- vllm/compilation/post_cleanup.py +21 -0
- vllm/compilation/qk_norm_rope_fusion.py +238 -0
- vllm/compilation/sequence_parallelism.py +363 -0
- vllm/compilation/torch25_custom_graph_pass.py +44 -0
- vllm/compilation/vllm_inductor_pass.py +173 -0
- vllm/compilation/wrapper.py +238 -0
- vllm/config/__init__.py +102 -0
- vllm/config/cache.py +207 -0
- vllm/config/compilation.py +975 -0
- vllm/config/device.py +75 -0
- vllm/config/ec_transfer.py +110 -0
- vllm/config/kv_events.py +56 -0
- vllm/config/kv_transfer.py +114 -0
- vllm/config/load.py +124 -0
- vllm/config/lora.py +112 -0
- vllm/config/model.py +2162 -0
- vllm/config/multimodal.py +248 -0
- vllm/config/observability.py +123 -0
- vllm/config/parallel.py +655 -0
- vllm/config/pooler.py +122 -0
- vllm/config/scheduler.py +298 -0
- vllm/config/speculative.py +654 -0
- vllm/config/speech_to_text.py +38 -0
- vllm/config/structured_outputs.py +92 -0
- vllm/config/utils.py +178 -0
- vllm/config/vllm.py +1166 -0
- vllm/connections.py +189 -0
- vllm/device_allocator/__init__.py +0 -0
- vllm/device_allocator/cumem.py +327 -0
- vllm/distributed/__init__.py +6 -0
- vllm/distributed/communication_op.py +43 -0
- vllm/distributed/device_communicators/__init__.py +0 -0
- vllm/distributed/device_communicators/all2all.py +490 -0
- vllm/distributed/device_communicators/all_reduce_utils.py +344 -0
- vllm/distributed/device_communicators/base_device_communicator.py +297 -0
- vllm/distributed/device_communicators/cpu_communicator.py +209 -0
- vllm/distributed/device_communicators/cuda_communicator.py +340 -0
- vllm/distributed/device_communicators/cuda_wrapper.py +216 -0
- vllm/distributed/device_communicators/custom_all_reduce.py +326 -0
- vllm/distributed/device_communicators/mnnvl_compat.py +27 -0
- vllm/distributed/device_communicators/pynccl.py +386 -0
- vllm/distributed/device_communicators/pynccl_allocator.py +191 -0
- vllm/distributed/device_communicators/pynccl_wrapper.py +564 -0
- vllm/distributed/device_communicators/quick_all_reduce.py +290 -0
- vllm/distributed/device_communicators/ray_communicator.py +259 -0
- vllm/distributed/device_communicators/shm_broadcast.py +733 -0
- vllm/distributed/device_communicators/shm_object_storage.py +660 -0
- vllm/distributed/device_communicators/symm_mem.py +156 -0
- vllm/distributed/device_communicators/tpu_communicator.py +107 -0
- vllm/distributed/device_communicators/xpu_communicator.py +95 -0
- vllm/distributed/ec_transfer/__init__.py +14 -0
- vllm/distributed/ec_transfer/ec_connector/__init__.py +0 -0
- vllm/distributed/ec_transfer/ec_connector/base.py +247 -0
- vllm/distributed/ec_transfer/ec_connector/factory.py +88 -0
- vllm/distributed/ec_transfer/ec_connector/shared_storage_connector.py +201 -0
- vllm/distributed/ec_transfer/ec_transfer_state.py +42 -0
- vllm/distributed/eplb/__init__.py +8 -0
- vllm/distributed/eplb/eplb_state.py +837 -0
- vllm/distributed/eplb/rebalance_algo.py +260 -0
- vllm/distributed/eplb/rebalance_execute.py +431 -0
- vllm/distributed/kv_events.py +371 -0
- vllm/distributed/kv_transfer/README.md +29 -0
- vllm/distributed/kv_transfer/__init__.py +20 -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 +10 -0
- vllm/distributed/kv_transfer/kv_connector/factory.py +192 -0
- vllm/distributed/kv_transfer/kv_connector/utils.py +268 -0
- vllm/distributed/kv_transfer/kv_connector/v1/__init__.py +19 -0
- vllm/distributed/kv_transfer/kv_connector/v1/base.py +546 -0
- vllm/distributed/kv_transfer/kv_connector/v1/decode_bench_connector.py +419 -0
- vllm/distributed/kv_transfer/kv_connector/v1/lmcache_connector.py +216 -0
- vllm/distributed/kv_transfer/kv_connector/v1/lmcache_integration/__init__.py +18 -0
- vllm/distributed/kv_transfer/kv_connector/v1/lmcache_integration/multi_process_adapter.py +379 -0
- vllm/distributed/kv_transfer/kv_connector/v1/lmcache_integration/utils.py +221 -0
- vllm/distributed/kv_transfer/kv_connector/v1/lmcache_integration/vllm_v1_adapter.py +1411 -0
- vllm/distributed/kv_transfer/kv_connector/v1/lmcache_mp_connector.py +867 -0
- vllm/distributed/kv_transfer/kv_connector/v1/metrics.py +189 -0
- vllm/distributed/kv_transfer/kv_connector/v1/multi_connector.py +454 -0
- vllm/distributed/kv_transfer/kv_connector/v1/nixl_connector.py +2440 -0
- vllm/distributed/kv_transfer/kv_connector/v1/offloading_connector.py +504 -0
- vllm/distributed/kv_transfer/kv_connector/v1/p2p/__init__.py +0 -0
- vllm/distributed/kv_transfer/kv_connector/v1/p2p/p2p_nccl_connector.py +531 -0
- vllm/distributed/kv_transfer/kv_connector/v1/p2p/p2p_nccl_engine.py +632 -0
- vllm/distributed/kv_transfer/kv_connector/v1/p2p/tensor_memory_pool.py +273 -0
- vllm/distributed/kv_transfer/kv_connector/v1/shared_storage_connector.py +450 -0
- vllm/distributed/kv_transfer/kv_lookup_buffer/__init__.py +0 -0
- vllm/distributed/kv_transfer/kv_lookup_buffer/base.py +179 -0
- vllm/distributed/kv_transfer/kv_lookup_buffer/mooncake_store.py +164 -0
- vllm/distributed/kv_transfer/kv_lookup_buffer/simple_buffer.py +242 -0
- vllm/distributed/kv_transfer/kv_pipe/__init__.py +0 -0
- vllm/distributed/kv_transfer/kv_pipe/base.py +66 -0
- vllm/distributed/kv_transfer/kv_pipe/mooncake_pipe.py +295 -0
- vllm/distributed/kv_transfer/kv_pipe/pynccl_pipe.py +285 -0
- vllm/distributed/kv_transfer/kv_transfer_state.py +78 -0
- vllm/distributed/parallel_state.py +1759 -0
- vllm/distributed/tpu_distributed_utils.py +188 -0
- vllm/distributed/utils.py +543 -0
- vllm/engine/__init__.py +0 -0
- vllm/engine/arg_utils.py +2144 -0
- vllm/engine/async_llm_engine.py +6 -0
- vllm/engine/llm_engine.py +6 -0
- vllm/engine/protocol.py +170 -0
- vllm/entrypoints/__init__.py +0 -0
- vllm/entrypoints/anthropic/__init__.py +0 -0
- vllm/entrypoints/anthropic/protocol.py +162 -0
- vllm/entrypoints/anthropic/serving_messages.py +460 -0
- vllm/entrypoints/api_server.py +184 -0
- vllm/entrypoints/chat_utils.py +1690 -0
- vllm/entrypoints/cli/__init__.py +13 -0
- vllm/entrypoints/cli/benchmark/__init__.py +0 -0
- vllm/entrypoints/cli/benchmark/base.py +25 -0
- vllm/entrypoints/cli/benchmark/latency.py +21 -0
- vllm/entrypoints/cli/benchmark/main.py +56 -0
- vllm/entrypoints/cli/benchmark/serve.py +21 -0
- vllm/entrypoints/cli/benchmark/sweep.py +21 -0
- vllm/entrypoints/cli/benchmark/throughput.py +21 -0
- vllm/entrypoints/cli/collect_env.py +38 -0
- vllm/entrypoints/cli/main.py +79 -0
- vllm/entrypoints/cli/openai.py +256 -0
- vllm/entrypoints/cli/run_batch.py +68 -0
- vllm/entrypoints/cli/serve.py +249 -0
- vllm/entrypoints/cli/types.py +29 -0
- vllm/entrypoints/constants.py +10 -0
- vllm/entrypoints/context.py +572 -0
- vllm/entrypoints/dynamic_lora.py +57 -0
- vllm/entrypoints/harmony_utils.py +535 -0
- vllm/entrypoints/launcher.py +175 -0
- vllm/entrypoints/llm.py +1768 -0
- vllm/entrypoints/logger.py +84 -0
- vllm/entrypoints/openai/__init__.py +0 -0
- vllm/entrypoints/openai/api_server.py +2096 -0
- vllm/entrypoints/openai/cli_args.py +302 -0
- vllm/entrypoints/openai/orca_metrics.py +120 -0
- vllm/entrypoints/openai/protocol.py +3299 -0
- vllm/entrypoints/openai/run_batch.py +547 -0
- vllm/entrypoints/openai/serving_chat.py +1772 -0
- vllm/entrypoints/openai/serving_classification.py +235 -0
- vllm/entrypoints/openai/serving_completion.py +715 -0
- vllm/entrypoints/openai/serving_embedding.py +695 -0
- vllm/entrypoints/openai/serving_engine.py +1433 -0
- vllm/entrypoints/openai/serving_models.py +304 -0
- vllm/entrypoints/openai/serving_pooling.py +346 -0
- vllm/entrypoints/openai/serving_responses.py +2021 -0
- vllm/entrypoints/openai/serving_score.py +503 -0
- vllm/entrypoints/openai/serving_tokenization.py +203 -0
- vllm/entrypoints/openai/serving_tokens.py +269 -0
- vllm/entrypoints/openai/serving_transcription.py +148 -0
- vllm/entrypoints/openai/speech_to_text.py +405 -0
- vllm/entrypoints/openai/tool_parsers/__init__.py +142 -0
- vllm/entrypoints/openai/tool_parsers/abstract_tool_parser.py +273 -0
- vllm/entrypoints/openai/tool_parsers/deepseekv31_tool_parser.py +390 -0
- vllm/entrypoints/openai/tool_parsers/deepseekv3_tool_parser.py +390 -0
- vllm/entrypoints/openai/tool_parsers/ernie45_tool_parser.py +210 -0
- vllm/entrypoints/openai/tool_parsers/glm4_moe_tool_parser.py +200 -0
- vllm/entrypoints/openai/tool_parsers/granite_20b_fc_tool_parser.py +273 -0
- vllm/entrypoints/openai/tool_parsers/granite_tool_parser.py +253 -0
- vllm/entrypoints/openai/tool_parsers/hermes_tool_parser.py +494 -0
- vllm/entrypoints/openai/tool_parsers/hunyuan_a13b_tool_parser.py +420 -0
- vllm/entrypoints/openai/tool_parsers/internlm2_tool_parser.py +227 -0
- vllm/entrypoints/openai/tool_parsers/jamba_tool_parser.py +323 -0
- vllm/entrypoints/openai/tool_parsers/kimi_k2_tool_parser.py +590 -0
- vllm/entrypoints/openai/tool_parsers/llama4_pythonic_tool_parser.py +341 -0
- vllm/entrypoints/openai/tool_parsers/llama_tool_parser.py +290 -0
- vllm/entrypoints/openai/tool_parsers/longcat_tool_parser.py +37 -0
- vllm/entrypoints/openai/tool_parsers/minimax_m2_tool_parser.py +643 -0
- vllm/entrypoints/openai/tool_parsers/minimax_tool_parser.py +849 -0
- vllm/entrypoints/openai/tool_parsers/mistral_tool_parser.py +390 -0
- vllm/entrypoints/openai/tool_parsers/olmo3_tool_parser.py +366 -0
- vllm/entrypoints/openai/tool_parsers/openai_tool_parser.py +97 -0
- vllm/entrypoints/openai/tool_parsers/phi4mini_tool_parser.py +120 -0
- vllm/entrypoints/openai/tool_parsers/pythonic_tool_parser.py +332 -0
- vllm/entrypoints/openai/tool_parsers/qwen3coder_tool_parser.py +781 -0
- vllm/entrypoints/openai/tool_parsers/qwen3xml_tool_parser.py +1316 -0
- vllm/entrypoints/openai/tool_parsers/seed_oss_tool_parser.py +744 -0
- vllm/entrypoints/openai/tool_parsers/step3_tool_parser.py +303 -0
- vllm/entrypoints/openai/tool_parsers/utils.py +229 -0
- vllm/entrypoints/openai/tool_parsers/xlam_tool_parser.py +556 -0
- vllm/entrypoints/renderer.py +409 -0
- vllm/entrypoints/responses_utils.py +77 -0
- vllm/entrypoints/sagemaker/__init__.py +4 -0
- vllm/entrypoints/sagemaker/routes.py +72 -0
- vllm/entrypoints/score_utils.py +242 -0
- vllm/entrypoints/ssl.py +78 -0
- vllm/entrypoints/tool.py +143 -0
- vllm/entrypoints/tool_server.py +209 -0
- vllm/entrypoints/utils.py +319 -0
- vllm/env_override.py +378 -0
- vllm/envs.py +1659 -0
- vllm/forward_context.py +356 -0
- vllm/inputs/__init__.py +44 -0
- vllm/inputs/data.py +359 -0
- vllm/inputs/parse.py +137 -0
- vllm/inputs/preprocess.py +727 -0
- vllm/logger.py +267 -0
- vllm/logging_utils/__init__.py +10 -0
- vllm/logging_utils/dump_input.py +83 -0
- vllm/logging_utils/formatter.py +77 -0
- vllm/logging_utils/log_time.py +34 -0
- vllm/logits_process.py +121 -0
- vllm/logprobs.py +208 -0
- vllm/lora/__init__.py +0 -0
- vllm/lora/layers/__init__.py +41 -0
- vllm/lora/layers/base.py +67 -0
- vllm/lora/layers/base_linear.py +164 -0
- vllm/lora/layers/column_parallel_linear.py +578 -0
- vllm/lora/layers/fused_moe.py +472 -0
- vllm/lora/layers/logits_processor.py +252 -0
- vllm/lora/layers/replicated_linear.py +70 -0
- vllm/lora/layers/row_parallel_linear.py +181 -0
- vllm/lora/layers/utils.py +65 -0
- vllm/lora/layers/vocal_parallel_embedding.py +166 -0
- vllm/lora/lora_weights.py +198 -0
- vllm/lora/models.py +890 -0
- vllm/lora/ops/__init__.py +0 -0
- vllm/lora/ops/ipex_ops/__init__.py +6 -0
- vllm/lora/ops/ipex_ops/lora_ops.py +57 -0
- vllm/lora/ops/torch_ops/__init__.py +20 -0
- vllm/lora/ops/torch_ops/lora_ops.py +128 -0
- vllm/lora/ops/triton_ops/README_TUNING.md +60 -0
- vllm/lora/ops/triton_ops/__init__.py +21 -0
- vllm/lora/ops/triton_ops/fused_moe_lora_op.py +641 -0
- vllm/lora/ops/triton_ops/kernel_utils.py +340 -0
- vllm/lora/ops/triton_ops/lora_expand_op.py +310 -0
- vllm/lora/ops/triton_ops/lora_kernel_metadata.py +154 -0
- vllm/lora/ops/triton_ops/lora_shrink_op.py +287 -0
- vllm/lora/ops/triton_ops/utils.py +295 -0
- vllm/lora/ops/xla_ops/__init__.py +6 -0
- vllm/lora/ops/xla_ops/lora_ops.py +141 -0
- vllm/lora/peft_helper.py +128 -0
- vllm/lora/punica_wrapper/__init__.py +10 -0
- vllm/lora/punica_wrapper/punica_base.py +492 -0
- vllm/lora/punica_wrapper/punica_cpu.py +351 -0
- vllm/lora/punica_wrapper/punica_gpu.py +411 -0
- vllm/lora/punica_wrapper/punica_selector.py +21 -0
- vllm/lora/punica_wrapper/punica_tpu.py +359 -0
- vllm/lora/punica_wrapper/punica_xpu.py +279 -0
- vllm/lora/punica_wrapper/utils.py +150 -0
- vllm/lora/request.py +100 -0
- vllm/lora/resolver.py +88 -0
- vllm/lora/utils.py +293 -0
- vllm/lora/worker_manager.py +279 -0
- vllm/model_executor/__init__.py +11 -0
- vllm/model_executor/custom_op.py +194 -0
- vllm/model_executor/layers/__init__.py +0 -0
- vllm/model_executor/layers/activation.py +569 -0
- vllm/model_executor/layers/attention_layer_base.py +35 -0
- vllm/model_executor/layers/batch_invariant.py +854 -0
- vllm/model_executor/layers/conv.py +236 -0
- vllm/model_executor/layers/fla/__init__.py +8 -0
- vllm/model_executor/layers/fla/ops/__init__.py +17 -0
- vllm/model_executor/layers/fla/ops/chunk.py +240 -0
- vllm/model_executor/layers/fla/ops/chunk_delta_h.py +344 -0
- vllm/model_executor/layers/fla/ops/chunk_o.py +183 -0
- vllm/model_executor/layers/fla/ops/chunk_scaled_dot_kkt.py +154 -0
- vllm/model_executor/layers/fla/ops/cumsum.py +280 -0
- vllm/model_executor/layers/fla/ops/fused_recurrent.py +390 -0
- vllm/model_executor/layers/fla/ops/index.py +41 -0
- vllm/model_executor/layers/fla/ops/kda.py +1351 -0
- vllm/model_executor/layers/fla/ops/l2norm.py +146 -0
- vllm/model_executor/layers/fla/ops/layernorm_guard.py +396 -0
- vllm/model_executor/layers/fla/ops/op.py +60 -0
- vllm/model_executor/layers/fla/ops/solve_tril.py +556 -0
- vllm/model_executor/layers/fla/ops/utils.py +194 -0
- vllm/model_executor/layers/fla/ops/wy_fast.py +158 -0
- vllm/model_executor/layers/fused_moe/__init__.py +106 -0
- vllm/model_executor/layers/fused_moe/all2all_utils.py +160 -0
- vllm/model_executor/layers/fused_moe/batched_deep_gemm_moe.py +406 -0
- vllm/model_executor/layers/fused_moe/batched_triton_or_deep_gemm_moe.py +180 -0
- vllm/model_executor/layers/fused_moe/config.py +916 -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=1792,device_name=NVIDIA_H100_80GB_HBM3,dtype=int8_w8a16.json +146 -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 +146 -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=3072,device_name=NVIDIA_H200,dtype=int8_w8a16.json +146 -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=3584,device_name=NVIDIA_H100_80GB_HBM3,dtype=int8_w8a16.json +146 -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=1,N=7168,device_name=NVIDIA_H100_80GB_HBM3,dtype=int8_w8a16.json +146 -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=1024,device_name=AMD_Instinct_MI325X,dtype=fp8_w8a8.json +164 -0
- vllm/model_executor/layers/fused_moe/configs/E=128,N=1024,device_name=NVIDIA_H100,dtype=fp8_w8a8.json +123 -0
- vllm/model_executor/layers/fused_moe/configs/E=128,N=1024,device_name=NVIDIA_H200,dtype=fp8_w8a8.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=128,N=1024,device_name=NVIDIA_H200.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=128,N=1856,device_name=NVIDIA_H100_80GB_HBM3.json +147 -0
- vllm/model_executor/layers/fused_moe/configs/E=128,N=1856,device_name=NVIDIA_L40S.json +147 -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=352,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8.json +122 -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_B200,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=128,N=384,device_name=NVIDIA_GB200,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,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,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=704,device_name=NVIDIA_B200,dtype=fp8_w8a8.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=128,N=704,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8.json +114 -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=AMD_Instinct_MI308X.json +213 -0
- vllm/model_executor/layers/fused_moe/configs/E=128,N=768,device_name=NVIDIA_B200,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=128,N=768,device_name=NVIDIA_GB200,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,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-3e,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=8960,device_name=NVIDIA_H100_80GB_HBM3,dtype=bf16.json +82 -0
- vllm/model_executor/layers/fused_moe/configs/E=128,N=8960,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8.json +82 -0
- vllm/model_executor/layers/fused_moe/configs/E=128,N=928,device_name=NVIDIA_H100_80GB_HBM3.json +147 -0
- vllm/model_executor/layers/fused_moe/configs/E=128,N=928,device_name=NVIDIA_L40S.json +147 -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_B200,dtype=fp8_w8a8.json +147 -0
- vllm/model_executor/layers/fused_moe/configs/E=16,N=1024,device_name=NVIDIA_B200.json +146 -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=1024,device_name=NVIDIA_H200,dtype=fp8_w8a8.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=16,N=1024,device_name=NVIDIA_H200.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=14336,device_name=NVIDIA_H100_80GB_HBM3,dtype=int8_w8a16.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=1792,device_name=NVIDIA_H100_80GB_HBM3,dtype=int8_w8a16.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=16,N=1792,device_name=NVIDIA_H100_80GB_HBM3.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=16,N=2048,device_name=NVIDIA_H200,dtype=fp8_w8a8.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=16,N=2048,device_name=NVIDIA_H200.json +146 -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=float8.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=3072,device_name=NVIDIA_H200,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=3584,device_name=NVIDIA_H100_80GB_HBM3,dtype=int8_w8a16.json +146 -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=float8.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=AMD_Instinct_MI300X.json +201 -0
- vllm/model_executor/layers/fused_moe/configs/E=160,N=192,device_name=AMD_Instinct_MI350_OAM,dtype=fp8_w8a8.json +164 -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=160,N=192,device_name=NVIDIA_H20-3e.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=160,N=320,device_name=NVIDIA_H20-3e.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=160,N=384,device_name=AMD_Instinct_MI300X,dtype=fp8_w8a8.json +164 -0
- vllm/model_executor/layers/fused_moe/configs/E=160,N=384,device_name=AMD_Instinct_MI350_OAM,dtype=fp8_w8a8.json +164 -0
- vllm/model_executor/layers/fused_moe/configs/E=160,N=384,device_name=AMD_Instinct_MI355_OAM,dtype=fp8_w8a8.json +164 -0
- vllm/model_executor/layers/fused_moe/configs/E=160,N=640,device_name=NVIDIA_B200,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=160,N=640,device_name=NVIDIA_GB200,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=160,N=640,device_name=NVIDIA_H100,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=20,N=2560,device_name=NVIDIA_B200,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=20,N=2560,device_name=NVIDIA_GB200,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=20,N=2560,device_name=NVIDIA_H100,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=20,N=2560,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=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=384,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8,block_shape=[128,128].json +147 -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=512,device_name=NVIDIA_H100_80GB_HBM3.json +146 -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=32,N=1408,device_name=NVIDIA_B200.json +147 -0
- vllm/model_executor/layers/fused_moe/configs/E=32,N=2048,device_name=NVIDIA_B200,dtype=fp8_w8a8,block_shape=[128,128].json +147 -0
- vllm/model_executor/layers/fused_moe/configs/E=32,N=2048,device_name=NVIDIA_H200,dtype=fp8_w8a8,block_shape=[128,128].json +147 -0
- vllm/model_executor/layers/fused_moe/configs/E=384,N=128,device_name=NVIDIA_B200,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=384,N=128,device_name=NVIDIA_GB200,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=384,N=128,device_name=NVIDIA_H200,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=384,N=256,device_name=NVIDIA_B200,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=384,N=256,device_name=NVIDIA_GB200,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=40,N=1536,device_name=NVIDIA_B200,dtype=fp8_w8a8.json +147 -0
- vllm/model_executor/layers/fused_moe/configs/E=40,N=2560,device_name=NVIDIA_B200,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=40,N=2560,device_name=NVIDIA_GB200,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=40,N=2560,device_name=NVIDIA_H100,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=512,N=128,device_name=NVIDIA_A100-SXM4-80GB.json +147 -0
- vllm/model_executor/layers/fused_moe/configs/E=512,N=128,device_name=NVIDIA_B200.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=512,N=128,device_name=NVIDIA_GB200,dtype=fp8_w8a8.json +147 -0
- vllm/model_executor/layers/fused_moe/configs/E=512,N=128,device_name=NVIDIA_H100_80GB_HBM3.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=512,N=128,device_name=NVIDIA_H20-3e.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=512,N=128,device_name=NVIDIA_H200.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=512,N=256,device_name=NVIDIA_B200.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=512,N=256,device_name=NVIDIA_GB200,dtype=fp8_w8a8.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=512,N=256,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8,block_shape=[128,128].json +147 -0
- vllm/model_executor/layers/fused_moe/configs/E=512,N=256,device_name=NVIDIA_H100_80GB_HBM3.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=512,N=256,device_name=NVIDIA_H20-3e.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=512,N=256,device_name=NVIDIA_H200.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=512,N=512,device_name=NVIDIA_B200.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=512,N=512,device_name=NVIDIA_GB200,dtype=fp8_w8a8.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=512,N=512,device_name=NVIDIA_H100_80GB_HBM3.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=512,N=512,device_name=NVIDIA_H20-3e.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=512,N=512,device_name=NVIDIA_H200.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=512,N=64,device_name=NVIDIA_A100-SXM4-80GB.json +147 -0
- vllm/model_executor/layers/fused_moe/configs/E=512,N=64,device_name=NVIDIA_B200.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=512,N=64,device_name=NVIDIA_H20-3e.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=512,N=64,device_name=NVIDIA_H200.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=62,N=128,device_name=AMD_Instinct_MI300X.json +200 -0
- vllm/model_executor/layers/fused_moe/configs/E=62,N=256,device_name=AMD_Instinct_MI300X.json +200 -0
- vllm/model_executor/layers/fused_moe/configs/E=62,N=256,device_name=NVIDIA_H100_80GB_HBM3.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=62,N=512,device_name=AMD_Instinct_MI300X.json +200 -0
- vllm/model_executor/layers/fused_moe/configs/E=62,N=512,device_name=NVIDIA_H100_80GB_HBM3.json +146 -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=1408,device_name=NVIDIA_B200.json +147 -0
- vllm/model_executor/layers/fused_moe/configs/E=64,N=1536,device_name=NVIDIA_H20,dtype=fp8_w8a8.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=3072,device_name=NVIDIA_H20,dtype=fp8_w8a8.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=64,N=3072,device_name=NVIDIA_H20.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=384,device_name=NVIDIA_H20,dtype=fp8_w8a8.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=64,N=384,device_name=NVIDIA_H20.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=768,device_name=NVIDIA_H100_PCIe,dtype=fp8_w8a8,block_shape=[128,128].json +147 -0
- vllm/model_executor/layers/fused_moe/configs/E=64,N=768,device_name=NVIDIA_H20,dtype=fp8_w8a8.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=64,N=768,device_name=NVIDIA_H20.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=64,N=8960,device_name=NVIDIA_H100_80GB_HBM3,dtype=bf16.json +82 -0
- vllm/model_executor/layers/fused_moe/configs/E=64,N=8960,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8.json +82 -0
- vllm/model_executor/layers/fused_moe/configs/E=72,N=192,device_name=AMD_Instinct_MI300X.json +200 -0
- vllm/model_executor/layers/fused_moe/configs/E=72,N=384,device_name=AMD_Instinct_MI300X.json +200 -0
- vllm/model_executor/layers/fused_moe/configs/E=72,N=384,device_name=NVIDIA_H100_80GB_HBM3.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=72,N=768,device_name=AMD_Instinct_MI300X.json +200 -0
- vllm/model_executor/layers/fused_moe/configs/E=72,N=768,device_name=NVIDIA_H100_80GB_HBM3.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,block_shape=[128,128].json +154 -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/cpu_fused_moe.py +354 -0
- vllm/model_executor/layers/fused_moe/cutlass_moe.py +1052 -0
- vllm/model_executor/layers/fused_moe/deep_gemm_moe.py +387 -0
- vllm/model_executor/layers/fused_moe/deep_gemm_utils.py +416 -0
- vllm/model_executor/layers/fused_moe/deepep_ht_prepare_finalize.py +420 -0
- vllm/model_executor/layers/fused_moe/deepep_ll_prepare_finalize.py +367 -0
- vllm/model_executor/layers/fused_moe/flashinfer_cutlass_moe.py +307 -0
- vllm/model_executor/layers/fused_moe/flashinfer_cutlass_prepare_finalize.py +362 -0
- vllm/model_executor/layers/fused_moe/flashinfer_trtllm_moe.py +192 -0
- vllm/model_executor/layers/fused_moe/fused_batched_moe.py +1012 -0
- vllm/model_executor/layers/fused_moe/fused_marlin_moe.py +792 -0
- vllm/model_executor/layers/fused_moe/fused_moe.py +2175 -0
- vllm/model_executor/layers/fused_moe/fused_moe_method_base.py +112 -0
- vllm/model_executor/layers/fused_moe/fused_moe_modular_method.py +164 -0
- vllm/model_executor/layers/fused_moe/gpt_oss_triton_kernels_moe.py +316 -0
- vllm/model_executor/layers/fused_moe/layer.py +1944 -0
- vllm/model_executor/layers/fused_moe/modular_kernel.py +1222 -0
- vllm/model_executor/layers/fused_moe/moe_align_block_size.py +174 -0
- vllm/model_executor/layers/fused_moe/moe_pallas.py +83 -0
- vllm/model_executor/layers/fused_moe/moe_permute_unpermute.py +229 -0
- vllm/model_executor/layers/fused_moe/moe_torch_iterative.py +60 -0
- vllm/model_executor/layers/fused_moe/pplx_prepare_finalize.py +362 -0
- vllm/model_executor/layers/fused_moe/prepare_finalize.py +77 -0
- vllm/model_executor/layers/fused_moe/rocm_aiter_fused_moe.py +265 -0
- vllm/model_executor/layers/fused_moe/routing_simulator.py +310 -0
- vllm/model_executor/layers/fused_moe/shared_fused_moe.py +97 -0
- vllm/model_executor/layers/fused_moe/topk_weight_and_reduce.py +171 -0
- vllm/model_executor/layers/fused_moe/triton_deep_gemm_moe.py +163 -0
- vllm/model_executor/layers/fused_moe/trtllm_moe.py +143 -0
- vllm/model_executor/layers/fused_moe/unquantized_fused_moe_method.py +578 -0
- vllm/model_executor/layers/fused_moe/utils.py +332 -0
- vllm/model_executor/layers/kda.py +448 -0
- vllm/model_executor/layers/layernorm.py +442 -0
- vllm/model_executor/layers/lightning_attn.py +729 -0
- vllm/model_executor/layers/linear.py +1424 -0
- vllm/model_executor/layers/logits_processor.py +106 -0
- vllm/model_executor/layers/mamba/__init__.py +0 -0
- vllm/model_executor/layers/mamba/abstract.py +71 -0
- vllm/model_executor/layers/mamba/linear_attn.py +402 -0
- vllm/model_executor/layers/mamba/mamba_mixer.py +535 -0
- vllm/model_executor/layers/mamba/mamba_mixer2.py +928 -0
- vllm/model_executor/layers/mamba/mamba_utils.py +225 -0
- vllm/model_executor/layers/mamba/ops/__init__.py +0 -0
- vllm/model_executor/layers/mamba/ops/causal_conv1d.py +1240 -0
- vllm/model_executor/layers/mamba/ops/layernorm_gated.py +172 -0
- vllm/model_executor/layers/mamba/ops/mamba_ssm.py +478 -0
- vllm/model_executor/layers/mamba/ops/ssd_bmm.py +211 -0
- vllm/model_executor/layers/mamba/ops/ssd_chunk_scan.py +456 -0
- vllm/model_executor/layers/mamba/ops/ssd_chunk_state.py +700 -0
- vllm/model_executor/layers/mamba/ops/ssd_combined.py +230 -0
- vllm/model_executor/layers/mamba/ops/ssd_state_passing.py +157 -0
- vllm/model_executor/layers/mamba/short_conv.py +264 -0
- vllm/model_executor/layers/mla.py +168 -0
- vllm/model_executor/layers/pooler.py +817 -0
- vllm/model_executor/layers/quantization/__init__.py +174 -0
- vllm/model_executor/layers/quantization/auto_round.py +454 -0
- vllm/model_executor/layers/quantization/awq.py +277 -0
- vllm/model_executor/layers/quantization/awq_marlin.py +659 -0
- vllm/model_executor/layers/quantization/awq_triton.py +337 -0
- vllm/model_executor/layers/quantization/base_config.py +170 -0
- vllm/model_executor/layers/quantization/bitblas.py +502 -0
- vllm/model_executor/layers/quantization/bitsandbytes.py +658 -0
- vllm/model_executor/layers/quantization/compressed_tensors/__init__.py +3 -0
- vllm/model_executor/layers/quantization/compressed_tensors/compressed_tensors.py +914 -0
- vllm/model_executor/layers/quantization/compressed_tensors/compressed_tensors_moe.py +2284 -0
- vllm/model_executor/layers/quantization/compressed_tensors/schemes/__init__.py +35 -0
- vllm/model_executor/layers/quantization/compressed_tensors/schemes/compressed_tensors_24.py +392 -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 +176 -0
- vllm/model_executor/layers/quantization/compressed_tensors/schemes/compressed_tensors_w4a16_nvfp4.py +124 -0
- vllm/model_executor/layers/quantization/compressed_tensors/schemes/compressed_tensors_w4a4_nvfp4.py +218 -0
- vllm/model_executor/layers/quantization/compressed_tensors/schemes/compressed_tensors_w4a8_fp8.py +183 -0
- vllm/model_executor/layers/quantization/compressed_tensors/schemes/compressed_tensors_w4a8_int.py +153 -0
- vllm/model_executor/layers/quantization/compressed_tensors/schemes/compressed_tensors_w8a16_fp8.py +138 -0
- vllm/model_executor/layers/quantization/compressed_tensors/schemes/compressed_tensors_w8a8_fp8.py +200 -0
- vllm/model_executor/layers/quantization/compressed_tensors/schemes/compressed_tensors_w8a8_int8.py +125 -0
- vllm/model_executor/layers/quantization/compressed_tensors/schemes/compressed_tensors_wNa16.py +219 -0
- vllm/model_executor/layers/quantization/compressed_tensors/transform/__init__.py +0 -0
- vllm/model_executor/layers/quantization/compressed_tensors/transform/linear.py +260 -0
- vllm/model_executor/layers/quantization/compressed_tensors/transform/module.py +173 -0
- vllm/model_executor/layers/quantization/compressed_tensors/transform/schemes/__init__.py +0 -0
- vllm/model_executor/layers/quantization/compressed_tensors/transform/schemes/linear_qutlass_nvfp4.py +64 -0
- vllm/model_executor/layers/quantization/compressed_tensors/transform/utils.py +13 -0
- vllm/model_executor/layers/quantization/compressed_tensors/triton_scaled_mm.py +224 -0
- vllm/model_executor/layers/quantization/compressed_tensors/utils.py +216 -0
- vllm/model_executor/layers/quantization/deepspeedfp.py +218 -0
- vllm/model_executor/layers/quantization/experts_int8.py +240 -0
- vllm/model_executor/layers/quantization/fbgemm_fp8.py +195 -0
- vllm/model_executor/layers/quantization/fp8.py +1333 -0
- vllm/model_executor/layers/quantization/fp_quant.py +420 -0
- vllm/model_executor/layers/quantization/gguf.py +643 -0
- vllm/model_executor/layers/quantization/gptq.py +393 -0
- vllm/model_executor/layers/quantization/gptq_bitblas.py +482 -0
- vllm/model_executor/layers/quantization/gptq_marlin.py +789 -0
- vllm/model_executor/layers/quantization/gptq_marlin_24.py +320 -0
- vllm/model_executor/layers/quantization/hqq_marlin.py +371 -0
- vllm/model_executor/layers/quantization/inc.py +65 -0
- vllm/model_executor/layers/quantization/input_quant_fp8.py +171 -0
- vllm/model_executor/layers/quantization/ipex_quant.py +467 -0
- vllm/model_executor/layers/quantization/kernels/__init__.py +0 -0
- vllm/model_executor/layers/quantization/kernels/mixed_precision/MPLinearKernel.py +94 -0
- vllm/model_executor/layers/quantization/kernels/mixed_precision/__init__.py +105 -0
- vllm/model_executor/layers/quantization/kernels/mixed_precision/allspark.py +115 -0
- vllm/model_executor/layers/quantization/kernels/mixed_precision/bitblas.py +323 -0
- vllm/model_executor/layers/quantization/kernels/mixed_precision/conch.py +98 -0
- vllm/model_executor/layers/quantization/kernels/mixed_precision/cutlass.py +119 -0
- vllm/model_executor/layers/quantization/kernels/mixed_precision/dynamic_4bit.py +111 -0
- vllm/model_executor/layers/quantization/kernels/mixed_precision/exllama.py +161 -0
- vllm/model_executor/layers/quantization/kernels/mixed_precision/machete.py +159 -0
- vllm/model_executor/layers/quantization/kernels/mixed_precision/marlin.py +166 -0
- vllm/model_executor/layers/quantization/kernels/scaled_mm/ScaledMMLinearKernel.py +73 -0
- vllm/model_executor/layers/quantization/kernels/scaled_mm/__init__.py +97 -0
- vllm/model_executor/layers/quantization/kernels/scaled_mm/aiter.py +120 -0
- vllm/model_executor/layers/quantization/kernels/scaled_mm/cpu.py +219 -0
- vllm/model_executor/layers/quantization/kernels/scaled_mm/cutlass.py +140 -0
- vllm/model_executor/layers/quantization/kernels/scaled_mm/triton.py +42 -0
- vllm/model_executor/layers/quantization/kernels/scaled_mm/xla.py +105 -0
- vllm/model_executor/layers/quantization/kv_cache.py +146 -0
- vllm/model_executor/layers/quantization/modelopt.py +1788 -0
- vllm/model_executor/layers/quantization/moe_wna16.py +541 -0
- vllm/model_executor/layers/quantization/mxfp4.py +1162 -0
- vllm/model_executor/layers/quantization/petit.py +320 -0
- vllm/model_executor/layers/quantization/ptpc_fp8.py +137 -0
- vllm/model_executor/layers/quantization/quark/__init__.py +0 -0
- vllm/model_executor/layers/quantization/quark/quark.py +528 -0
- vllm/model_executor/layers/quantization/quark/quark_moe.py +683 -0
- vllm/model_executor/layers/quantization/quark/schemes/__init__.py +9 -0
- vllm/model_executor/layers/quantization/quark/schemes/quark_ocp_mx.py +306 -0
- vllm/model_executor/layers/quantization/quark/schemes/quark_scheme.py +55 -0
- vllm/model_executor/layers/quantization/quark/schemes/quark_w8a8_fp8.py +179 -0
- vllm/model_executor/layers/quantization/quark/schemes/quark_w8a8_int8.py +139 -0
- vllm/model_executor/layers/quantization/quark/utils.py +105 -0
- vllm/model_executor/layers/quantization/qutlass_utils.py +185 -0
- vllm/model_executor/layers/quantization/rtn.py +652 -0
- vllm/model_executor/layers/quantization/schema.py +90 -0
- vllm/model_executor/layers/quantization/torchao.py +380 -0
- vllm/model_executor/layers/quantization/tpu_int8.py +139 -0
- vllm/model_executor/layers/quantization/utils/__init__.py +6 -0
- vllm/model_executor/layers/quantization/utils/allspark_utils.py +67 -0
- vllm/model_executor/layers/quantization/utils/bitblas_utils.py +229 -0
- vllm/model_executor/layers/quantization/utils/configs/N=12288,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=12288,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=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=2112,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=2112,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=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=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=24576,K=1536,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=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=4096,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=4096,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=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/configs/README.md +3 -0
- vllm/model_executor/layers/quantization/utils/flashinfer_fp4_moe.py +89 -0
- vllm/model_executor/layers/quantization/utils/flashinfer_utils.py +298 -0
- vllm/model_executor/layers/quantization/utils/fp8_utils.py +1203 -0
- vllm/model_executor/layers/quantization/utils/gptq_utils.py +158 -0
- vllm/model_executor/layers/quantization/utils/int8_utils.py +489 -0
- vllm/model_executor/layers/quantization/utils/layer_utils.py +41 -0
- vllm/model_executor/layers/quantization/utils/machete_utils.py +56 -0
- vllm/model_executor/layers/quantization/utils/marlin_utils.py +575 -0
- vllm/model_executor/layers/quantization/utils/marlin_utils_fp4.py +397 -0
- vllm/model_executor/layers/quantization/utils/marlin_utils_fp8.py +351 -0
- vllm/model_executor/layers/quantization/utils/marlin_utils_test.py +161 -0
- vllm/model_executor/layers/quantization/utils/marlin_utils_test_24.py +467 -0
- vllm/model_executor/layers/quantization/utils/mxfp4_utils.py +181 -0
- vllm/model_executor/layers/quantization/utils/mxfp6_utils.py +142 -0
- vllm/model_executor/layers/quantization/utils/mxfp8_utils.py +24 -0
- vllm/model_executor/layers/quantization/utils/nvfp4_emulation_utils.py +142 -0
- vllm/model_executor/layers/quantization/utils/nvfp4_moe_support.py +63 -0
- vllm/model_executor/layers/quantization/utils/ocp_mx_utils.py +51 -0
- vllm/model_executor/layers/quantization/utils/petit_utils.py +124 -0
- vllm/model_executor/layers/quantization/utils/quant_utils.py +687 -0
- vllm/model_executor/layers/quantization/utils/w8a8_utils.py +516 -0
- vllm/model_executor/layers/resampler.py +283 -0
- vllm/model_executor/layers/rotary_embedding/__init__.py +278 -0
- vllm/model_executor/layers/rotary_embedding/base.py +235 -0
- vllm/model_executor/layers/rotary_embedding/common.py +188 -0
- vllm/model_executor/layers/rotary_embedding/deepseek_scaling_rope.py +165 -0
- vllm/model_executor/layers/rotary_embedding/dual_chunk_rope.py +215 -0
- vllm/model_executor/layers/rotary_embedding/dynamic_ntk_alpha_rope.py +43 -0
- vllm/model_executor/layers/rotary_embedding/dynamic_ntk_scaling_rope.py +68 -0
- vllm/model_executor/layers/rotary_embedding/ernie45_vl_rope.py +75 -0
- vllm/model_executor/layers/rotary_embedding/linear_scaling_rope.py +115 -0
- vllm/model_executor/layers/rotary_embedding/llama3_rope.py +54 -0
- vllm/model_executor/layers/rotary_embedding/llama4_vision_rope.py +80 -0
- vllm/model_executor/layers/rotary_embedding/mrope.py +397 -0
- vllm/model_executor/layers/rotary_embedding/ntk_scaling_rope.py +47 -0
- vllm/model_executor/layers/rotary_embedding/phi3_long_rope_scaled_rope.py +159 -0
- vllm/model_executor/layers/rotary_embedding/yarn_scaling_rope.py +81 -0
- vllm/model_executor/layers/utils.py +251 -0
- vllm/model_executor/layers/vocab_parallel_embedding.py +558 -0
- vllm/model_executor/model_loader/__init__.py +148 -0
- vllm/model_executor/model_loader/base_loader.py +57 -0
- vllm/model_executor/model_loader/bitsandbytes_loader.py +822 -0
- vllm/model_executor/model_loader/default_loader.py +327 -0
- vllm/model_executor/model_loader/dummy_loader.py +28 -0
- vllm/model_executor/model_loader/gguf_loader.py +176 -0
- vllm/model_executor/model_loader/online_quantization.py +224 -0
- vllm/model_executor/model_loader/runai_streamer_loader.py +116 -0
- vllm/model_executor/model_loader/sharded_state_loader.py +206 -0
- vllm/model_executor/model_loader/tensorizer.py +790 -0
- vllm/model_executor/model_loader/tensorizer_loader.py +151 -0
- vllm/model_executor/model_loader/tpu.py +118 -0
- vllm/model_executor/model_loader/utils.py +288 -0
- vllm/model_executor/model_loader/weight_utils.py +1084 -0
- vllm/model_executor/models/__init__.py +44 -0
- vllm/model_executor/models/adapters.py +543 -0
- vllm/model_executor/models/afmoe.py +711 -0
- vllm/model_executor/models/aimv2.py +247 -0
- vllm/model_executor/models/apertus.py +587 -0
- vllm/model_executor/models/arcee.py +439 -0
- vllm/model_executor/models/arctic.py +635 -0
- vllm/model_executor/models/aria.py +655 -0
- vllm/model_executor/models/aya_vision.py +450 -0
- vllm/model_executor/models/baichuan.py +496 -0
- vllm/model_executor/models/bailing_moe.py +646 -0
- vllm/model_executor/models/bamba.py +522 -0
- vllm/model_executor/models/bee.py +157 -0
- vllm/model_executor/models/bert.py +925 -0
- vllm/model_executor/models/bert_with_rope.py +732 -0
- vllm/model_executor/models/blip.py +349 -0
- vllm/model_executor/models/blip2.py +695 -0
- vllm/model_executor/models/bloom.py +390 -0
- vllm/model_executor/models/chameleon.py +1120 -0
- vllm/model_executor/models/chatglm.py +498 -0
- vllm/model_executor/models/clip.py +965 -0
- vllm/model_executor/models/cohere2_vision.py +472 -0
- vllm/model_executor/models/commandr.py +473 -0
- vllm/model_executor/models/config.py +503 -0
- vllm/model_executor/models/dbrx.py +482 -0
- vllm/model_executor/models/deepencoder.py +673 -0
- vllm/model_executor/models/deepseek_eagle.py +260 -0
- vllm/model_executor/models/deepseek_mtp.py +360 -0
- vllm/model_executor/models/deepseek_ocr.py +593 -0
- vllm/model_executor/models/deepseek_v2.py +1649 -0
- vllm/model_executor/models/deepseek_vl2.py +655 -0
- vllm/model_executor/models/dots1.py +574 -0
- vllm/model_executor/models/dots_ocr.py +900 -0
- vllm/model_executor/models/ernie45.py +53 -0
- vllm/model_executor/models/ernie45_moe.py +759 -0
- vllm/model_executor/models/ernie45_vl.py +1742 -0
- vllm/model_executor/models/ernie45_vl_moe.py +803 -0
- vllm/model_executor/models/ernie_mtp.py +279 -0
- vllm/model_executor/models/exaone.py +545 -0
- vllm/model_executor/models/exaone4.py +531 -0
- vllm/model_executor/models/fairseq2_llama.py +154 -0
- vllm/model_executor/models/falcon.py +545 -0
- vllm/model_executor/models/falcon_h1.py +685 -0
- vllm/model_executor/models/flex_olmo.py +155 -0
- vllm/model_executor/models/fuyu.py +373 -0
- vllm/model_executor/models/gemma.py +426 -0
- vllm/model_executor/models/gemma2.py +439 -0
- vllm/model_executor/models/gemma3.py +571 -0
- vllm/model_executor/models/gemma3_mm.py +741 -0
- vllm/model_executor/models/gemma3n.py +1165 -0
- vllm/model_executor/models/gemma3n_mm.py +811 -0
- vllm/model_executor/models/glm.py +23 -0
- vllm/model_executor/models/glm4.py +305 -0
- vllm/model_executor/models/glm4_1v.py +1821 -0
- vllm/model_executor/models/glm4_moe.py +747 -0
- vllm/model_executor/models/glm4_moe_mtp.py +359 -0
- vllm/model_executor/models/glm4v.py +784 -0
- vllm/model_executor/models/gpt2.py +397 -0
- vllm/model_executor/models/gpt_bigcode.py +339 -0
- vllm/model_executor/models/gpt_j.py +346 -0
- vllm/model_executor/models/gpt_neox.py +344 -0
- vllm/model_executor/models/gpt_oss.py +738 -0
- vllm/model_executor/models/granite.py +516 -0
- vllm/model_executor/models/granite_speech.py +913 -0
- vllm/model_executor/models/granitemoe.py +569 -0
- vllm/model_executor/models/granitemoehybrid.py +709 -0
- vllm/model_executor/models/granitemoeshared.py +333 -0
- vllm/model_executor/models/gritlm.py +245 -0
- vllm/model_executor/models/grok1.py +558 -0
- vllm/model_executor/models/h2ovl.py +554 -0
- vllm/model_executor/models/hunyuan_v1.py +1053 -0
- vllm/model_executor/models/hyperclovax_vision.py +1166 -0
- vllm/model_executor/models/idefics2_vision_model.py +426 -0
- vllm/model_executor/models/idefics3.py +717 -0
- vllm/model_executor/models/interfaces.py +1092 -0
- vllm/model_executor/models/interfaces_base.py +214 -0
- vllm/model_executor/models/intern_vit.py +453 -0
- vllm/model_executor/models/internlm2.py +460 -0
- vllm/model_executor/models/internlm2_ve.py +142 -0
- vllm/model_executor/models/interns1.py +830 -0
- vllm/model_executor/models/interns1_vit.py +432 -0
- vllm/model_executor/models/internvl.py +1452 -0
- vllm/model_executor/models/jais.py +397 -0
- vllm/model_executor/models/jamba.py +610 -0
- vllm/model_executor/models/jina_vl.py +147 -0
- vllm/model_executor/models/keye.py +1761 -0
- vllm/model_executor/models/keye_vl1_5.py +726 -0
- vllm/model_executor/models/kimi_linear.py +663 -0
- vllm/model_executor/models/kimi_vl.py +578 -0
- vllm/model_executor/models/lfm2.py +532 -0
- vllm/model_executor/models/lfm2_moe.py +762 -0
- vllm/model_executor/models/lightonocr.py +195 -0
- vllm/model_executor/models/llama.py +732 -0
- vllm/model_executor/models/llama4.py +859 -0
- vllm/model_executor/models/llama4_eagle.py +223 -0
- vllm/model_executor/models/llama_eagle.py +218 -0
- vllm/model_executor/models/llama_eagle3.py +367 -0
- vllm/model_executor/models/llava.py +842 -0
- vllm/model_executor/models/llava_next.py +583 -0
- vllm/model_executor/models/llava_next_video.py +467 -0
- vllm/model_executor/models/llava_onevision.py +923 -0
- vllm/model_executor/models/longcat_flash.py +749 -0
- vllm/model_executor/models/longcat_flash_mtp.py +349 -0
- vllm/model_executor/models/mamba.py +276 -0
- vllm/model_executor/models/mamba2.py +289 -0
- vllm/model_executor/models/medusa.py +179 -0
- vllm/model_executor/models/midashenglm.py +827 -0
- vllm/model_executor/models/mimo.py +188 -0
- vllm/model_executor/models/mimo_mtp.py +294 -0
- vllm/model_executor/models/minicpm.py +664 -0
- vllm/model_executor/models/minicpm3.py +242 -0
- vllm/model_executor/models/minicpm_eagle.py +389 -0
- vllm/model_executor/models/minicpmo.py +768 -0
- vllm/model_executor/models/minicpmv.py +1745 -0
- vllm/model_executor/models/minimax_m2.py +552 -0
- vllm/model_executor/models/minimax_text_01.py +1012 -0
- vllm/model_executor/models/minimax_vl_01.py +396 -0
- vllm/model_executor/models/mistral3.py +637 -0
- vllm/model_executor/models/mixtral.py +621 -0
- vllm/model_executor/models/mllama4.py +1147 -0
- vllm/model_executor/models/mlp_speculator.py +235 -0
- vllm/model_executor/models/modernbert.py +450 -0
- vllm/model_executor/models/module_mapping.py +74 -0
- vllm/model_executor/models/molmo.py +1555 -0
- vllm/model_executor/models/moonvit.py +677 -0
- vllm/model_executor/models/mpt.py +335 -0
- vllm/model_executor/models/nano_nemotron_vl.py +1740 -0
- vllm/model_executor/models/nemotron.py +518 -0
- vllm/model_executor/models/nemotron_h.py +852 -0
- vllm/model_executor/models/nemotron_nas.py +491 -0
- vllm/model_executor/models/nemotron_vl.py +653 -0
- vllm/model_executor/models/nvlm_d.py +216 -0
- vllm/model_executor/models/olmo.py +414 -0
- vllm/model_executor/models/olmo2.py +454 -0
- vllm/model_executor/models/olmoe.py +498 -0
- vllm/model_executor/models/openpangu.py +1062 -0
- vllm/model_executor/models/openpangu_mtp.py +265 -0
- vllm/model_executor/models/opt.py +426 -0
- vllm/model_executor/models/orion.py +372 -0
- vllm/model_executor/models/ouro.py +516 -0
- vllm/model_executor/models/ovis.py +559 -0
- vllm/model_executor/models/ovis2_5.py +673 -0
- vllm/model_executor/models/paddleocr_vl.py +1407 -0
- vllm/model_executor/models/paligemma.py +412 -0
- vllm/model_executor/models/persimmon.py +377 -0
- vllm/model_executor/models/phi.py +374 -0
- vllm/model_executor/models/phi3.py +18 -0
- vllm/model_executor/models/phi3v.py +737 -0
- vllm/model_executor/models/phi4_multimodal.py +1447 -0
- vllm/model_executor/models/phi4mm.py +1253 -0
- vllm/model_executor/models/phi4mm_audio.py +1296 -0
- vllm/model_executor/models/phi4mm_utils.py +1907 -0
- vllm/model_executor/models/phimoe.py +675 -0
- vllm/model_executor/models/pixtral.py +1352 -0
- vllm/model_executor/models/plamo2.py +981 -0
- vllm/model_executor/models/qwen.py +368 -0
- vllm/model_executor/models/qwen2.py +541 -0
- vllm/model_executor/models/qwen2_5_omni_thinker.py +1246 -0
- vllm/model_executor/models/qwen2_5_vl.py +1613 -0
- vllm/model_executor/models/qwen2_audio.py +473 -0
- vllm/model_executor/models/qwen2_moe.py +596 -0
- vllm/model_executor/models/qwen2_rm.py +123 -0
- vllm/model_executor/models/qwen2_vl.py +1670 -0
- vllm/model_executor/models/qwen3.py +336 -0
- vllm/model_executor/models/qwen3_moe.py +744 -0
- vllm/model_executor/models/qwen3_next.py +1395 -0
- vllm/model_executor/models/qwen3_next_mtp.py +296 -0
- vllm/model_executor/models/qwen3_omni_moe_thinker.py +1721 -0
- vllm/model_executor/models/qwen3_vl.py +1673 -0
- vllm/model_executor/models/qwen3_vl_moe.py +415 -0
- vllm/model_executor/models/qwen_vl.py +802 -0
- vllm/model_executor/models/radio.py +555 -0
- vllm/model_executor/models/registry.py +1155 -0
- vllm/model_executor/models/roberta.py +259 -0
- vllm/model_executor/models/rvl.py +107 -0
- vllm/model_executor/models/seed_oss.py +497 -0
- vllm/model_executor/models/siglip.py +1174 -0
- vllm/model_executor/models/siglip2navit.py +724 -0
- vllm/model_executor/models/skyworkr1v.py +953 -0
- vllm/model_executor/models/smolvlm.py +38 -0
- vllm/model_executor/models/solar.py +502 -0
- vllm/model_executor/models/stablelm.py +359 -0
- vllm/model_executor/models/starcoder2.py +367 -0
- vllm/model_executor/models/step3_text.py +559 -0
- vllm/model_executor/models/step3_vl.py +1148 -0
- vllm/model_executor/models/swin.py +514 -0
- vllm/model_executor/models/tarsier.py +619 -0
- vllm/model_executor/models/telechat2.py +153 -0
- vllm/model_executor/models/teleflm.py +78 -0
- vllm/model_executor/models/terratorch.py +319 -0
- vllm/model_executor/models/transformers/__init__.py +127 -0
- vllm/model_executor/models/transformers/base.py +464 -0
- vllm/model_executor/models/transformers/causal.py +65 -0
- vllm/model_executor/models/transformers/legacy.py +90 -0
- vllm/model_executor/models/transformers/moe.py +318 -0
- vllm/model_executor/models/transformers/multimodal.py +411 -0
- vllm/model_executor/models/transformers/pooling.py +119 -0
- vllm/model_executor/models/transformers/utils.py +207 -0
- vllm/model_executor/models/ultravox.py +681 -0
- vllm/model_executor/models/utils.py +877 -0
- vllm/model_executor/models/vision.py +552 -0
- vllm/model_executor/models/voxtral.py +845 -0
- vllm/model_executor/models/whisper.py +959 -0
- vllm/model_executor/models/zamba2.py +986 -0
- vllm/model_executor/parameter.py +642 -0
- vllm/model_executor/utils.py +94 -0
- vllm/model_executor/warmup/__init__.py +0 -0
- vllm/model_executor/warmup/deep_gemm_warmup.py +314 -0
- vllm/model_executor/warmup/kernel_warmup.py +98 -0
- vllm/multimodal/__init__.py +40 -0
- vllm/multimodal/audio.py +118 -0
- vllm/multimodal/base.py +26 -0
- vllm/multimodal/cache.py +755 -0
- vllm/multimodal/evs.py +294 -0
- vllm/multimodal/hasher.py +106 -0
- vllm/multimodal/image.py +130 -0
- vllm/multimodal/inputs.py +1036 -0
- vllm/multimodal/parse.py +544 -0
- vllm/multimodal/processing.py +2186 -0
- vllm/multimodal/profiling.py +369 -0
- vllm/multimodal/registry.py +360 -0
- vllm/multimodal/utils.py +512 -0
- vllm/multimodal/video.py +306 -0
- vllm/outputs.py +345 -0
- vllm/platforms/__init__.py +277 -0
- vllm/platforms/cpu.py +414 -0
- vllm/platforms/cuda.py +657 -0
- vllm/platforms/interface.py +639 -0
- vllm/platforms/rocm.py +466 -0
- vllm/platforms/tpu.py +276 -0
- vllm/platforms/xpu.py +274 -0
- vllm/plugins/__init__.py +78 -0
- vllm/plugins/io_processors/__init__.py +68 -0
- vllm/plugins/io_processors/interface.py +77 -0
- vllm/plugins/lora_resolvers/__init__.py +0 -0
- vllm/plugins/lora_resolvers/filesystem_resolver.py +52 -0
- vllm/pooling_params.py +228 -0
- vllm/profiler/__init__.py +0 -0
- vllm/profiler/gpu_profiler.py +37 -0
- vllm/profiler/layerwise_profile.py +392 -0
- vllm/profiler/utils.py +151 -0
- vllm/py.typed +2 -0
- vllm/ray/__init__.py +0 -0
- vllm/ray/lazy_utils.py +26 -0
- vllm/ray/ray_env.py +79 -0
- vllm/reasoning/__init__.py +92 -0
- vllm/reasoning/abs_reasoning_parsers.py +290 -0
- vllm/reasoning/basic_parsers.py +162 -0
- vllm/reasoning/deepseek_r1_reasoning_parser.py +67 -0
- vllm/reasoning/deepseek_v3_reasoning_parser.py +62 -0
- vllm/reasoning/ernie45_reasoning_parser.py +165 -0
- vllm/reasoning/glm4_moe_reasoning_parser.py +171 -0
- vllm/reasoning/gptoss_reasoning_parser.py +173 -0
- vllm/reasoning/granite_reasoning_parser.py +363 -0
- vllm/reasoning/hunyuan_a13b_reasoning_parser.py +237 -0
- vllm/reasoning/identity_reasoning_parser.py +58 -0
- vllm/reasoning/minimax_m2_reasoning_parser.py +67 -0
- vllm/reasoning/mistral_reasoning_parser.py +55 -0
- vllm/reasoning/olmo3_reasoning_parser.py +302 -0
- vllm/reasoning/qwen3_reasoning_parser.py +67 -0
- vllm/reasoning/seedoss_reasoning_parser.py +27 -0
- vllm/reasoning/step3_reasoning_parser.py +107 -0
- vllm/sampling_params.py +669 -0
- vllm/scalar_type.py +355 -0
- vllm/scripts.py +17 -0
- vllm/sequence.py +98 -0
- vllm/tasks.py +13 -0
- vllm/third_party/__init__.py +0 -0
- vllm/third_party/pynvml.py +6140 -0
- vllm/tracing.py +135 -0
- vllm/transformers_utils/__init__.py +26 -0
- vllm/transformers_utils/chat_templates/__init__.py +5 -0
- vllm/transformers_utils/chat_templates/registry.py +73 -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_ocr.jinja +14 -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/chat_templates/template_minicpmv45.jinja +93 -0
- vllm/transformers_utils/config.py +1203 -0
- vllm/transformers_utils/config_parser_base.py +20 -0
- vllm/transformers_utils/configs/__init__.py +70 -0
- vllm/transformers_utils/configs/afmoe.py +84 -0
- vllm/transformers_utils/configs/arctic.py +206 -0
- vllm/transformers_utils/configs/chatglm.py +75 -0
- vllm/transformers_utils/configs/deepseek_vl2.py +126 -0
- vllm/transformers_utils/configs/dotsocr.py +71 -0
- vllm/transformers_utils/configs/eagle.py +84 -0
- vllm/transformers_utils/configs/falcon.py +89 -0
- vllm/transformers_utils/configs/flex_olmo.py +77 -0
- vllm/transformers_utils/configs/jais.py +243 -0
- vllm/transformers_utils/configs/kimi_linear.py +144 -0
- vllm/transformers_utils/configs/kimi_vl.py +38 -0
- vllm/transformers_utils/configs/lfm2_moe.py +159 -0
- vllm/transformers_utils/configs/medusa.py +65 -0
- vllm/transformers_utils/configs/midashenglm.py +103 -0
- vllm/transformers_utils/configs/mistral.py +174 -0
- vllm/transformers_utils/configs/mlp_speculator.py +69 -0
- vllm/transformers_utils/configs/moonvit.py +33 -0
- vllm/transformers_utils/configs/nemotron.py +212 -0
- vllm/transformers_utils/configs/nemotron_h.py +282 -0
- vllm/transformers_utils/configs/olmo3.py +79 -0
- vllm/transformers_utils/configs/ovis.py +182 -0
- vllm/transformers_utils/configs/qwen3_next.py +274 -0
- vllm/transformers_utils/configs/radio.py +89 -0
- vllm/transformers_utils/configs/speculators/__init__.py +2 -0
- vllm/transformers_utils/configs/speculators/algos.py +38 -0
- vllm/transformers_utils/configs/speculators/base.py +114 -0
- vllm/transformers_utils/configs/step3_vl.py +174 -0
- vllm/transformers_utils/configs/ultravox.py +118 -0
- vllm/transformers_utils/detokenizer_utils.py +198 -0
- vllm/transformers_utils/dynamic_module.py +59 -0
- vllm/transformers_utils/processor.py +402 -0
- vllm/transformers_utils/processors/__init__.py +15 -0
- vllm/transformers_utils/processors/deepseek_ocr.py +438 -0
- vllm/transformers_utils/processors/deepseek_vl2.py +406 -0
- vllm/transformers_utils/processors/ovis.py +453 -0
- vllm/transformers_utils/processors/ovis2_5.py +468 -0
- vllm/transformers_utils/runai_utils.py +104 -0
- vllm/transformers_utils/s3_utils.py +95 -0
- vllm/transformers_utils/tokenizer.py +293 -0
- vllm/transformers_utils/tokenizer_base.py +155 -0
- vllm/transformers_utils/tokenizers/__init__.py +16 -0
- vllm/transformers_utils/tokenizers/mistral.py +502 -0
- vllm/transformers_utils/utils.py +130 -0
- vllm/triton_utils/__init__.py +19 -0
- vllm/triton_utils/importing.py +103 -0
- vllm/usage/__init__.py +0 -0
- vllm/usage/usage_lib.py +294 -0
- vllm/utils/__init__.py +82 -0
- vllm/utils/argparse_utils.py +487 -0
- vllm/utils/async_utils.py +303 -0
- vllm/utils/cache.py +214 -0
- vllm/utils/collection_utils.py +139 -0
- vllm/utils/counter.py +45 -0
- vllm/utils/deep_gemm.py +391 -0
- vllm/utils/flashinfer.py +490 -0
- vllm/utils/func_utils.py +236 -0
- vllm/utils/gc_utils.py +147 -0
- vllm/utils/hashing.py +63 -0
- vllm/utils/import_utils.py +411 -0
- vllm/utils/jsontree.py +165 -0
- vllm/utils/math_utils.py +32 -0
- vllm/utils/mem_constants.py +13 -0
- vllm/utils/mem_utils.py +232 -0
- vllm/utils/nccl.py +64 -0
- vllm/utils/network_utils.py +331 -0
- vllm/utils/platform_utils.py +59 -0
- vllm/utils/profiling.py +56 -0
- vllm/utils/registry.py +49 -0
- vllm/utils/serial_utils.py +169 -0
- vllm/utils/system_utils.py +229 -0
- vllm/utils/tensor_schema.py +255 -0
- vllm/utils/torch_utils.py +657 -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 +496 -0
- vllm/v1/attention/backends/flash_attn.py +1028 -0
- vllm/v1/attention/backends/flashinfer.py +1572 -0
- vllm/v1/attention/backends/flex_attention.py +926 -0
- vllm/v1/attention/backends/gdn_attn.py +387 -0
- vllm/v1/attention/backends/linear_attn.py +74 -0
- vllm/v1/attention/backends/mamba1_attn.py +165 -0
- vllm/v1/attention/backends/mamba2_attn.py +354 -0
- vllm/v1/attention/backends/mamba_attn.py +115 -0
- vllm/v1/attention/backends/mla/__init__.py +0 -0
- vllm/v1/attention/backends/mla/common.py +2031 -0
- vllm/v1/attention/backends/mla/cutlass_mla.py +275 -0
- vllm/v1/attention/backends/mla/flashattn_mla.py +337 -0
- vllm/v1/attention/backends/mla/flashinfer_mla.py +171 -0
- vllm/v1/attention/backends/mla/flashmla.py +314 -0
- vllm/v1/attention/backends/mla/flashmla_sparse.py +548 -0
- vllm/v1/attention/backends/mla/indexer.py +362 -0
- vllm/v1/attention/backends/mla/rocm_aiter_mla.py +294 -0
- vllm/v1/attention/backends/mla/triton_mla.py +171 -0
- vllm/v1/attention/backends/pallas.py +436 -0
- vllm/v1/attention/backends/rocm_aiter_fa.py +816 -0
- vllm/v1/attention/backends/rocm_aiter_unified_attn.py +196 -0
- vllm/v1/attention/backends/rocm_attn.py +362 -0
- vllm/v1/attention/backends/short_conv_attn.py +105 -0
- vllm/v1/attention/backends/tree_attn.py +425 -0
- vllm/v1/attention/backends/triton_attn.py +373 -0
- vllm/v1/attention/backends/utils.py +1116 -0
- vllm/v1/attention/backends/xformers.py +417 -0
- vllm/v1/core/__init__.py +0 -0
- vllm/v1/core/block_pool.py +428 -0
- vllm/v1/core/encoder_cache_manager.py +343 -0
- vllm/v1/core/kv_cache_coordinator.py +480 -0
- vllm/v1/core/kv_cache_manager.py +420 -0
- vllm/v1/core/kv_cache_utils.py +1340 -0
- vllm/v1/core/sched/__init__.py +0 -0
- vllm/v1/core/sched/async_scheduler.py +62 -0
- vllm/v1/core/sched/interface.py +181 -0
- vllm/v1/core/sched/output.py +202 -0
- vllm/v1/core/sched/request_queue.py +221 -0
- vllm/v1/core/sched/scheduler.py +1617 -0
- vllm/v1/core/sched/utils.py +72 -0
- vllm/v1/core/single_type_kv_cache_manager.py +736 -0
- vllm/v1/cudagraph_dispatcher.py +148 -0
- vllm/v1/engine/__init__.py +206 -0
- vllm/v1/engine/async_llm.py +797 -0
- vllm/v1/engine/coordinator.py +377 -0
- vllm/v1/engine/core.py +1420 -0
- vllm/v1/engine/core_client.py +1400 -0
- vllm/v1/engine/detokenizer.py +351 -0
- vllm/v1/engine/exceptions.py +18 -0
- vllm/v1/engine/llm_engine.py +408 -0
- vllm/v1/engine/logprobs.py +182 -0
- vllm/v1/engine/output_processor.py +642 -0
- vllm/v1/engine/parallel_sampling.py +145 -0
- vllm/v1/engine/processor.py +621 -0
- vllm/v1/engine/utils.py +1072 -0
- vllm/v1/executor/__init__.py +6 -0
- vllm/v1/executor/abstract.py +352 -0
- vllm/v1/executor/multiproc_executor.py +877 -0
- vllm/v1/executor/ray_distributed_executor.py +8 -0
- vllm/v1/executor/ray_executor.py +626 -0
- vllm/v1/executor/ray_utils.py +465 -0
- vllm/v1/executor/uniproc_executor.py +183 -0
- vllm/v1/kv_cache_interface.py +403 -0
- vllm/v1/kv_offload/__init__.py +0 -0
- vllm/v1/kv_offload/abstract.py +161 -0
- vllm/v1/kv_offload/arc_manager.py +237 -0
- vllm/v1/kv_offload/backend.py +97 -0
- vllm/v1/kv_offload/backends/__init__.py +0 -0
- vllm/v1/kv_offload/backends/cpu.py +62 -0
- vllm/v1/kv_offload/cpu.py +93 -0
- vllm/v1/kv_offload/factory.py +56 -0
- vllm/v1/kv_offload/lru_manager.py +139 -0
- vllm/v1/kv_offload/mediums.py +39 -0
- vllm/v1/kv_offload/spec.py +62 -0
- vllm/v1/kv_offload/worker/__init__.py +0 -0
- vllm/v1/kv_offload/worker/cpu_gpu.py +185 -0
- vllm/v1/kv_offload/worker/worker.py +144 -0
- vllm/v1/metrics/__init__.py +0 -0
- vllm/v1/metrics/loggers.py +1238 -0
- vllm/v1/metrics/prometheus.py +82 -0
- vllm/v1/metrics/ray_wrappers.py +169 -0
- vllm/v1/metrics/reader.py +257 -0
- vllm/v1/metrics/stats.py +420 -0
- vllm/v1/outputs.py +249 -0
- vllm/v1/pool/__init__.py +0 -0
- vllm/v1/pool/metadata.py +82 -0
- vllm/v1/request.py +259 -0
- vllm/v1/sample/__init__.py +0 -0
- vllm/v1/sample/logits_processor/__init__.py +352 -0
- vllm/v1/sample/logits_processor/builtin.py +274 -0
- vllm/v1/sample/logits_processor/interface.py +106 -0
- vllm/v1/sample/logits_processor/state.py +165 -0
- vllm/v1/sample/metadata.py +44 -0
- vllm/v1/sample/ops/__init__.py +0 -0
- vllm/v1/sample/ops/bad_words.py +52 -0
- vllm/v1/sample/ops/logprobs.py +25 -0
- vllm/v1/sample/ops/penalties.py +57 -0
- vllm/v1/sample/ops/topk_topp_sampler.py +290 -0
- vllm/v1/sample/rejection_sampler.py +793 -0
- vllm/v1/sample/sampler.py +316 -0
- vllm/v1/sample/tpu/__init__.py +0 -0
- vllm/v1/sample/tpu/metadata.py +120 -0
- vllm/v1/sample/tpu/sampler.py +215 -0
- vllm/v1/serial_utils.py +532 -0
- vllm/v1/spec_decode/__init__.py +0 -0
- vllm/v1/spec_decode/eagle.py +1225 -0
- vllm/v1/spec_decode/medusa.py +73 -0
- vllm/v1/spec_decode/metadata.py +66 -0
- vllm/v1/spec_decode/metrics.py +224 -0
- vllm/v1/spec_decode/ngram_proposer.py +291 -0
- vllm/v1/spec_decode/suffix_decoding.py +103 -0
- vllm/v1/spec_decode/utils.py +16 -0
- vllm/v1/structured_output/__init__.py +338 -0
- vllm/v1/structured_output/backend_guidance.py +265 -0
- vllm/v1/structured_output/backend_lm_format_enforcer.py +177 -0
- vllm/v1/structured_output/backend_outlines.py +324 -0
- vllm/v1/structured_output/backend_types.py +136 -0
- vllm/v1/structured_output/backend_xgrammar.py +362 -0
- vllm/v1/structured_output/request.py +94 -0
- vllm/v1/structured_output/utils.py +469 -0
- vllm/v1/utils.py +414 -0
- vllm/v1/worker/__init__.py +0 -0
- vllm/v1/worker/block_table.py +327 -0
- vllm/v1/worker/cpu_model_runner.py +122 -0
- vllm/v1/worker/cpu_worker.py +206 -0
- vllm/v1/worker/dp_utils.py +230 -0
- vllm/v1/worker/ec_connector_model_runner_mixin.py +87 -0
- vllm/v1/worker/gpu_input_batch.py +975 -0
- vllm/v1/worker/gpu_model_runner.py +5102 -0
- vllm/v1/worker/gpu_ubatch_wrapper.py +466 -0
- vllm/v1/worker/gpu_worker.py +894 -0
- vllm/v1/worker/kv_connector_model_runner_mixin.py +144 -0
- vllm/v1/worker/lora_model_runner_mixin.py +213 -0
- vllm/v1/worker/tpu_input_batch.py +593 -0
- vllm/v1/worker/tpu_model_runner.py +2173 -0
- vllm/v1/worker/tpu_worker.py +355 -0
- vllm/v1/worker/ubatch_utils.py +73 -0
- vllm/v1/worker/ubatching.py +231 -0
- vllm/v1/worker/utils.py +366 -0
- vllm/v1/worker/worker_base.py +375 -0
- vllm/v1/worker/xpu_model_runner.py +55 -0
- vllm/v1/worker/xpu_worker.py +189 -0
- vllm/version.py +39 -0
- vllm/vllm_flash_attn/.gitkeep +0 -0
- vllm_cpu_amxbf16-0.11.2.post2.dist-info/METADATA +345 -0
- vllm_cpu_amxbf16-0.11.2.post2.dist-info/RECORD +1536 -0
- vllm_cpu_amxbf16-0.11.2.post2.dist-info/WHEEL +5 -0
- vllm_cpu_amxbf16-0.11.2.post2.dist-info/entry_points.txt +5 -0
- vllm_cpu_amxbf16-0.11.2.post2.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,1742 @@
|
|
|
1
|
+
# SPDX-License-Identifier: Apache-2.0
|
|
2
|
+
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
|
|
3
|
+
|
|
4
|
+
# Copyright 2025 The Baidu team.
|
|
5
|
+
# Copyright 2023 The vLLM team.
|
|
6
|
+
# Copyright 2022 EleutherAI and the HuggingFace Inc. team. All rights reserved.
|
|
7
|
+
#
|
|
8
|
+
# This code is based on EleutherAI's GPT-NeoX library and the GPT-NeoX
|
|
9
|
+
# and OPT implementations in this library. It has been modified from its
|
|
10
|
+
# original forms to accommodate minor architectural differences compared
|
|
11
|
+
# to GPT-NeoX and OPT used by the Meta AI team that trained the model.
|
|
12
|
+
#
|
|
13
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
14
|
+
# you may not use this file except in compliance with the License.
|
|
15
|
+
# You may obtain a copy of the License at
|
|
16
|
+
#
|
|
17
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
18
|
+
#
|
|
19
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
20
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
21
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
22
|
+
# See the License for the specific language governing permissions and
|
|
23
|
+
# limitations under the License.
|
|
24
|
+
"""Inference-only Erine VL model compatible with HuggingFace weights."""
|
|
25
|
+
|
|
26
|
+
import itertools
|
|
27
|
+
import math
|
|
28
|
+
from collections.abc import Callable, Iterable, Mapping, Sequence
|
|
29
|
+
from functools import partial
|
|
30
|
+
from typing import Annotated, Any, Literal
|
|
31
|
+
|
|
32
|
+
import numpy as np
|
|
33
|
+
import torch
|
|
34
|
+
import torch.nn as nn
|
|
35
|
+
import torch.nn.functional as F
|
|
36
|
+
from einops import rearrange, repeat
|
|
37
|
+
from transformers import BatchFeature
|
|
38
|
+
|
|
39
|
+
from vllm.attention.backends.registry import AttentionBackendEnum
|
|
40
|
+
from vllm.attention.layer import (
|
|
41
|
+
check_upstream_fa_availability,
|
|
42
|
+
maybe_get_vit_flash_attn_backend,
|
|
43
|
+
)
|
|
44
|
+
from vllm.config import VllmConfig
|
|
45
|
+
from vllm.config.multimodal import BaseDummyOptions
|
|
46
|
+
from vllm.distributed import parallel_state
|
|
47
|
+
from vllm.distributed import utils as dist_utils
|
|
48
|
+
from vllm.logger import init_logger
|
|
49
|
+
from vllm.model_executor.layers.activation import QuickGELU
|
|
50
|
+
from vllm.model_executor.layers.layernorm import RMSNorm
|
|
51
|
+
from vllm.model_executor.layers.linear import (
|
|
52
|
+
ColumnParallelLinear,
|
|
53
|
+
QKVParallelLinear,
|
|
54
|
+
RowParallelLinear,
|
|
55
|
+
)
|
|
56
|
+
from vllm.model_executor.layers.quantization import QuantizationConfig
|
|
57
|
+
from vllm.model_executor.model_loader.weight_utils import default_weight_loader
|
|
58
|
+
from vllm.multimodal import MULTIMODAL_REGISTRY
|
|
59
|
+
from vllm.multimodal.inputs import (
|
|
60
|
+
MultiModalDataDict,
|
|
61
|
+
MultiModalFeatureSpec,
|
|
62
|
+
MultiModalFieldConfig,
|
|
63
|
+
MultiModalKwargsItems,
|
|
64
|
+
)
|
|
65
|
+
from vllm.multimodal.parse import ImageSize, MultiModalDataItems
|
|
66
|
+
from vllm.multimodal.processing import (
|
|
67
|
+
BaseMultiModalProcessor,
|
|
68
|
+
BaseProcessingInfo,
|
|
69
|
+
PromptReplacement,
|
|
70
|
+
PromptUpdate,
|
|
71
|
+
)
|
|
72
|
+
from vllm.multimodal.profiling import BaseDummyInputsBuilder
|
|
73
|
+
from vllm.platforms import current_platform
|
|
74
|
+
from vllm.sequence import IntermediateTensors
|
|
75
|
+
from vllm.utils.tensor_schema import TensorSchema, TensorShape
|
|
76
|
+
|
|
77
|
+
from .ernie45_vl_moe import Ernie4_5_VLMoeForCausalLM
|
|
78
|
+
from .interfaces import (
|
|
79
|
+
MultiModalEmbeddings,
|
|
80
|
+
SupportsLoRA,
|
|
81
|
+
SupportsMRoPE,
|
|
82
|
+
SupportsMultiModal,
|
|
83
|
+
SupportsPP,
|
|
84
|
+
)
|
|
85
|
+
from .utils import AutoWeightsLoader, WeightsMapper, maybe_prefix
|
|
86
|
+
from .vision import get_vit_attn_backend
|
|
87
|
+
|
|
88
|
+
logger = init_logger(__name__)
|
|
89
|
+
|
|
90
|
+
# === Vision Transformer === #
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
def rotate_half(x: torch.Tensor, interleaved: bool = False) -> torch.Tensor:
|
|
94
|
+
if not interleaved:
|
|
95
|
+
x1, x2 = x.chunk(2, dim=-1)
|
|
96
|
+
return torch.cat((-x2, x1), dim=-1)
|
|
97
|
+
else:
|
|
98
|
+
x1, x2 = x[..., ::2], x[..., 1::2]
|
|
99
|
+
return rearrange(
|
|
100
|
+
torch.stack((-x2, x1), dim=-1), "... d two -> ... (d two)", two=2
|
|
101
|
+
)
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
def apply_rotary_emb_torch(
|
|
105
|
+
x: torch.Tensor, cos: torch.Tensor, sin: torch.Tensor, interleaved: bool = False
|
|
106
|
+
) -> torch.Tensor:
|
|
107
|
+
"""
|
|
108
|
+
x: (batch_size, seqlen, nheads, headdim)
|
|
109
|
+
cos, sin: (seqlen, rotary_dim / 2) or (batch_size, seqlen, rotary_dim / 2)
|
|
110
|
+
"""
|
|
111
|
+
ro_dim = cos.shape[-1] * 2
|
|
112
|
+
assert ro_dim <= x.shape[-1]
|
|
113
|
+
cos = repeat(
|
|
114
|
+
cos, "... d -> ... 1 (2 d)" if not interleaved else "... d -> ... 1 (d 2)"
|
|
115
|
+
)
|
|
116
|
+
sin = repeat(
|
|
117
|
+
sin, "... d -> ... 1 (2 d)" if not interleaved else "... d -> ... 1 (d 2)"
|
|
118
|
+
)
|
|
119
|
+
return torch.cat(
|
|
120
|
+
[
|
|
121
|
+
x[..., :ro_dim] * cos + rotate_half(x[..., :ro_dim], interleaved) * sin,
|
|
122
|
+
x[..., ro_dim:],
|
|
123
|
+
],
|
|
124
|
+
dim=-1,
|
|
125
|
+
)
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
def apply_rotary_pos_emb_vision(t: torch.Tensor, freqs: torch.Tensor) -> torch.Tensor:
|
|
129
|
+
t_ = t.float()
|
|
130
|
+
cos = freqs.cos()
|
|
131
|
+
sin = freqs.sin()
|
|
132
|
+
apply_rotary_emb = apply_rotary_emb_torch
|
|
133
|
+
if current_platform.is_cuda():
|
|
134
|
+
from vllm.vllm_flash_attn.layers.rotary import apply_rotary_emb
|
|
135
|
+
output = apply_rotary_emb(t_, cos, sin).type_as(t)
|
|
136
|
+
return output
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
def all_gather_interleave(local_tensor, hidden_size: int, tp_size: int):
|
|
140
|
+
"""All-gather the input tensor interleavely across model parallel group."""
|
|
141
|
+
import torch.distributed as dist
|
|
142
|
+
|
|
143
|
+
gathered_tensors = [torch.zeros_like(local_tensor) for _ in range(tp_size)]
|
|
144
|
+
dist.all_gather(
|
|
145
|
+
gathered_tensors, local_tensor, group=parallel_state.get_tp_group().device_group
|
|
146
|
+
)
|
|
147
|
+
|
|
148
|
+
gathered_tensors_split = [
|
|
149
|
+
torch.split(tensor, hidden_size // tp_size, -1) for tensor in gathered_tensors
|
|
150
|
+
]
|
|
151
|
+
ordered_tensors = [
|
|
152
|
+
tensor for pair in zip(*gathered_tensors_split) for tensor in pair
|
|
153
|
+
]
|
|
154
|
+
result_tensor = torch.cat(ordered_tensors, dim=-1)
|
|
155
|
+
return result_tensor
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
class Ernie4_5_VisionAttention(nn.Module):
|
|
159
|
+
"""VisionAttention using VLLM framework APIs"""
|
|
160
|
+
|
|
161
|
+
def __init__(
|
|
162
|
+
self,
|
|
163
|
+
embed_dim: int,
|
|
164
|
+
num_heads: int,
|
|
165
|
+
projection_size: int,
|
|
166
|
+
quant_config: QuantizationConfig | None = None,
|
|
167
|
+
prefix: str = "",
|
|
168
|
+
attn_backend_override: AttentionBackendEnum | None = None,
|
|
169
|
+
) -> None:
|
|
170
|
+
super().__init__()
|
|
171
|
+
# Per attention head and per partition values.
|
|
172
|
+
self.tp_size = parallel_state.get_tensor_model_parallel_world_size()
|
|
173
|
+
self.tp_rank = parallel_state.get_tensor_model_parallel_rank()
|
|
174
|
+
self.hidden_size_per_attention_head = dist_utils.divide(
|
|
175
|
+
projection_size, num_heads
|
|
176
|
+
)
|
|
177
|
+
self.num_attention_heads_per_partition = dist_utils.divide(
|
|
178
|
+
num_heads, self.tp_size
|
|
179
|
+
)
|
|
180
|
+
|
|
181
|
+
self.qkv = QKVParallelLinear(
|
|
182
|
+
hidden_size=embed_dim,
|
|
183
|
+
head_size=self.hidden_size_per_attention_head,
|
|
184
|
+
total_num_heads=num_heads,
|
|
185
|
+
total_num_kv_heads=num_heads,
|
|
186
|
+
bias=True,
|
|
187
|
+
quant_config=quant_config,
|
|
188
|
+
prefix=f"{prefix}.qkv",
|
|
189
|
+
)
|
|
190
|
+
self.proj = RowParallelLinear(
|
|
191
|
+
input_size=projection_size,
|
|
192
|
+
output_size=embed_dim,
|
|
193
|
+
quant_config=quant_config,
|
|
194
|
+
prefix=f"{prefix}.proj",
|
|
195
|
+
)
|
|
196
|
+
|
|
197
|
+
# Detect attention implementation.
|
|
198
|
+
self.attn_backend = get_vit_attn_backend(
|
|
199
|
+
head_size=self.hidden_size_per_attention_head,
|
|
200
|
+
dtype=torch.get_default_dtype(),
|
|
201
|
+
attn_backend_override=attn_backend_override,
|
|
202
|
+
)
|
|
203
|
+
|
|
204
|
+
self.use_upstream_fa = False
|
|
205
|
+
|
|
206
|
+
self.attn_backend, self.flash_attn_varlen_func = (
|
|
207
|
+
maybe_get_vit_flash_attn_backend(
|
|
208
|
+
self.attn_backend,
|
|
209
|
+
self.use_upstream_fa,
|
|
210
|
+
attn_backend_override=attn_backend_override,
|
|
211
|
+
)
|
|
212
|
+
)
|
|
213
|
+
|
|
214
|
+
if self.attn_backend not in {
|
|
215
|
+
AttentionBackendEnum.FLASH_ATTN,
|
|
216
|
+
AttentionBackendEnum.TORCH_SDPA,
|
|
217
|
+
AttentionBackendEnum.XFORMERS,
|
|
218
|
+
AttentionBackendEnum.ROCM_AITER_FA,
|
|
219
|
+
}:
|
|
220
|
+
raise RuntimeError(
|
|
221
|
+
f"Ernie45-VL does not support {self.attn_backend} backend now."
|
|
222
|
+
)
|
|
223
|
+
self.is_flash_attn_backend = self.attn_backend in {
|
|
224
|
+
AttentionBackendEnum.FLASH_ATTN,
|
|
225
|
+
AttentionBackendEnum.ROCM_AITER_FA,
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
def split_qkv(self, qkv: torch.Tensor) -> tuple[torch.Tensor, ...]:
|
|
229
|
+
# [s, b, 3 * head * head_dim]
|
|
230
|
+
seq_len, bs, _ = qkv.shape
|
|
231
|
+
if self.tp_size > 1:
|
|
232
|
+
qkv = all_gather_interleave(qkv, self.qkv.hidden_size, self.tp_size)
|
|
233
|
+
|
|
234
|
+
# [s, b, 3 * head * head_dim] -> 3 * [s, b, head * head_dim]
|
|
235
|
+
q, k, v = qkv.chunk(3, dim=2)
|
|
236
|
+
|
|
237
|
+
# 3 * [s, b, head * head_dim]
|
|
238
|
+
if self.tp_size > 1:
|
|
239
|
+
splitter = partial(
|
|
240
|
+
dist_utils.split_tensor_along_last_dim, num_partitions=self.tp_size
|
|
241
|
+
)
|
|
242
|
+
q = splitter(q)[self.tp_rank]
|
|
243
|
+
k = splitter(k)[self.tp_rank]
|
|
244
|
+
v = splitter(v)[self.tp_rank]
|
|
245
|
+
|
|
246
|
+
# 3 * [s, b, head * head_dim] -> 3 * [s, b, head, head_dim]
|
|
247
|
+
new_shape = (
|
|
248
|
+
seq_len,
|
|
249
|
+
bs,
|
|
250
|
+
self.num_attention_heads_per_partition,
|
|
251
|
+
self.hidden_size_per_attention_head,
|
|
252
|
+
)
|
|
253
|
+
q, k, v = (x.view(*new_shape) for x in (q, k, v))
|
|
254
|
+
return q, k, v
|
|
255
|
+
|
|
256
|
+
def forward(
|
|
257
|
+
self,
|
|
258
|
+
x: torch.Tensor,
|
|
259
|
+
cu_seqlens: torch.Tensor,
|
|
260
|
+
rotary_pos_emb: torch.Tensor,
|
|
261
|
+
max_seqlen: int | None = None, # Only used for Flash Attention
|
|
262
|
+
seqlens: list[int] | None = None, # Only used for xFormers
|
|
263
|
+
) -> torch.Tensor:
|
|
264
|
+
# [s, b, c] --> [s, b, head * 3 * head_dim]
|
|
265
|
+
x, _ = self.qkv(x)
|
|
266
|
+
|
|
267
|
+
# [s, b, 3 * head * head_dim] -> 3 * [s, b, head, head_dim]
|
|
268
|
+
q, k, v = self.split_qkv(x)
|
|
269
|
+
batch_size = q.shape[1]
|
|
270
|
+
|
|
271
|
+
q, k, v = (rearrange(x, "s b ... -> b s ...").contiguous() for x in (q, k, v))
|
|
272
|
+
if rotary_pos_emb is not None:
|
|
273
|
+
qk_concat = torch.cat([q, k], dim=0)
|
|
274
|
+
qk_rotated = apply_rotary_pos_emb_vision(qk_concat, rotary_pos_emb)
|
|
275
|
+
q, k = torch.chunk(qk_rotated, 2, dim=0)
|
|
276
|
+
|
|
277
|
+
if self.is_flash_attn_backend:
|
|
278
|
+
q, k, v = (rearrange(x, "b s ... -> (b s) ...") for x in [q, k, v])
|
|
279
|
+
|
|
280
|
+
output = self.flash_attn_varlen_func(
|
|
281
|
+
q,
|
|
282
|
+
k,
|
|
283
|
+
v,
|
|
284
|
+
cu_seqlens_q=cu_seqlens,
|
|
285
|
+
cu_seqlens_k=cu_seqlens,
|
|
286
|
+
max_seqlen_q=max_seqlen,
|
|
287
|
+
max_seqlen_k=max_seqlen,
|
|
288
|
+
dropout_p=0.0,
|
|
289
|
+
causal=False,
|
|
290
|
+
)
|
|
291
|
+
|
|
292
|
+
context_layer = rearrange(
|
|
293
|
+
output, "(b s) h d -> s b (h d)", b=batch_size
|
|
294
|
+
).contiguous()
|
|
295
|
+
elif self.attn_backend == AttentionBackendEnum.TORCH_SDPA:
|
|
296
|
+
# Execute attention entry by entry for speed & less VRAM.
|
|
297
|
+
outputs = []
|
|
298
|
+
for i in range(1, len(cu_seqlens)):
|
|
299
|
+
start_idx = cu_seqlens[i - 1]
|
|
300
|
+
end_idx = cu_seqlens[i]
|
|
301
|
+
q_i = q[:, start_idx:end_idx]
|
|
302
|
+
k_i = k[:, start_idx:end_idx]
|
|
303
|
+
v_i = v[:, start_idx:end_idx]
|
|
304
|
+
q_i, k_i, v_i = (
|
|
305
|
+
rearrange(x, "b s h d -> b h s d") for x in [q_i, k_i, v_i]
|
|
306
|
+
)
|
|
307
|
+
output_i = F.scaled_dot_product_attention(q_i, k_i, v_i, dropout_p=0.0)
|
|
308
|
+
output_i = rearrange(output_i, "b h s d -> b s h d ")
|
|
309
|
+
outputs.append(output_i)
|
|
310
|
+
context_layer = torch.cat(outputs, dim=1)
|
|
311
|
+
context_layer = rearrange(
|
|
312
|
+
context_layer, "b s h d -> s b (h d)"
|
|
313
|
+
).contiguous()
|
|
314
|
+
elif self.attn_backend == AttentionBackendEnum.XFORMERS:
|
|
315
|
+
from xformers import ops as xops
|
|
316
|
+
from xformers.ops.fmha.attn_bias import BlockDiagonalMask
|
|
317
|
+
|
|
318
|
+
attn_bias = BlockDiagonalMask.from_seqlens(
|
|
319
|
+
q_seqlen=seqlens, kv_seqlen=None, device=q.device
|
|
320
|
+
)
|
|
321
|
+
|
|
322
|
+
context_layer = xops.memory_efficient_attention_forward(
|
|
323
|
+
q, k, v, attn_bias=attn_bias, p=0, scale=None
|
|
324
|
+
)
|
|
325
|
+
context_layer = rearrange(
|
|
326
|
+
context_layer, "b s h d -> s b (h d)"
|
|
327
|
+
).contiguous()
|
|
328
|
+
|
|
329
|
+
output, _ = self.proj(context_layer)
|
|
330
|
+
return output
|
|
331
|
+
|
|
332
|
+
|
|
333
|
+
class Ernie4_5_VisionMLP(nn.Module):
|
|
334
|
+
def __init__(
|
|
335
|
+
self,
|
|
336
|
+
in_features: int,
|
|
337
|
+
hidden_features: int,
|
|
338
|
+
act_layer: type[nn.Module] = QuickGELU,
|
|
339
|
+
quant_config: QuantizationConfig | None = None,
|
|
340
|
+
prefix: str = "",
|
|
341
|
+
):
|
|
342
|
+
super().__init__()
|
|
343
|
+
self.fc1 = ColumnParallelLinear(
|
|
344
|
+
in_features,
|
|
345
|
+
hidden_features,
|
|
346
|
+
quant_config=quant_config,
|
|
347
|
+
prefix=f"{prefix}.fc1",
|
|
348
|
+
)
|
|
349
|
+
self.act = act_layer()
|
|
350
|
+
self.fc2 = RowParallelLinear(
|
|
351
|
+
hidden_features,
|
|
352
|
+
in_features,
|
|
353
|
+
quant_config=quant_config,
|
|
354
|
+
prefix=f"{prefix}.fc2",
|
|
355
|
+
)
|
|
356
|
+
|
|
357
|
+
def forward(self, x: torch.Tensor) -> torch.Tensor:
|
|
358
|
+
x_parallel, _ = self.fc1(x)
|
|
359
|
+
x_parallel = self.act(x_parallel)
|
|
360
|
+
x, _ = self.fc2(x_parallel)
|
|
361
|
+
return x
|
|
362
|
+
|
|
363
|
+
|
|
364
|
+
class Ernie4_5_VisionBlock(nn.Module):
|
|
365
|
+
def __init__(
|
|
366
|
+
self,
|
|
367
|
+
dim: int,
|
|
368
|
+
num_heads: int,
|
|
369
|
+
mlp_ratio: float,
|
|
370
|
+
act_layer: type[nn.Module] = QuickGELU,
|
|
371
|
+
norm_layer: Callable[[int], nn.Module] | None = None,
|
|
372
|
+
quant_config: QuantizationConfig | None = None,
|
|
373
|
+
prefix: str = "",
|
|
374
|
+
attn_backend_override: AttentionBackendEnum | None = None,
|
|
375
|
+
) -> None:
|
|
376
|
+
super().__init__()
|
|
377
|
+
|
|
378
|
+
if norm_layer is None:
|
|
379
|
+
norm_layer = partial(nn.LayerNorm, eps=1e-6)
|
|
380
|
+
self.norm1 = norm_layer(dim)
|
|
381
|
+
self.norm2 = norm_layer(dim)
|
|
382
|
+
mlp_hidden_dim = int(dim * mlp_ratio)
|
|
383
|
+
|
|
384
|
+
self.attn = Ernie4_5_VisionAttention(
|
|
385
|
+
embed_dim=dim,
|
|
386
|
+
num_heads=num_heads,
|
|
387
|
+
projection_size=dim,
|
|
388
|
+
quant_config=quant_config,
|
|
389
|
+
prefix=f"{prefix}.attn",
|
|
390
|
+
attn_backend_override=attn_backend_override,
|
|
391
|
+
)
|
|
392
|
+
|
|
393
|
+
self.mlp = Ernie4_5_VisionMLP(
|
|
394
|
+
dim,
|
|
395
|
+
mlp_hidden_dim,
|
|
396
|
+
act_layer=act_layer,
|
|
397
|
+
quant_config=quant_config,
|
|
398
|
+
prefix=f"{prefix}.mlp",
|
|
399
|
+
)
|
|
400
|
+
|
|
401
|
+
def forward(
|
|
402
|
+
self,
|
|
403
|
+
hidden_states: torch.Tensor,
|
|
404
|
+
cu_seqlens: torch.Tensor,
|
|
405
|
+
rotary_pos_emb: torch.Tensor,
|
|
406
|
+
max_seqlen: int | None = None, # Only used for Flash Attention
|
|
407
|
+
seqlens: list[int] | None = None, # Only used for xFormers
|
|
408
|
+
) -> torch.Tensor:
|
|
409
|
+
hidden_states = hidden_states + self.attn(
|
|
410
|
+
self.norm1(hidden_states),
|
|
411
|
+
cu_seqlens=cu_seqlens,
|
|
412
|
+
rotary_pos_emb=rotary_pos_emb,
|
|
413
|
+
max_seqlen=max_seqlen,
|
|
414
|
+
seqlens=seqlens,
|
|
415
|
+
)
|
|
416
|
+
hidden_states = hidden_states + self.mlp(self.norm2(hidden_states))
|
|
417
|
+
return hidden_states
|
|
418
|
+
|
|
419
|
+
|
|
420
|
+
class Ernie4_5_VisionPatchEmbed(nn.Module):
|
|
421
|
+
def __init__(
|
|
422
|
+
self,
|
|
423
|
+
patch_size: int = 14,
|
|
424
|
+
in_channels: int = 3,
|
|
425
|
+
embed_dim: int = 1280,
|
|
426
|
+
prefix="",
|
|
427
|
+
) -> None:
|
|
428
|
+
super().__init__()
|
|
429
|
+
self.patch_size = patch_size
|
|
430
|
+
self.in_channels = in_channels
|
|
431
|
+
self.embed_dim = embed_dim
|
|
432
|
+
|
|
433
|
+
self.proj = nn.Linear(
|
|
434
|
+
in_channels * patch_size * patch_size, embed_dim, bias=False
|
|
435
|
+
)
|
|
436
|
+
|
|
437
|
+
def forward(self, hidden_states: torch.Tensor) -> torch.Tensor:
|
|
438
|
+
target_dtype = self.proj.weight.dtype
|
|
439
|
+
hidden_states = hidden_states.to(target_dtype)
|
|
440
|
+
hidden_states = self.proj(hidden_states)
|
|
441
|
+
|
|
442
|
+
return hidden_states
|
|
443
|
+
|
|
444
|
+
|
|
445
|
+
class Ernie4_5_VisionRotaryEmbedding(nn.Module):
|
|
446
|
+
def __init__(self, dim: int, theta: float = 10000.0) -> None:
|
|
447
|
+
super().__init__()
|
|
448
|
+
self.inv_freq = 1.0 / theta ** (
|
|
449
|
+
torch.arange(start=0, end=dim, step=2, dtype=torch.float32) / dim
|
|
450
|
+
)
|
|
451
|
+
|
|
452
|
+
def forward(self, seqlen: int) -> torch.Tensor:
|
|
453
|
+
seq = torch.arange(
|
|
454
|
+
seqlen, device=self.inv_freq.device, dtype=self.inv_freq.dtype
|
|
455
|
+
)
|
|
456
|
+
freqs = torch.outer(input=seq, vec2=self.inv_freq)
|
|
457
|
+
return freqs
|
|
458
|
+
|
|
459
|
+
|
|
460
|
+
class Ernie4_5_VisionTransformer(nn.Module):
|
|
461
|
+
def __init__(
|
|
462
|
+
self,
|
|
463
|
+
vision_config,
|
|
464
|
+
norm_eps: float = 1e-6,
|
|
465
|
+
quant_config: QuantizationConfig | None = None,
|
|
466
|
+
prefix: str = "",
|
|
467
|
+
attn_backend_override: AttentionBackendEnum | None = None,
|
|
468
|
+
) -> None:
|
|
469
|
+
super().__init__()
|
|
470
|
+
patch_size = vision_config.patch_size
|
|
471
|
+
spatial_merge_size = vision_config.spatial_merge_size
|
|
472
|
+
in_channels = vision_config.in_channels
|
|
473
|
+
hidden_size = vision_config.hidden_size
|
|
474
|
+
embed_dim = vision_config.embed_dim
|
|
475
|
+
depth = vision_config.depth
|
|
476
|
+
num_heads = vision_config.num_heads
|
|
477
|
+
mlp_ratio = vision_config.mlp_ratio
|
|
478
|
+
|
|
479
|
+
self.spatial_merge_size = spatial_merge_size
|
|
480
|
+
self.num_heads = num_heads
|
|
481
|
+
self.embed_dim = embed_dim
|
|
482
|
+
|
|
483
|
+
self.patch_embed = Ernie4_5_VisionPatchEmbed(
|
|
484
|
+
patch_size=patch_size,
|
|
485
|
+
in_channels=in_channels,
|
|
486
|
+
embed_dim=embed_dim,
|
|
487
|
+
prefix=f"{prefix}.patch_embed",
|
|
488
|
+
)
|
|
489
|
+
|
|
490
|
+
norm_layer = partial(nn.LayerNorm, eps=norm_eps)
|
|
491
|
+
head_dim = embed_dim // num_heads
|
|
492
|
+
self.rotary_pos_emb = Ernie4_5_VisionRotaryEmbedding(head_dim // 2)
|
|
493
|
+
|
|
494
|
+
self.blocks = nn.ModuleList(
|
|
495
|
+
[
|
|
496
|
+
Ernie4_5_VisionBlock(
|
|
497
|
+
dim=embed_dim,
|
|
498
|
+
num_heads=num_heads,
|
|
499
|
+
mlp_ratio=mlp_ratio,
|
|
500
|
+
norm_layer=norm_layer,
|
|
501
|
+
quant_config=quant_config,
|
|
502
|
+
prefix=f"{prefix}.blocks.{layer_idx}",
|
|
503
|
+
attn_backend_override=attn_backend_override,
|
|
504
|
+
)
|
|
505
|
+
for layer_idx in range(depth)
|
|
506
|
+
]
|
|
507
|
+
)
|
|
508
|
+
|
|
509
|
+
assert hidden_size == embed_dim, (
|
|
510
|
+
"vit's config.hidden must be equal to config.embed_dim"
|
|
511
|
+
)
|
|
512
|
+
self.ln = nn.LayerNorm(hidden_size, eps=1e-6)
|
|
513
|
+
|
|
514
|
+
self.attn_backend = get_vit_attn_backend(
|
|
515
|
+
head_size=head_dim,
|
|
516
|
+
dtype=torch.get_default_dtype(),
|
|
517
|
+
attn_backend_override=attn_backend_override,
|
|
518
|
+
)
|
|
519
|
+
if (
|
|
520
|
+
self.attn_backend != AttentionBackendEnum.FLASH_ATTN
|
|
521
|
+
and check_upstream_fa_availability(torch.get_default_dtype())
|
|
522
|
+
):
|
|
523
|
+
self.attn_backend = AttentionBackendEnum.FLASH_ATTN
|
|
524
|
+
|
|
525
|
+
@property
|
|
526
|
+
def dtype(self) -> torch.dtype:
|
|
527
|
+
return self.patch_embed.proj.weight.dtype
|
|
528
|
+
|
|
529
|
+
@property
|
|
530
|
+
def device(self) -> torch.device:
|
|
531
|
+
return self.patch_embed.proj.weight.device
|
|
532
|
+
|
|
533
|
+
def rot_pos_emb(self, grid_thw: torch.Tensor) -> torch.Tensor:
|
|
534
|
+
pos_ids = []
|
|
535
|
+
for t, h, w in grid_thw:
|
|
536
|
+
hpos_ids = torch.arange(h).unsqueeze(1).expand(-1, w)
|
|
537
|
+
wpos_ids = torch.arange(w).unsqueeze(0).expand(h, -1)
|
|
538
|
+
hpos_ids = (
|
|
539
|
+
hpos_ids.reshape(
|
|
540
|
+
h // self.spatial_merge_size,
|
|
541
|
+
self.spatial_merge_size,
|
|
542
|
+
w // self.spatial_merge_size,
|
|
543
|
+
self.spatial_merge_size,
|
|
544
|
+
)
|
|
545
|
+
.permute(0, 2, 1, 3)
|
|
546
|
+
.flatten()
|
|
547
|
+
)
|
|
548
|
+
wpos_ids = (
|
|
549
|
+
wpos_ids.reshape(
|
|
550
|
+
h // self.spatial_merge_size,
|
|
551
|
+
self.spatial_merge_size,
|
|
552
|
+
w // self.spatial_merge_size,
|
|
553
|
+
self.spatial_merge_size,
|
|
554
|
+
)
|
|
555
|
+
.permute(0, 2, 1, 3)
|
|
556
|
+
.flatten()
|
|
557
|
+
)
|
|
558
|
+
pos_ids.append(torch.stack([hpos_ids, wpos_ids], dim=-1).repeat(t, 1))
|
|
559
|
+
pos_ids = torch.cat(pos_ids, dim=0)
|
|
560
|
+
max_grid_size = grid_thw[:, 1:].max()
|
|
561
|
+
rotary_pos_emb_full = self.rotary_pos_emb(max_grid_size)
|
|
562
|
+
rotary_pos_emb = rotary_pos_emb_full[pos_ids].flatten(1)
|
|
563
|
+
return rotary_pos_emb
|
|
564
|
+
|
|
565
|
+
def compute_attn_mask_seqlen(
|
|
566
|
+
self, cu_seqlens: torch.Tensor
|
|
567
|
+
) -> tuple[int | None, list[int] | None]:
|
|
568
|
+
max_seqlen, seqlens = None, None
|
|
569
|
+
if (
|
|
570
|
+
self.attn_backend == AttentionBackendEnum.FLASH_ATTN
|
|
571
|
+
or self.attn_backend == AttentionBackendEnum.ROCM_AITER_FA
|
|
572
|
+
):
|
|
573
|
+
max_seqlen = (cu_seqlens[1:] - cu_seqlens[:-1]).max().item()
|
|
574
|
+
elif self.attn_backend == AttentionBackendEnum.XFORMERS:
|
|
575
|
+
seqlens = (cu_seqlens[1:] - cu_seqlens[:-1]).tolist()
|
|
576
|
+
return max_seqlen, seqlens
|
|
577
|
+
|
|
578
|
+
def forward(
|
|
579
|
+
self, hidden_states: torch.Tensor, grid_thw: torch.Tensor, num_pad=0
|
|
580
|
+
) -> torch.Tensor:
|
|
581
|
+
hidden_states = self.patch_embed(hidden_states)
|
|
582
|
+
|
|
583
|
+
rotary_pos_emb = self.rot_pos_emb(grid_thw)
|
|
584
|
+
rotary_pos_emb = rotary_pos_emb.to(hidden_states.device)
|
|
585
|
+
|
|
586
|
+
cu_seqlens = torch.repeat_interleave(
|
|
587
|
+
grid_thw[:, 1] * grid_thw[:, 2], grid_thw[:, 0]
|
|
588
|
+
).cumsum(dim=0, dtype=torch.int32)
|
|
589
|
+
|
|
590
|
+
zeros = cu_seqlens.new_zeros(1)
|
|
591
|
+
if num_pad > 0:
|
|
592
|
+
cu_seqlens = torch.cat([zeros, cu_seqlens, zeros])
|
|
593
|
+
cu_seqlens[-1] = cu_seqlens[-2] + num_pad
|
|
594
|
+
else:
|
|
595
|
+
cu_seqlens = torch.cat([zeros, cu_seqlens])
|
|
596
|
+
|
|
597
|
+
# add batch size
|
|
598
|
+
if hidden_states.ndim == 2:
|
|
599
|
+
hidden_states = hidden_states.unsqueeze(dim=1)
|
|
600
|
+
|
|
601
|
+
# pre-compute seqlens for attn mask to reduce cuMemcpy operations
|
|
602
|
+
max_seqlen, seqlens = self.compute_attn_mask_seqlen(cu_seqlens)
|
|
603
|
+
|
|
604
|
+
for i, blk in enumerate(self.blocks):
|
|
605
|
+
hidden_states = blk(
|
|
606
|
+
hidden_states,
|
|
607
|
+
cu_seqlens=cu_seqlens,
|
|
608
|
+
rotary_pos_emb=rotary_pos_emb,
|
|
609
|
+
max_seqlen=max_seqlen,
|
|
610
|
+
seqlens=seqlens,
|
|
611
|
+
)
|
|
612
|
+
|
|
613
|
+
final_output = self.ln(hidden_states)
|
|
614
|
+
|
|
615
|
+
if final_output.ndim == 3:
|
|
616
|
+
final_output = final_output.squeeze(dim=1)
|
|
617
|
+
|
|
618
|
+
return final_output
|
|
619
|
+
|
|
620
|
+
def load_weights(self, weights) -> set[str]:
|
|
621
|
+
params_dict = dict(self.named_parameters(remove_duplicate=False))
|
|
622
|
+
loaded_params: set[str] = set()
|
|
623
|
+
|
|
624
|
+
for name, loaded_weight in weights:
|
|
625
|
+
param = params_dict[name]
|
|
626
|
+
weight_loader = getattr(param, "weight_loader", default_weight_loader)
|
|
627
|
+
weight_loader(param, loaded_weight)
|
|
628
|
+
loaded_params.add(name)
|
|
629
|
+
return loaded_params
|
|
630
|
+
|
|
631
|
+
|
|
632
|
+
# === Vision Inputs === #
|
|
633
|
+
|
|
634
|
+
|
|
635
|
+
class Ernie4_5_VLImagePixelInputs(TensorSchema):
|
|
636
|
+
"""
|
|
637
|
+
Dimensions:
|
|
638
|
+
- np: The total number of patches over each image over each prompt in
|
|
639
|
+
the batch
|
|
640
|
+
- ni: Number of images
|
|
641
|
+
- cps: Number of channels * patch_size * patch_size
|
|
642
|
+
"""
|
|
643
|
+
|
|
644
|
+
type: Literal["pixel_values"]
|
|
645
|
+
|
|
646
|
+
pixel_values: Annotated[torch.Tensor, TensorShape("np", "cps")]
|
|
647
|
+
image_grid_thw: Annotated[torch.Tensor, TensorShape("ni", 3)]
|
|
648
|
+
|
|
649
|
+
|
|
650
|
+
Ernie4_5_VLImageInputs = Ernie4_5_VLImagePixelInputs
|
|
651
|
+
|
|
652
|
+
|
|
653
|
+
class Ernie4_5_VLVideoPixelInputs(TensorSchema):
|
|
654
|
+
"""
|
|
655
|
+
Dimensions:
|
|
656
|
+
- np: The total number of patches over each image over each prompt in
|
|
657
|
+
the batch
|
|
658
|
+
- ni: Number of images
|
|
659
|
+
- cps: Number of channels * temporal_patch_size * patch_size *
|
|
660
|
+
patch_size
|
|
661
|
+
"""
|
|
662
|
+
|
|
663
|
+
type: Literal["pixel_values_videos"]
|
|
664
|
+
pixel_values_videos: Annotated[torch.Tensor, TensorShape("np", "cps")]
|
|
665
|
+
video_grid_thw: Annotated[torch.Tensor, TensorShape("ni", 3)]
|
|
666
|
+
|
|
667
|
+
|
|
668
|
+
Ernie4_5_VLVideoInputs = Ernie4_5_VLVideoPixelInputs
|
|
669
|
+
|
|
670
|
+
# === Vision Processor === #
|
|
671
|
+
|
|
672
|
+
|
|
673
|
+
def round_by_factor(number: int | float, factor: int) -> int:
|
|
674
|
+
return round(number / factor) * factor
|
|
675
|
+
|
|
676
|
+
|
|
677
|
+
def ceil_by_factor(number: int | float, factor: int) -> int:
|
|
678
|
+
return math.ceil(number / factor) * factor
|
|
679
|
+
|
|
680
|
+
|
|
681
|
+
def floor_by_factor(number: int | float, factor: int) -> int:
|
|
682
|
+
return math.floor(number / factor) * factor
|
|
683
|
+
|
|
684
|
+
|
|
685
|
+
def smart_resize(
|
|
686
|
+
height: int,
|
|
687
|
+
width: int,
|
|
688
|
+
factor: int = 28,
|
|
689
|
+
min_pixels: int = 4 * 28 * 28,
|
|
690
|
+
max_pixels: int = 16384 * 28 * 28,
|
|
691
|
+
):
|
|
692
|
+
MAX_RATIO = 200
|
|
693
|
+
if max(height, width) / min(height, width) > MAX_RATIO:
|
|
694
|
+
if height > width:
|
|
695
|
+
new_width = max(factor, round_by_factor(width, factor))
|
|
696
|
+
new_height = floor_by_factor(new_width * MAX_RATIO, factor)
|
|
697
|
+
else:
|
|
698
|
+
new_height = max(factor, round_by_factor(height, factor))
|
|
699
|
+
new_width = floor_by_factor(new_height * MAX_RATIO, factor)
|
|
700
|
+
|
|
701
|
+
height = new_height
|
|
702
|
+
width = new_width
|
|
703
|
+
|
|
704
|
+
h_bar = max(factor, round_by_factor(height, factor))
|
|
705
|
+
w_bar = max(factor, round_by_factor(width, factor))
|
|
706
|
+
if h_bar * w_bar > max_pixels:
|
|
707
|
+
beta = math.sqrt((height * width) / max_pixels)
|
|
708
|
+
h_bar = floor_by_factor(height / beta, factor)
|
|
709
|
+
w_bar = floor_by_factor(width / beta, factor)
|
|
710
|
+
elif h_bar * w_bar < min_pixels:
|
|
711
|
+
beta = math.sqrt(min_pixels / (height * width))
|
|
712
|
+
h_bar = ceil_by_factor(height * beta, factor)
|
|
713
|
+
w_bar = ceil_by_factor(width * beta, factor)
|
|
714
|
+
|
|
715
|
+
if min_pixels > h_bar * w_bar or h_bar * w_bar > max_pixels:
|
|
716
|
+
raise ValueError(f"encounter invalid h_bar: {h_bar}, w_bar: {w_bar}")
|
|
717
|
+
|
|
718
|
+
return h_bar, w_bar
|
|
719
|
+
|
|
720
|
+
|
|
721
|
+
class VariableResolutionResamplerModel(nn.Module):
|
|
722
|
+
def __init__(
|
|
723
|
+
self,
|
|
724
|
+
in_dim,
|
|
725
|
+
out_dim,
|
|
726
|
+
spatial_conv_size,
|
|
727
|
+
temporal_conv_size,
|
|
728
|
+
config,
|
|
729
|
+
prefix: str = "",
|
|
730
|
+
) -> None:
|
|
731
|
+
super().__init__()
|
|
732
|
+
self.in_dim = in_dim
|
|
733
|
+
self.out_dim = out_dim
|
|
734
|
+
self.config = config
|
|
735
|
+
self.spatial_conv_size = spatial_conv_size
|
|
736
|
+
self.temporal_conv_size = temporal_conv_size
|
|
737
|
+
self.use_temporal_conv = config.use_temporal_conv
|
|
738
|
+
|
|
739
|
+
# compress 2d conv(picture) to 1d
|
|
740
|
+
self.spatial_dim = self.in_dim * self.spatial_conv_size * self.spatial_conv_size
|
|
741
|
+
# compress 3d conv(video) to 1d
|
|
742
|
+
self.temporal_dim = (
|
|
743
|
+
self.in_dim
|
|
744
|
+
* self.spatial_conv_size
|
|
745
|
+
* self.spatial_conv_size
|
|
746
|
+
* self.temporal_conv_size
|
|
747
|
+
)
|
|
748
|
+
|
|
749
|
+
self.spatial_linear1 = ColumnParallelLinear(
|
|
750
|
+
self.spatial_dim,
|
|
751
|
+
self.spatial_dim,
|
|
752
|
+
bias=True,
|
|
753
|
+
gather_output=True,
|
|
754
|
+
quant_config=getattr(config, "quant_config", None),
|
|
755
|
+
prefix=f"{prefix}.spatial_linear1",
|
|
756
|
+
)
|
|
757
|
+
|
|
758
|
+
self.spatial_gelu = nn.GELU()
|
|
759
|
+
|
|
760
|
+
self.spatial_linear2 = ColumnParallelLinear(
|
|
761
|
+
self.spatial_dim,
|
|
762
|
+
self.spatial_dim,
|
|
763
|
+
bias=True,
|
|
764
|
+
gather_output=True,
|
|
765
|
+
quant_config=getattr(config, "quant_config", None),
|
|
766
|
+
prefix=f"{prefix}.spatial_linear2",
|
|
767
|
+
)
|
|
768
|
+
|
|
769
|
+
self.spatial_norm = nn.LayerNorm(self.spatial_dim, eps=1e-6)
|
|
770
|
+
|
|
771
|
+
if self.use_temporal_conv:
|
|
772
|
+
self.temporal_linear1 = ColumnParallelLinear(
|
|
773
|
+
self.temporal_dim,
|
|
774
|
+
self.spatial_dim,
|
|
775
|
+
bias=True,
|
|
776
|
+
gather_output=True,
|
|
777
|
+
quant_config=getattr(config, "quant_config", None),
|
|
778
|
+
prefix=f"{prefix}.temporal_linear1",
|
|
779
|
+
)
|
|
780
|
+
|
|
781
|
+
self.temporal_gelu = nn.GELU()
|
|
782
|
+
|
|
783
|
+
self.temporal_linear2 = ColumnParallelLinear(
|
|
784
|
+
self.spatial_dim,
|
|
785
|
+
self.spatial_dim,
|
|
786
|
+
bias=True,
|
|
787
|
+
gather_output=True,
|
|
788
|
+
quant_config=getattr(config, "quant_config", None),
|
|
789
|
+
prefix=f"{prefix}.temporal_linear2",
|
|
790
|
+
)
|
|
791
|
+
|
|
792
|
+
self.temporal_norm = nn.LayerNorm(self.spatial_dim, eps=1e-6)
|
|
793
|
+
|
|
794
|
+
self.mlp = ColumnParallelLinear(
|
|
795
|
+
self.spatial_dim,
|
|
796
|
+
self.out_dim,
|
|
797
|
+
bias=True,
|
|
798
|
+
gather_output=True,
|
|
799
|
+
quant_config=getattr(config, "quant_config", None),
|
|
800
|
+
prefix=f"{prefix}.mlp",
|
|
801
|
+
)
|
|
802
|
+
|
|
803
|
+
self.after_norm = RMSNorm(
|
|
804
|
+
hidden_size=out_dim, eps=getattr(config, "rms_norm_eps", 1e-6)
|
|
805
|
+
)
|
|
806
|
+
|
|
807
|
+
def spatial_conv_reshape(self, x, spatial_conv_size):
|
|
808
|
+
S, C = x.shape
|
|
809
|
+
x = x.reshape([-1, C * (spatial_conv_size**2)])
|
|
810
|
+
return x
|
|
811
|
+
|
|
812
|
+
def forward(self, x, grid_thw):
|
|
813
|
+
def fwd_spatial(x):
|
|
814
|
+
x = self.spatial_conv_reshape(x, self.spatial_conv_size)
|
|
815
|
+
|
|
816
|
+
x, _ = self.spatial_linear1(x)
|
|
817
|
+
x = self.spatial_gelu(x)
|
|
818
|
+
x, _ = self.spatial_linear2(x)
|
|
819
|
+
x = self.spatial_norm(x)
|
|
820
|
+
|
|
821
|
+
return x
|
|
822
|
+
|
|
823
|
+
def fwd_placeholder(x, grid_thw, to_tensor=False):
|
|
824
|
+
grid_thw_cpu = grid_thw.cpu().numpy()
|
|
825
|
+
grid_t, grid_hw = grid_thw_cpu[:, 0], grid_thw_cpu[:, 1:]
|
|
826
|
+
grid_hw_after_conv = grid_hw.prod(-1) // (self.spatial_conv_size**2)
|
|
827
|
+
|
|
828
|
+
tokens_per_img_or_vid = grid_thw_cpu.prod(-1) // (self.spatial_conv_size**2)
|
|
829
|
+
batch_offset = np.empty(
|
|
830
|
+
tokens_per_img_or_vid.size, dtype=tokens_per_img_or_vid.dtype
|
|
831
|
+
)
|
|
832
|
+
batch_offset[0] = 0
|
|
833
|
+
batch_offset[1:] = tokens_per_img_or_vid.cumsum()[:-1]
|
|
834
|
+
|
|
835
|
+
slice_offsets = []
|
|
836
|
+
for temporoal_size, spatial_size, b_offset in zip(
|
|
837
|
+
grid_t, grid_hw_after_conv, batch_offset
|
|
838
|
+
):
|
|
839
|
+
for temp_offset in range(0, temporoal_size, 2):
|
|
840
|
+
slice_offsets.append(
|
|
841
|
+
np.arange(
|
|
842
|
+
b_offset + (temp_offset) * spatial_size,
|
|
843
|
+
b_offset + (temp_offset + 1) * spatial_size,
|
|
844
|
+
)
|
|
845
|
+
)
|
|
846
|
+
slice_offsets = torch.tensor(np.concatenate(slice_offsets, axis=-1)).to(
|
|
847
|
+
x.device
|
|
848
|
+
)
|
|
849
|
+
|
|
850
|
+
slice_offsets2 = []
|
|
851
|
+
for temporoal_size, spatial_size, b_offset in zip(
|
|
852
|
+
grid_t, grid_hw_after_conv, batch_offset
|
|
853
|
+
):
|
|
854
|
+
for temp_offset in range(
|
|
855
|
+
1 if temporoal_size > 1 else 0, temporoal_size, 2
|
|
856
|
+
):
|
|
857
|
+
slice_offsets2.append(
|
|
858
|
+
np.arange(
|
|
859
|
+
b_offset + (temp_offset) * spatial_size,
|
|
860
|
+
b_offset + (temp_offset + 1) * spatial_size,
|
|
861
|
+
)
|
|
862
|
+
)
|
|
863
|
+
slice_offsets2 = torch.tensor(np.concatenate(slice_offsets2, axis=-1)).to(
|
|
864
|
+
x.device
|
|
865
|
+
)
|
|
866
|
+
|
|
867
|
+
x_timestep_1 = torch.index_select(x, dim=0, index=slice_offsets)
|
|
868
|
+
x_timestep_2 = torch.index_select(x, dim=0, index=slice_offsets2)
|
|
869
|
+
x = torch.concat([x_timestep_1, x_timestep_2], dim=-1)
|
|
870
|
+
return x
|
|
871
|
+
|
|
872
|
+
def fwd_temporal(x):
|
|
873
|
+
x, _ = self.temporal_linear1(x)
|
|
874
|
+
x = self.temporal_gelu(x)
|
|
875
|
+
x, _ = self.temporal_linear2(x)
|
|
876
|
+
x = self.temporal_norm(x)
|
|
877
|
+
return x
|
|
878
|
+
|
|
879
|
+
def fwd_mlp(x):
|
|
880
|
+
x, _ = self.mlp(x)
|
|
881
|
+
x = self.after_norm(x)
|
|
882
|
+
return x
|
|
883
|
+
|
|
884
|
+
x = fwd_spatial(x)
|
|
885
|
+
if self.use_temporal_conv:
|
|
886
|
+
x = fwd_placeholder(x, grid_thw)
|
|
887
|
+
x = fwd_temporal(x)
|
|
888
|
+
x = fwd_mlp(x)
|
|
889
|
+
return x
|
|
890
|
+
|
|
891
|
+
def load_weights(self, weights: Iterable[tuple[str, torch.Tensor]]) -> set[str]:
|
|
892
|
+
params_dict = dict(self.named_parameters(remove_duplicate=False))
|
|
893
|
+
loaded_params: set[str] = set()
|
|
894
|
+
|
|
895
|
+
for name, loaded_weight in weights:
|
|
896
|
+
if name not in params_dict:
|
|
897
|
+
continue
|
|
898
|
+
param = params_dict[name]
|
|
899
|
+
weight_loader = getattr(param, "weight_loader", default_weight_loader)
|
|
900
|
+
weight_loader(param, loaded_weight)
|
|
901
|
+
loaded_params.add(name)
|
|
902
|
+
return loaded_params
|
|
903
|
+
|
|
904
|
+
|
|
905
|
+
class Ernie4_5_VLProcessingInfo(BaseProcessingInfo):
|
|
906
|
+
def get_hf_config(self):
|
|
907
|
+
return self.ctx.model_config.hf_config
|
|
908
|
+
|
|
909
|
+
def get_hf_processor(self, **kwargs: object):
|
|
910
|
+
return self.ctx.get_hf_processor(use_fast=True, **kwargs)
|
|
911
|
+
|
|
912
|
+
def get_image_processor(self, **kwargs: object):
|
|
913
|
+
return self.get_hf_processor(**kwargs).image_processor
|
|
914
|
+
|
|
915
|
+
def get_supported_mm_limits(self) -> Mapping[str, int | None]:
|
|
916
|
+
return {"image": None, "video": None}
|
|
917
|
+
|
|
918
|
+
def get_mm_max_tokens_per_item(
|
|
919
|
+
self,
|
|
920
|
+
seq_len: int,
|
|
921
|
+
mm_counts: Mapping[str, int],
|
|
922
|
+
) -> Mapping[str, int]:
|
|
923
|
+
max_image_tokens = self.get_max_image_tokens()
|
|
924
|
+
max_video_tokens = self.get_max_video_tokens(seq_len, mm_counts)
|
|
925
|
+
return {"image": max_image_tokens, "video": max_video_tokens}
|
|
926
|
+
|
|
927
|
+
def _get_vision_info(
|
|
928
|
+
self,
|
|
929
|
+
*,
|
|
930
|
+
image_width: int,
|
|
931
|
+
image_height: int,
|
|
932
|
+
num_frames: int = 1,
|
|
933
|
+
do_resize: bool = True,
|
|
934
|
+
image_processor: Any | None,
|
|
935
|
+
) -> tuple[ImageSize, int]:
|
|
936
|
+
if image_processor is None:
|
|
937
|
+
image_processor = self.get_image_processor()
|
|
938
|
+
hf_config = self.get_hf_config()
|
|
939
|
+
vision_config = hf_config.vision_config
|
|
940
|
+
|
|
941
|
+
patch_size = vision_config.patch_size
|
|
942
|
+
spatial_conv_size = hf_config.spatial_conv_size
|
|
943
|
+
temporal_conv_size = hf_config.temporal_conv_size
|
|
944
|
+
|
|
945
|
+
if do_resize:
|
|
946
|
+
resized_height, resized_width = smart_resize(
|
|
947
|
+
height=image_height,
|
|
948
|
+
width=image_width,
|
|
949
|
+
factor=patch_size * spatial_conv_size,
|
|
950
|
+
min_pixels=image_processor.min_pixels,
|
|
951
|
+
max_pixels=image_processor.max_pixels,
|
|
952
|
+
)
|
|
953
|
+
preprocessed_size = ImageSize(width=resized_width, height=resized_height)
|
|
954
|
+
else:
|
|
955
|
+
preprocessed_size = ImageSize(width=image_width, height=image_height)
|
|
956
|
+
|
|
957
|
+
grid_t = max(num_frames // temporal_conv_size, 1)
|
|
958
|
+
grid_h = preprocessed_size.height // patch_size
|
|
959
|
+
grid_w = preprocessed_size.width // patch_size
|
|
960
|
+
|
|
961
|
+
num_patches = grid_t * grid_h * grid_w
|
|
962
|
+
num_vision_tokens = num_patches // (spatial_conv_size**2)
|
|
963
|
+
|
|
964
|
+
return preprocessed_size, num_vision_tokens
|
|
965
|
+
|
|
966
|
+
def get_num_image_tokens(
|
|
967
|
+
self,
|
|
968
|
+
*,
|
|
969
|
+
image_width: int,
|
|
970
|
+
image_height: int,
|
|
971
|
+
image_processor: Any | None,
|
|
972
|
+
) -> int:
|
|
973
|
+
_, num_image_tokens = self._get_vision_info(
|
|
974
|
+
image_width=image_width,
|
|
975
|
+
image_height=image_height,
|
|
976
|
+
image_processor=image_processor,
|
|
977
|
+
)
|
|
978
|
+
return num_image_tokens
|
|
979
|
+
|
|
980
|
+
def get_num_video_tokens(
|
|
981
|
+
self,
|
|
982
|
+
*,
|
|
983
|
+
image_width: int,
|
|
984
|
+
image_height: int,
|
|
985
|
+
num_frames: int,
|
|
986
|
+
image_processor: Any | None,
|
|
987
|
+
) -> int:
|
|
988
|
+
_, num_video_tokens = self._get_vision_info(
|
|
989
|
+
image_width=image_width,
|
|
990
|
+
image_height=image_height,
|
|
991
|
+
num_frames=num_frames,
|
|
992
|
+
image_processor=image_processor,
|
|
993
|
+
)
|
|
994
|
+
return num_video_tokens
|
|
995
|
+
|
|
996
|
+
def get_image_size_with_most_features(self) -> ImageSize:
|
|
997
|
+
max_image_size, _ = self._get_vision_info(
|
|
998
|
+
image_width=9999999,
|
|
999
|
+
image_height=9999999,
|
|
1000
|
+
image_processor=None,
|
|
1001
|
+
)
|
|
1002
|
+
return max_image_size
|
|
1003
|
+
|
|
1004
|
+
def get_max_image_tokens(self) -> int:
|
|
1005
|
+
target_width, target_height = self.get_image_size_with_most_features()
|
|
1006
|
+
|
|
1007
|
+
num_image_tokens = self.get_num_image_tokens(
|
|
1008
|
+
image_width=target_width,
|
|
1009
|
+
image_height=target_height,
|
|
1010
|
+
image_processor=None,
|
|
1011
|
+
)
|
|
1012
|
+
return num_image_tokens
|
|
1013
|
+
|
|
1014
|
+
def _get_max_video_frames(self, max_tokens: int) -> int:
|
|
1015
|
+
target_width, target_height = self.get_image_size_with_most_features()
|
|
1016
|
+
|
|
1017
|
+
num_frames = 0
|
|
1018
|
+
|
|
1019
|
+
while True:
|
|
1020
|
+
next_num_frames = num_frames + 1
|
|
1021
|
+
next_max_tokens = self.get_num_video_tokens(
|
|
1022
|
+
image_width=target_width,
|
|
1023
|
+
image_height=target_height,
|
|
1024
|
+
num_frames=next_num_frames,
|
|
1025
|
+
image_processor=None,
|
|
1026
|
+
)
|
|
1027
|
+
|
|
1028
|
+
if next_max_tokens > max_tokens:
|
|
1029
|
+
break
|
|
1030
|
+
|
|
1031
|
+
num_frames = next_num_frames
|
|
1032
|
+
|
|
1033
|
+
# If the number of frames is odd, discard one frame.
|
|
1034
|
+
if num_frames % 2 != 0:
|
|
1035
|
+
num_frames -= 1
|
|
1036
|
+
|
|
1037
|
+
return num_frames
|
|
1038
|
+
|
|
1039
|
+
def get_num_frames_with_most_features(
|
|
1040
|
+
self,
|
|
1041
|
+
seq_len: int,
|
|
1042
|
+
mm_counts: Mapping[str, int],
|
|
1043
|
+
) -> int:
|
|
1044
|
+
max_images = mm_counts.get("image", 0)
|
|
1045
|
+
max_videos = mm_counts.get("video", 0)
|
|
1046
|
+
|
|
1047
|
+
max_image_tokens = self.get_max_image_tokens() * max_images
|
|
1048
|
+
max_total_frames = self._get_max_video_frames(seq_len - max_image_tokens)
|
|
1049
|
+
max_frames_per_video = max_total_frames // max(max_videos, 1)
|
|
1050
|
+
|
|
1051
|
+
return max(max_frames_per_video, 2)
|
|
1052
|
+
|
|
1053
|
+
def get_max_video_tokens(
|
|
1054
|
+
self,
|
|
1055
|
+
seq_len: int,
|
|
1056
|
+
mm_counts: Mapping[str, int],
|
|
1057
|
+
) -> int:
|
|
1058
|
+
target_width, target_height = self.get_image_size_with_most_features()
|
|
1059
|
+
|
|
1060
|
+
return self.get_num_video_tokens(
|
|
1061
|
+
image_width=target_width,
|
|
1062
|
+
image_height=target_height,
|
|
1063
|
+
num_frames=self.get_num_frames_with_most_features(seq_len, mm_counts),
|
|
1064
|
+
image_processor=None,
|
|
1065
|
+
)
|
|
1066
|
+
|
|
1067
|
+
|
|
1068
|
+
class Ernie4_5VLMultiModalProcessor(BaseMultiModalProcessor[Ernie4_5_VLProcessingInfo]):
|
|
1069
|
+
def _pixel_values_norm(
|
|
1070
|
+
self,
|
|
1071
|
+
pixel_values: torch.Tensor,
|
|
1072
|
+
mm_kwargs: object,
|
|
1073
|
+
) -> torch.Tensor:
|
|
1074
|
+
hf_config = self.info.get_hf_config()
|
|
1075
|
+
vision_config = hf_config.vision_config
|
|
1076
|
+
image_processor = self.info.get_image_processor(**mm_kwargs)
|
|
1077
|
+
image_mean_tensor = torch.tensor(
|
|
1078
|
+
image_processor.image_mean, dtype=torch.float32
|
|
1079
|
+
).reshape([1, 3, 1, 1])
|
|
1080
|
+
image_std_tensor = torch.tensor(
|
|
1081
|
+
image_processor.image_std, dtype=torch.float32
|
|
1082
|
+
).reshape([1, 3, 1, 1])
|
|
1083
|
+
rescale_factor = torch.tensor(
|
|
1084
|
+
image_processor.rescale_factor, dtype=torch.float32
|
|
1085
|
+
)
|
|
1086
|
+
patch_size_squared = vision_config.patch_size**2
|
|
1087
|
+
|
|
1088
|
+
image_mean_tensor = image_mean_tensor.squeeze([-2, -1]).repeat_interleave(
|
|
1089
|
+
patch_size_squared, -1
|
|
1090
|
+
)
|
|
1091
|
+
image_std_tensor = image_std_tensor.squeeze([-2, -1]).repeat_interleave(
|
|
1092
|
+
patch_size_squared, -1
|
|
1093
|
+
)
|
|
1094
|
+
|
|
1095
|
+
if not image_mean_tensor.is_contiguous():
|
|
1096
|
+
image_mean_tensor = image_mean_tensor.contiguous()
|
|
1097
|
+
if not image_std_tensor.is_contiguous():
|
|
1098
|
+
image_std_tensor = image_std_tensor.contiguous()
|
|
1099
|
+
|
|
1100
|
+
pixel_values = (
|
|
1101
|
+
rescale_factor * pixel_values.to(torch.float32) - image_mean_tensor
|
|
1102
|
+
) / image_std_tensor
|
|
1103
|
+
pixel_values = pixel_values.to(hf_config.dtype)
|
|
1104
|
+
return pixel_values
|
|
1105
|
+
|
|
1106
|
+
def _call_hf_processor(
|
|
1107
|
+
self,
|
|
1108
|
+
prompt: str,
|
|
1109
|
+
mm_data: Mapping[str, object],
|
|
1110
|
+
mm_kwargs: Mapping[str, object],
|
|
1111
|
+
tok_kwargs: Mapping[str, object],
|
|
1112
|
+
) -> BatchFeature:
|
|
1113
|
+
# when the prompt is not empty but the multimodal data is empty,
|
|
1114
|
+
# directly invoke the tokenizer.
|
|
1115
|
+
if "images" not in mm_data and "videos" not in mm_data and prompt != "":
|
|
1116
|
+
tokenizer = self.info.get_tokenizer()
|
|
1117
|
+
prompt_ids = tokenizer.encode(prompt)
|
|
1118
|
+
tokenizer_output = BatchFeature(
|
|
1119
|
+
dict(input_ids=[prompt_ids]), tensor_type="pt"
|
|
1120
|
+
)
|
|
1121
|
+
return tokenizer_output
|
|
1122
|
+
|
|
1123
|
+
if "images" not in mm_data:
|
|
1124
|
+
mm_data["images"] = []
|
|
1125
|
+
if "videos" not in mm_data:
|
|
1126
|
+
mm_data["videos"] = []
|
|
1127
|
+
processor_output = self.info.ctx.call_hf_processor(
|
|
1128
|
+
self.info.get_hf_processor(**mm_kwargs),
|
|
1129
|
+
dict(text=[prompt], images=mm_data["images"], videos=mm_data["videos"]),
|
|
1130
|
+
dict(**mm_kwargs, **tok_kwargs),
|
|
1131
|
+
)
|
|
1132
|
+
|
|
1133
|
+
# Divide the processor_output into two modalities: image and video.
|
|
1134
|
+
if processor_output is not None:
|
|
1135
|
+
pixel_values = processor_output["images"]
|
|
1136
|
+
if pixel_values is not None:
|
|
1137
|
+
processor_output["images"] = self._pixel_values_norm(
|
|
1138
|
+
pixel_values, mm_kwargs
|
|
1139
|
+
)
|
|
1140
|
+
for key in list(processor_output.keys()):
|
|
1141
|
+
if processor_output[key] is None:
|
|
1142
|
+
del processor_output[key]
|
|
1143
|
+
continue
|
|
1144
|
+
if key == "grid_thw":
|
|
1145
|
+
grid_thw = processor_output["grid_thw"]
|
|
1146
|
+
pixel_values_all = processor_output["images"]
|
|
1147
|
+
# Identify elements where the first
|
|
1148
|
+
# dimension is greater than 1 and
|
|
1149
|
+
# treat them as the video modality
|
|
1150
|
+
mask = grid_thw[:, 0] > 1
|
|
1151
|
+
processor_output["video_grid_thw"] = grid_thw[mask]
|
|
1152
|
+
processor_output["image_grid_thw"] = grid_thw[~mask]
|
|
1153
|
+
image_patch_num = (
|
|
1154
|
+
processor_output["image_grid_thw"].prod(dim=1).sum()
|
|
1155
|
+
)
|
|
1156
|
+
processor_output["pixel_values"] = pixel_values_all[
|
|
1157
|
+
:image_patch_num
|
|
1158
|
+
]
|
|
1159
|
+
processor_output["pixel_values_videos"] = pixel_values_all[
|
|
1160
|
+
image_patch_num:
|
|
1161
|
+
]
|
|
1162
|
+
del processor_output["images"]
|
|
1163
|
+
|
|
1164
|
+
return processor_output
|
|
1165
|
+
|
|
1166
|
+
def _get_prompt_updates(
|
|
1167
|
+
self,
|
|
1168
|
+
mm_items: MultiModalDataItems,
|
|
1169
|
+
hf_processor_mm_kwargs: Mapping[str, Any],
|
|
1170
|
+
out_mm_kwargs: MultiModalKwargsItems,
|
|
1171
|
+
) -> Sequence[PromptUpdate]:
|
|
1172
|
+
hf_processor = self.info.get_hf_processor(**hf_processor_mm_kwargs)
|
|
1173
|
+
|
|
1174
|
+
before_placeholder = {
|
|
1175
|
+
"image": "<|image@placeholder|>",
|
|
1176
|
+
"video": "<|video@placeholder|>",
|
|
1177
|
+
}
|
|
1178
|
+
|
|
1179
|
+
after_placeholder = {
|
|
1180
|
+
# image and video have same placeholder
|
|
1181
|
+
"image": "<|IMAGE_PLACEHOLDER|>",
|
|
1182
|
+
"video": "<|IMAGE_PLACEHOLDER|>",
|
|
1183
|
+
}
|
|
1184
|
+
|
|
1185
|
+
merge_length = hf_processor.spatial_conv_size**2
|
|
1186
|
+
|
|
1187
|
+
def get_replacement_ernie45vl(item_idx: int, modality: str):
|
|
1188
|
+
out_item = out_mm_kwargs[modality][item_idx]
|
|
1189
|
+
grid_thw = out_item[f"{modality}_grid_thw"].data
|
|
1190
|
+
assert isinstance(grid_thw, torch.Tensor)
|
|
1191
|
+
if modality == "video":
|
|
1192
|
+
num_tokens = (
|
|
1193
|
+
int(grid_thw.prod())
|
|
1194
|
+
// hf_processor.temporal_conv_size
|
|
1195
|
+
// merge_length
|
|
1196
|
+
)
|
|
1197
|
+
else:
|
|
1198
|
+
num_tokens = int(grid_thw.prod()) // merge_length
|
|
1199
|
+
return after_placeholder[modality] * num_tokens
|
|
1200
|
+
|
|
1201
|
+
return [
|
|
1202
|
+
PromptReplacement(
|
|
1203
|
+
modality=modality,
|
|
1204
|
+
target=before_placeholder[modality],
|
|
1205
|
+
replacement=partial(get_replacement_ernie45vl, modality=modality),
|
|
1206
|
+
)
|
|
1207
|
+
for modality in ("image", "video")
|
|
1208
|
+
]
|
|
1209
|
+
|
|
1210
|
+
def _get_mm_fields_config(
|
|
1211
|
+
self,
|
|
1212
|
+
hf_inputs: BatchFeature,
|
|
1213
|
+
hf_processor_mm_kwargs: Mapping[str, object],
|
|
1214
|
+
) -> Mapping[str, MultiModalFieldConfig]:
|
|
1215
|
+
image_grid_thw = hf_inputs.get("image_grid_thw", torch.empty((0, 3)))
|
|
1216
|
+
image_grid_sizes = image_grid_thw.prod(-1)
|
|
1217
|
+
|
|
1218
|
+
video_grid_thw = hf_inputs.get("video_grid_thw", torch.empty((0, 3)))
|
|
1219
|
+
video_grid_sizes = video_grid_thw.prod(-1)
|
|
1220
|
+
|
|
1221
|
+
return dict(
|
|
1222
|
+
pixel_values=MultiModalFieldConfig.flat_from_sizes(
|
|
1223
|
+
"image", image_grid_sizes
|
|
1224
|
+
),
|
|
1225
|
+
image_grid_thw=MultiModalFieldConfig.batched("image"),
|
|
1226
|
+
pixel_values_videos=MultiModalFieldConfig.flat_from_sizes(
|
|
1227
|
+
"video", video_grid_sizes
|
|
1228
|
+
),
|
|
1229
|
+
video_grid_thw=MultiModalFieldConfig.batched("video"),
|
|
1230
|
+
)
|
|
1231
|
+
|
|
1232
|
+
|
|
1233
|
+
class Ernie4_5_VLDummyInputsBuilder(BaseDummyInputsBuilder[Ernie4_5_VLProcessingInfo]):
|
|
1234
|
+
def get_dummy_text(self, mm_counts: Mapping[str, int]) -> str:
|
|
1235
|
+
num_images = mm_counts.get("image", 0)
|
|
1236
|
+
num_videos = mm_counts.get("video", 0)
|
|
1237
|
+
prompt = ""
|
|
1238
|
+
for i in range(num_images):
|
|
1239
|
+
prompt += (
|
|
1240
|
+
f"Picture {i + 1}:<|IMAGE_START|><|image@placeholder|><|IMAGE_END|>"
|
|
1241
|
+
)
|
|
1242
|
+
|
|
1243
|
+
for i in range(num_videos):
|
|
1244
|
+
prompt += f"Video {i + 1}:<|VIDEO_START|><|video@placeholder|><|VIDEO_END|>"
|
|
1245
|
+
return prompt
|
|
1246
|
+
|
|
1247
|
+
def get_dummy_mm_data(
|
|
1248
|
+
self,
|
|
1249
|
+
seq_len: int,
|
|
1250
|
+
mm_counts: Mapping[str, int],
|
|
1251
|
+
mm_options: Mapping[str, BaseDummyOptions] | None = None,
|
|
1252
|
+
) -> MultiModalDataDict:
|
|
1253
|
+
num_images = mm_counts.get("image", 0)
|
|
1254
|
+
num_videos = mm_counts.get("video", 0)
|
|
1255
|
+
|
|
1256
|
+
target_width, target_height = self.info.get_image_size_with_most_features()
|
|
1257
|
+
target_num_frames = self.info.get_num_frames_with_most_features(
|
|
1258
|
+
seq_len, mm_counts
|
|
1259
|
+
)
|
|
1260
|
+
|
|
1261
|
+
image_overrides = mm_options.get("image") if mm_options else None
|
|
1262
|
+
video_overrides = mm_options.get("video") if mm_options else None
|
|
1263
|
+
|
|
1264
|
+
return {
|
|
1265
|
+
"image": self._get_dummy_images(
|
|
1266
|
+
width=target_width,
|
|
1267
|
+
height=target_height,
|
|
1268
|
+
num_images=num_images,
|
|
1269
|
+
overrides=image_overrides,
|
|
1270
|
+
),
|
|
1271
|
+
"video": self._get_dummy_videos(
|
|
1272
|
+
width=target_width,
|
|
1273
|
+
height=target_height,
|
|
1274
|
+
num_frames=target_num_frames,
|
|
1275
|
+
num_videos=num_videos,
|
|
1276
|
+
overrides=video_overrides,
|
|
1277
|
+
),
|
|
1278
|
+
}
|
|
1279
|
+
|
|
1280
|
+
|
|
1281
|
+
@MULTIMODAL_REGISTRY.register_processor(
|
|
1282
|
+
Ernie4_5VLMultiModalProcessor,
|
|
1283
|
+
info=Ernie4_5_VLProcessingInfo,
|
|
1284
|
+
dummy_inputs=Ernie4_5_VLDummyInputsBuilder,
|
|
1285
|
+
)
|
|
1286
|
+
class Ernie4_5_VLMoeForConditionalGeneration(
|
|
1287
|
+
nn.Module, SupportsMultiModal, SupportsLoRA, SupportsPP, SupportsMRoPE
|
|
1288
|
+
):
|
|
1289
|
+
merge_by_field_config = True
|
|
1290
|
+
|
|
1291
|
+
packed_modules_mapping = {
|
|
1292
|
+
"qkv_proj": [
|
|
1293
|
+
"q_proj",
|
|
1294
|
+
"k_proj",
|
|
1295
|
+
"v_proj",
|
|
1296
|
+
],
|
|
1297
|
+
"gate_up_proj": [
|
|
1298
|
+
"gate_proj",
|
|
1299
|
+
"up_proj",
|
|
1300
|
+
],
|
|
1301
|
+
}
|
|
1302
|
+
|
|
1303
|
+
# To ensure correct weight loading and mapping.
|
|
1304
|
+
hf_to_vllm_mapper = WeightsMapper(
|
|
1305
|
+
orig_to_new_prefix={
|
|
1306
|
+
"lm_head.": "language_model.lm_head.",
|
|
1307
|
+
"model.": "language_model.model.",
|
|
1308
|
+
# model.resampler_model.-> language_model.model.resampler_model.
|
|
1309
|
+
# language_model.model.resampler_model. -> resampler_model.
|
|
1310
|
+
"language_model.model.resampler_model.": "resampler_model.",
|
|
1311
|
+
},
|
|
1312
|
+
# resampler_weight_mappings
|
|
1313
|
+
orig_to_new_substr={
|
|
1314
|
+
"spatial_linear.0.": "spatial_linear1.",
|
|
1315
|
+
"spatial_linear.2.": "spatial_linear2.",
|
|
1316
|
+
"spatial_linear.3.": "spatial_norm.",
|
|
1317
|
+
"temporal_linear.0.": "temporal_linear1.",
|
|
1318
|
+
"temporal_linear.2.": "temporal_linear2.",
|
|
1319
|
+
"temporal_linear.3.": "temporal_norm.",
|
|
1320
|
+
},
|
|
1321
|
+
)
|
|
1322
|
+
|
|
1323
|
+
@classmethod
|
|
1324
|
+
def get_placeholder_str(cls, modality: str, i: int) -> str | None:
|
|
1325
|
+
if modality.startswith("image"):
|
|
1326
|
+
return "<|IMAGE_START|><|image@placeholder|><|IMAGE_END|>"
|
|
1327
|
+
if modality.startswith("video"):
|
|
1328
|
+
return "<|VIDEO_START|><|video@placeholder|><|VIDEO_END|>"
|
|
1329
|
+
|
|
1330
|
+
raise ValueError("Only image or video modality is supported")
|
|
1331
|
+
|
|
1332
|
+
def __init__(self, vllm_config: VllmConfig, prefix: str = "") -> None:
|
|
1333
|
+
super().__init__()
|
|
1334
|
+
config = vllm_config.model_config.hf_config
|
|
1335
|
+
quant_config = vllm_config.quant_config
|
|
1336
|
+
multimodal_config = vllm_config.model_config.multimodal_config
|
|
1337
|
+
|
|
1338
|
+
self.config = config
|
|
1339
|
+
self.multimodal_config = multimodal_config
|
|
1340
|
+
|
|
1341
|
+
attn_backend_override = (
|
|
1342
|
+
multimodal_config.mm_encoder_attn_backend
|
|
1343
|
+
if multimodal_config is not None
|
|
1344
|
+
else None
|
|
1345
|
+
)
|
|
1346
|
+
self.vision_model = Ernie4_5_VisionTransformer(
|
|
1347
|
+
config.vision_config,
|
|
1348
|
+
norm_eps=getattr(config, "rms_norm_eps", 1e-6),
|
|
1349
|
+
quant_config=quant_config,
|
|
1350
|
+
prefix=maybe_prefix(prefix, "vision_model"),
|
|
1351
|
+
attn_backend_override=attn_backend_override,
|
|
1352
|
+
)
|
|
1353
|
+
|
|
1354
|
+
self.language_model = Ernie4_5_VLMoeForCausalLM(
|
|
1355
|
+
vllm_config=vllm_config,
|
|
1356
|
+
prefix=maybe_prefix(prefix, "language_model"),
|
|
1357
|
+
)
|
|
1358
|
+
|
|
1359
|
+
self.resampler_model = VariableResolutionResamplerModel(
|
|
1360
|
+
self.config.pixel_hidden_size,
|
|
1361
|
+
self.config.hidden_size,
|
|
1362
|
+
self.config.spatial_conv_size,
|
|
1363
|
+
self.config.temporal_conv_size,
|
|
1364
|
+
config=self.config,
|
|
1365
|
+
prefix=maybe_prefix(prefix, "resampler_model"),
|
|
1366
|
+
)
|
|
1367
|
+
|
|
1368
|
+
self.visual_token_mask = None
|
|
1369
|
+
self.make_empty_intermediate_tensors = (
|
|
1370
|
+
self.language_model.make_empty_intermediate_tensors
|
|
1371
|
+
)
|
|
1372
|
+
if getattr(self.config, "im_patch_id", None):
|
|
1373
|
+
visual_token_ids = [
|
|
1374
|
+
token_id
|
|
1375
|
+
for token_id in [
|
|
1376
|
+
self.config.im_patch_id,
|
|
1377
|
+
getattr(self.config, "image_start_token_id", None),
|
|
1378
|
+
getattr(self.config, "image_end_token_id", None),
|
|
1379
|
+
getattr(self.config, "video_start_token_id", None),
|
|
1380
|
+
getattr(self.config, "video_end_token_id", None),
|
|
1381
|
+
]
|
|
1382
|
+
if token_id is not None
|
|
1383
|
+
]
|
|
1384
|
+
self._visual_token_ids_tensor_cache = torch.tensor(
|
|
1385
|
+
visual_token_ids, dtype=torch.long
|
|
1386
|
+
)
|
|
1387
|
+
else:
|
|
1388
|
+
self._visual_token_ids_tensor_cache = None
|
|
1389
|
+
|
|
1390
|
+
def compute_logits(
|
|
1391
|
+
self,
|
|
1392
|
+
hidden_states: torch.Tensor,
|
|
1393
|
+
) -> torch.Tensor | None:
|
|
1394
|
+
"""compute logits"""
|
|
1395
|
+
return self.language_model.compute_logits(hidden_states)
|
|
1396
|
+
|
|
1397
|
+
def _vision_forward(
|
|
1398
|
+
self,
|
|
1399
|
+
pixel_values: torch.Tensor,
|
|
1400
|
+
grid_thw: torch.Tensor,
|
|
1401
|
+
) -> torch.Tensor:
|
|
1402
|
+
if grid_thw is not None:
|
|
1403
|
+
grid_thw = grid_thw[grid_thw > 0]
|
|
1404
|
+
if grid_thw.numel() % 3 != 0:
|
|
1405
|
+
raise ValueError(
|
|
1406
|
+
f"grid_thw has {grid_thw.numel()} elements after filtering,"
|
|
1407
|
+
"which is not divisible by 3."
|
|
1408
|
+
)
|
|
1409
|
+
grid_thw = grid_thw.reshape(-1, 3)
|
|
1410
|
+
# example: [[1,64,64],[2,80,80]] -> [[1,64,64],[1,80,80],[1,80,80]]
|
|
1411
|
+
grid_thw = F.pad(
|
|
1412
|
+
torch.repeat_interleave(grid_thw[:, 1:], grid_thw[:, 0], 0),
|
|
1413
|
+
[1, 0, 0, 0],
|
|
1414
|
+
value=1,
|
|
1415
|
+
)
|
|
1416
|
+
image_features = self.vision_model(pixel_values, grid_thw)
|
|
1417
|
+
return image_features
|
|
1418
|
+
|
|
1419
|
+
def _set_visual_token_mask(self, input_ids: torch.Tensor) -> None:
|
|
1420
|
+
"""Set mask for visual tokens (image/video patches and delimiters)."""
|
|
1421
|
+
if self._visual_token_ids_tensor_cache is None:
|
|
1422
|
+
self.visual_token_mask = None
|
|
1423
|
+
return
|
|
1424
|
+
# Create tensor on the correct device
|
|
1425
|
+
visual_token_ids_tensor = self._visual_token_ids_tensor_cache.to(
|
|
1426
|
+
device=input_ids.device,
|
|
1427
|
+
dtype=input_ids.dtype,
|
|
1428
|
+
)
|
|
1429
|
+
|
|
1430
|
+
self.visual_token_mask = torch.isin(input_ids, visual_token_ids_tensor).reshape(
|
|
1431
|
+
-1, 1
|
|
1432
|
+
)
|
|
1433
|
+
|
|
1434
|
+
def get_mrope_input_positions(
|
|
1435
|
+
self,
|
|
1436
|
+
input_tokens: list[int],
|
|
1437
|
+
mm_features: list[MultiModalFeatureSpec],
|
|
1438
|
+
) -> tuple[torch.Tensor, int]:
|
|
1439
|
+
kwargs = MultiModalFeatureSpec.gather_kwargs(
|
|
1440
|
+
mm_features,
|
|
1441
|
+
{"image_grid_thw", "video_grid_thw"},
|
|
1442
|
+
)
|
|
1443
|
+
image_grid_thw = [item.tolist() for item in kwargs.get("image_grid_thw", [])]
|
|
1444
|
+
video_grid_thw = [item.tolist() for item in kwargs.get("video_grid_thw", [])]
|
|
1445
|
+
|
|
1446
|
+
hf_config = self.config
|
|
1447
|
+
image_token_id = hf_config.im_patch_id
|
|
1448
|
+
video_start_token_id = hf_config.video_start_token_id
|
|
1449
|
+
video_end_token_id = hf_config.video_end_token_id
|
|
1450
|
+
spatial_conv_size = hf_config.spatial_conv_size
|
|
1451
|
+
temporal_conv_size = hf_config.temporal_conv_size
|
|
1452
|
+
llm_pos_ids_list: list = []
|
|
1453
|
+
|
|
1454
|
+
if image_grid_thw or video_grid_thw:
|
|
1455
|
+
input_token_type: list[str] = []
|
|
1456
|
+
video_check_flg = False
|
|
1457
|
+
for token in input_tokens:
|
|
1458
|
+
if token == video_start_token_id:
|
|
1459
|
+
video_check_flg = True
|
|
1460
|
+
elif token == video_end_token_id:
|
|
1461
|
+
video_check_flg = False
|
|
1462
|
+
|
|
1463
|
+
if (token == image_token_id) and (video_check_flg is False):
|
|
1464
|
+
input_token_type.append("image")
|
|
1465
|
+
elif (token == image_token_id) and (video_check_flg is True):
|
|
1466
|
+
input_token_type.append("video")
|
|
1467
|
+
else:
|
|
1468
|
+
input_token_type.append("text")
|
|
1469
|
+
|
|
1470
|
+
input_type_group: list[tuple[str, int, int]] = []
|
|
1471
|
+
for key, group_iter in itertools.groupby(
|
|
1472
|
+
enumerate(input_token_type), lambda x: x[1]
|
|
1473
|
+
):
|
|
1474
|
+
group_list = list(group_iter)
|
|
1475
|
+
start_index = group_list[0][0]
|
|
1476
|
+
end_index = group_list[-1][0] + 1
|
|
1477
|
+
input_type_group.append((key, start_index, end_index))
|
|
1478
|
+
|
|
1479
|
+
video_frame_num = 1
|
|
1480
|
+
mm_data_idx = 0
|
|
1481
|
+
for modality_type, start_idx, end_idx in input_type_group:
|
|
1482
|
+
st_idx = (
|
|
1483
|
+
llm_pos_ids_list[-1].max() + 1 if len(llm_pos_ids_list) > 0 else 0
|
|
1484
|
+
)
|
|
1485
|
+
if modality_type == "image":
|
|
1486
|
+
t, h, w = image_grid_thw[mm_data_idx]
|
|
1487
|
+
llm_grid_t, llm_grid_h, llm_grid_w = (
|
|
1488
|
+
t,
|
|
1489
|
+
h // spatial_conv_size,
|
|
1490
|
+
w // spatial_conv_size,
|
|
1491
|
+
)
|
|
1492
|
+
|
|
1493
|
+
t_index = (
|
|
1494
|
+
torch.arange(llm_grid_t)
|
|
1495
|
+
.view(-1, 1)
|
|
1496
|
+
.expand(-1, llm_grid_h * llm_grid_w)
|
|
1497
|
+
.flatten()
|
|
1498
|
+
)
|
|
1499
|
+
h_index = (
|
|
1500
|
+
torch.arange(llm_grid_h)
|
|
1501
|
+
.view(1, -1, 1)
|
|
1502
|
+
.expand(llm_grid_t, -1, llm_grid_w)
|
|
1503
|
+
.flatten()
|
|
1504
|
+
)
|
|
1505
|
+
w_index = (
|
|
1506
|
+
torch.arange(llm_grid_w)
|
|
1507
|
+
.view(1, 1, -1)
|
|
1508
|
+
.expand(llm_grid_t, llm_grid_h, -1)
|
|
1509
|
+
.flatten()
|
|
1510
|
+
)
|
|
1511
|
+
llm_pos_ids_list.append(
|
|
1512
|
+
torch.stack([t_index, h_index, w_index]) + st_idx
|
|
1513
|
+
)
|
|
1514
|
+
mm_data_idx += 1
|
|
1515
|
+
|
|
1516
|
+
elif modality_type == "video":
|
|
1517
|
+
t, h, w = video_grid_thw[mm_data_idx]
|
|
1518
|
+
llm_grid_t, llm_grid_h, llm_grid_w = (
|
|
1519
|
+
t // temporal_conv_size,
|
|
1520
|
+
h // spatial_conv_size,
|
|
1521
|
+
w // spatial_conv_size,
|
|
1522
|
+
)
|
|
1523
|
+
|
|
1524
|
+
for t_idx in range(llm_grid_t):
|
|
1525
|
+
t_index = (
|
|
1526
|
+
torch.tensor(t_idx)
|
|
1527
|
+
.view(-1, 1)
|
|
1528
|
+
.expand(-1, llm_grid_h * llm_grid_w)
|
|
1529
|
+
.flatten()
|
|
1530
|
+
)
|
|
1531
|
+
h_index = (
|
|
1532
|
+
torch.arange(llm_grid_h)
|
|
1533
|
+
.view(1, -1, 1)
|
|
1534
|
+
.expand(1, -1, llm_grid_w)
|
|
1535
|
+
.flatten()
|
|
1536
|
+
)
|
|
1537
|
+
w_index = (
|
|
1538
|
+
torch.arange(llm_grid_w)
|
|
1539
|
+
.view(1, 1, -1)
|
|
1540
|
+
.expand(1, llm_grid_h, -1)
|
|
1541
|
+
.flatten()
|
|
1542
|
+
)
|
|
1543
|
+
llm_pos_ids_list.append(
|
|
1544
|
+
torch.stack([t_index, h_index, w_index]) + st_idx
|
|
1545
|
+
)
|
|
1546
|
+
|
|
1547
|
+
mm_data_idx += 1
|
|
1548
|
+
video_frame_num += 1
|
|
1549
|
+
|
|
1550
|
+
else:
|
|
1551
|
+
text_len = end_idx - start_idx
|
|
1552
|
+
llm_pos_ids_list.append(
|
|
1553
|
+
torch.arange(text_len).view(1, -1).expand(3, -1) + st_idx
|
|
1554
|
+
)
|
|
1555
|
+
video_frame_num = 1
|
|
1556
|
+
|
|
1557
|
+
else:
|
|
1558
|
+
text_len = len(input_tokens)
|
|
1559
|
+
llm_pos_ids_list.append(torch.arange(text_len).view(1, -1).expand(3, -1))
|
|
1560
|
+
|
|
1561
|
+
llm_positions = torch.cat(llm_pos_ids_list, dim=1).reshape(3, -1)
|
|
1562
|
+
mrope_position_delta = (llm_positions.max() + 1 - len(input_tokens)).item()
|
|
1563
|
+
return llm_positions, mrope_position_delta
|
|
1564
|
+
|
|
1565
|
+
def get_language_model(self) -> torch.nn.Module:
|
|
1566
|
+
return self.language_model
|
|
1567
|
+
|
|
1568
|
+
def _parse_and_validate_image_input(
|
|
1569
|
+
self, **kwargs: object
|
|
1570
|
+
) -> Ernie4_5_VLImageInputs | None:
|
|
1571
|
+
pixel_values = kwargs.pop("pixel_values", None)
|
|
1572
|
+
image_grid_thw = kwargs.pop("image_grid_thw", None)
|
|
1573
|
+
|
|
1574
|
+
if pixel_values is None:
|
|
1575
|
+
return None
|
|
1576
|
+
|
|
1577
|
+
if pixel_values is not None:
|
|
1578
|
+
return Ernie4_5_VLImagePixelInputs(
|
|
1579
|
+
type="pixel_values",
|
|
1580
|
+
pixel_values=pixel_values,
|
|
1581
|
+
image_grid_thw=image_grid_thw,
|
|
1582
|
+
)
|
|
1583
|
+
|
|
1584
|
+
def _parse_and_validate_video_input(
|
|
1585
|
+
self, **kwargs: object
|
|
1586
|
+
) -> Ernie4_5_VLVideoInputs | None:
|
|
1587
|
+
pixel_values_videos = kwargs.pop("pixel_values_videos", None)
|
|
1588
|
+
video_grid_thw = kwargs.pop("video_grid_thw", None)
|
|
1589
|
+
|
|
1590
|
+
if pixel_values_videos is None:
|
|
1591
|
+
return None
|
|
1592
|
+
|
|
1593
|
+
if pixel_values_videos is not None:
|
|
1594
|
+
return Ernie4_5_VLVideoPixelInputs(
|
|
1595
|
+
type="pixel_values_videos",
|
|
1596
|
+
pixel_values_videos=pixel_values_videos,
|
|
1597
|
+
video_grid_thw=video_grid_thw,
|
|
1598
|
+
)
|
|
1599
|
+
|
|
1600
|
+
def _process_image_input(
|
|
1601
|
+
self, image_input: Ernie4_5_VLImageInputs
|
|
1602
|
+
) -> tuple[torch.Tensor, ...]:
|
|
1603
|
+
grid_thw = image_input["image_grid_thw"]
|
|
1604
|
+
assert grid_thw.ndim == 2
|
|
1605
|
+
|
|
1606
|
+
pixel_values = image_input["pixel_values"].type(self.vision_model.dtype)
|
|
1607
|
+
image_features = self._vision_forward(
|
|
1608
|
+
pixel_values=pixel_values, grid_thw=grid_thw
|
|
1609
|
+
)
|
|
1610
|
+
image_embeds = self.resampler_model(image_features, grid_thw)
|
|
1611
|
+
|
|
1612
|
+
merge_size = self.vision_model.spatial_merge_size
|
|
1613
|
+
sizes = grid_thw.prod(-1) // merge_size // merge_size
|
|
1614
|
+
|
|
1615
|
+
return image_embeds.split(sizes.tolist())
|
|
1616
|
+
|
|
1617
|
+
def _process_video_input(
|
|
1618
|
+
self, video_input: Ernie4_5_VLVideoInputs
|
|
1619
|
+
) -> tuple[torch.Tensor, ...]:
|
|
1620
|
+
grid_thw = video_input["video_grid_thw"]
|
|
1621
|
+
assert grid_thw.ndim == 2
|
|
1622
|
+
|
|
1623
|
+
pixel_values_videos = video_input["pixel_values_videos"].type(
|
|
1624
|
+
self.vision_model.dtype
|
|
1625
|
+
)
|
|
1626
|
+
video_features = self._vision_forward(
|
|
1627
|
+
pixel_values=pixel_values_videos, grid_thw=grid_thw
|
|
1628
|
+
)
|
|
1629
|
+
video_embeds = self.resampler_model(video_features, grid_thw)
|
|
1630
|
+
|
|
1631
|
+
merge_size = self.vision_model.spatial_merge_size
|
|
1632
|
+
sizes = (
|
|
1633
|
+
(grid_thw.prod(-1) // self.config.temporal_conv_size)
|
|
1634
|
+
// merge_size
|
|
1635
|
+
// merge_size
|
|
1636
|
+
)
|
|
1637
|
+
|
|
1638
|
+
return video_embeds.split(sizes.tolist())
|
|
1639
|
+
|
|
1640
|
+
def _parse_and_validate_multimodal_inputs(self, **kwargs: object) -> dict:
|
|
1641
|
+
modalities = {}
|
|
1642
|
+
|
|
1643
|
+
# Preserve the order of modalities if there are multiple of them
|
|
1644
|
+
# from the order of kwargs.
|
|
1645
|
+
for input_key in kwargs:
|
|
1646
|
+
if (
|
|
1647
|
+
input_key in ("pixel_values", "image_embeds")
|
|
1648
|
+
and "images" not in modalities
|
|
1649
|
+
):
|
|
1650
|
+
modalities["images"] = self._parse_and_validate_image_input(**kwargs)
|
|
1651
|
+
if (
|
|
1652
|
+
input_key in ("pixel_values_videos", "video_embeds")
|
|
1653
|
+
and "videos" not in modalities
|
|
1654
|
+
):
|
|
1655
|
+
modalities["videos"] = self._parse_and_validate_video_input(**kwargs)
|
|
1656
|
+
|
|
1657
|
+
return modalities
|
|
1658
|
+
|
|
1659
|
+
def embed_multimodal(self, **kwargs: object) -> MultiModalEmbeddings | None:
|
|
1660
|
+
modalities = self._parse_and_validate_multimodal_inputs(**kwargs)
|
|
1661
|
+
if not modalities:
|
|
1662
|
+
return None
|
|
1663
|
+
|
|
1664
|
+
# The result multimodal_embeddings is tuple of tensors, with each
|
|
1665
|
+
# tensor corresponding to a multimodal data item (image or video).
|
|
1666
|
+
multimodal_embeddings: tuple[torch.Tensor, ...] = ()
|
|
1667
|
+
|
|
1668
|
+
# NOTE: It is important to iterate over the keys in this dictionary
|
|
1669
|
+
# to preserve the order of the modalities.
|
|
1670
|
+
for modality in modalities:
|
|
1671
|
+
if modality == "images":
|
|
1672
|
+
image_input = modalities["images"]
|
|
1673
|
+
image_embeddings = self._process_image_input(image_input)
|
|
1674
|
+
multimodal_embeddings += tuple(image_embeddings)
|
|
1675
|
+
if modality == "videos":
|
|
1676
|
+
video_input = modalities["videos"]
|
|
1677
|
+
video_embeddings = self._process_video_input(video_input)
|
|
1678
|
+
multimodal_embeddings += tuple(video_embeddings)
|
|
1679
|
+
|
|
1680
|
+
return multimodal_embeddings
|
|
1681
|
+
|
|
1682
|
+
def embed_input_ids(
|
|
1683
|
+
self,
|
|
1684
|
+
input_ids: torch.Tensor,
|
|
1685
|
+
multimodal_embeddings: MultiModalEmbeddings | None = None,
|
|
1686
|
+
*,
|
|
1687
|
+
is_multimodal: torch.Tensor | None = None,
|
|
1688
|
+
handle_oov_mm_token: bool = False,
|
|
1689
|
+
) -> torch.Tensor:
|
|
1690
|
+
if multimodal_embeddings is not None and len(multimodal_embeddings) > 0:
|
|
1691
|
+
self._set_visual_token_mask(input_ids)
|
|
1692
|
+
|
|
1693
|
+
# This is to satisfy the type checker for each overload
|
|
1694
|
+
if multimodal_embeddings is None or is_multimodal is None:
|
|
1695
|
+
return super().embed_input_ids(input_ids)
|
|
1696
|
+
|
|
1697
|
+
return super().embed_input_ids(
|
|
1698
|
+
input_ids,
|
|
1699
|
+
multimodal_embeddings=multimodal_embeddings,
|
|
1700
|
+
is_multimodal=is_multimodal,
|
|
1701
|
+
handle_oov_mm_token=handle_oov_mm_token,
|
|
1702
|
+
)
|
|
1703
|
+
|
|
1704
|
+
def forward(
|
|
1705
|
+
self,
|
|
1706
|
+
input_ids: torch.Tensor,
|
|
1707
|
+
positions: torch.Tensor,
|
|
1708
|
+
intermediate_tensors: IntermediateTensors | None = None,
|
|
1709
|
+
inputs_embeds: torch.Tensor | None = None,
|
|
1710
|
+
**kwargs,
|
|
1711
|
+
):
|
|
1712
|
+
forward_kwargs = {
|
|
1713
|
+
"input_ids": input_ids,
|
|
1714
|
+
"positions": positions,
|
|
1715
|
+
"intermediate_tensors": intermediate_tensors,
|
|
1716
|
+
"inputs_embeds": inputs_embeds,
|
|
1717
|
+
}
|
|
1718
|
+
|
|
1719
|
+
if self.visual_token_mask is not None:
|
|
1720
|
+
if self.visual_token_mask.shape[0] != inputs_embeds.shape[0]:
|
|
1721
|
+
padding_len = inputs_embeds.shape[0] - self.visual_token_mask.shape[0]
|
|
1722
|
+
# right pad False
|
|
1723
|
+
pad = torch.zeros(
|
|
1724
|
+
(padding_len, self.visual_token_mask.shape[1]),
|
|
1725
|
+
dtype=self.visual_token_mask.dtype,
|
|
1726
|
+
device=self.visual_token_mask.device,
|
|
1727
|
+
)
|
|
1728
|
+
self.visual_token_mask = torch.cat([self.visual_token_mask, pad], dim=0)
|
|
1729
|
+
|
|
1730
|
+
forward_kwargs.update({"visual_token_mask": self.visual_token_mask})
|
|
1731
|
+
self.visual_token_mask = None
|
|
1732
|
+
|
|
1733
|
+
hidden_states = self.language_model.model(
|
|
1734
|
+
**forward_kwargs,
|
|
1735
|
+
**kwargs,
|
|
1736
|
+
)
|
|
1737
|
+
|
|
1738
|
+
return hidden_states
|
|
1739
|
+
|
|
1740
|
+
def load_weights(self, weights: Iterable[tuple[str, torch.Tensor]]) -> set[str]:
|
|
1741
|
+
loader = AutoWeightsLoader(self)
|
|
1742
|
+
return loader.load_weights(weights, mapper=self.hf_to_vllm_mapper)
|