vllm-cpu 0.11.0.post2__cp312-cp312-manylinux_2_17_x86_64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- vllm/_C.abi3.so +0 -0
- vllm/__init__.py +220 -0
- vllm/_bc_linter.py +59 -0
- vllm/_custom_ops.py +2044 -0
- vllm/_ipex_ops.py +393 -0
- vllm/_version.py +34 -0
- vllm/assets/__init__.py +0 -0
- vllm/assets/audio.py +45 -0
- vllm/assets/base.py +41 -0
- vllm/assets/image.py +50 -0
- vllm/assets/video.py +145 -0
- vllm/attention/__init__.py +15 -0
- vllm/attention/backends/__init__.py +0 -0
- vllm/attention/backends/abstract.py +204 -0
- vllm/attention/backends/utils.py +33 -0
- vllm/attention/layer.py +645 -0
- vllm/attention/layers/__init__.py +0 -0
- vllm/attention/layers/chunked_local_attention.py +93 -0
- vllm/attention/layers/cross_attention.py +162 -0
- vllm/attention/layers/encoder_only_attention.py +86 -0
- vllm/attention/ops/__init__.py +0 -0
- vllm/attention/ops/chunked_prefill_paged_decode.py +405 -0
- vllm/attention/ops/common.py +345 -0
- vllm/attention/ops/flashmla.py +192 -0
- vllm/attention/ops/merge_attn_states.py +43 -0
- vllm/attention/ops/paged_attn.py +262 -0
- vllm/attention/ops/pallas_kv_cache_update.py +124 -0
- vllm/attention/ops/prefix_prefill.py +928 -0
- vllm/attention/ops/rocm_aiter_mla.py +104 -0
- vllm/attention/ops/rocm_aiter_paged_attn.py +102 -0
- vllm/attention/ops/triton_decode_attention.py +691 -0
- vllm/attention/ops/triton_flash_attention.py +984 -0
- vllm/attention/ops/triton_merge_attn_states.py +97 -0
- vllm/attention/ops/triton_reshape_and_cache_flash.py +175 -0
- vllm/attention/ops/triton_unified_attention.py +894 -0
- vllm/attention/selector.py +245 -0
- vllm/attention/utils/__init__.py +0 -0
- vllm/attention/utils/fa_utils.py +85 -0
- vllm/attention/utils/kv_sharing_utils.py +33 -0
- vllm/beam_search.py +87 -0
- vllm/benchmarks/__init__.py +0 -0
- vllm/benchmarks/datasets.py +2723 -0
- vllm/benchmarks/latency.py +170 -0
- vllm/benchmarks/lib/__init__.py +3 -0
- vllm/benchmarks/lib/endpoint_request_func.py +533 -0
- vllm/benchmarks/lib/ready_checker.py +73 -0
- vllm/benchmarks/lib/utils.py +80 -0
- vllm/benchmarks/serve.py +1358 -0
- vllm/benchmarks/throughput.py +696 -0
- vllm/collect_env.py +823 -0
- vllm/compilation/__init__.py +0 -0
- vllm/compilation/activation_quant_fusion.py +189 -0
- vllm/compilation/backends.py +650 -0
- vllm/compilation/base_static_graph.py +56 -0
- vllm/compilation/collective_fusion.py +1188 -0
- vllm/compilation/compiler_interface.py +573 -0
- vllm/compilation/counter.py +47 -0
- vllm/compilation/cuda_graph.py +199 -0
- vllm/compilation/cuda_piecewise_backend.py +117 -0
- vllm/compilation/decorators.py +400 -0
- vllm/compilation/fix_functionalization.py +205 -0
- vllm/compilation/fusion.py +383 -0
- vllm/compilation/fusion_attn.py +295 -0
- vllm/compilation/fx_utils.py +84 -0
- vllm/compilation/inductor_pass.py +136 -0
- vllm/compilation/monitor.py +57 -0
- vllm/compilation/noop_elimination.py +158 -0
- vllm/compilation/pass_manager.py +125 -0
- vllm/compilation/post_cleanup.py +20 -0
- vllm/compilation/sequence_parallelism.py +478 -0
- vllm/compilation/torch25_custom_graph_pass.py +42 -0
- vllm/compilation/vllm_inductor_pass.py +156 -0
- vllm/compilation/wrapper.py +136 -0
- vllm/config/__init__.py +814 -0
- vllm/config/cache.py +220 -0
- vllm/config/compilation.py +673 -0
- vllm/config/device.py +74 -0
- vllm/config/kv_events.py +50 -0
- vllm/config/kv_transfer.py +111 -0
- vllm/config/load.py +113 -0
- vllm/config/lora.py +132 -0
- vllm/config/model.py +1912 -0
- vllm/config/multimodal.py +129 -0
- vllm/config/observability.py +99 -0
- vllm/config/parallel.py +524 -0
- vllm/config/pooler.py +97 -0
- vllm/config/scheduler.py +287 -0
- vllm/config/speculative.py +568 -0
- vllm/config/speech_to_text.py +39 -0
- vllm/config/structured_outputs.py +64 -0
- vllm/config/utils.py +145 -0
- vllm/connections.py +186 -0
- vllm/device_allocator/__init__.py +0 -0
- vllm/device_allocator/cumem.py +311 -0
- vllm/distributed/__init__.py +6 -0
- vllm/distributed/communication_op.py +41 -0
- vllm/distributed/device_communicators/__init__.py +0 -0
- vllm/distributed/device_communicators/all2all.py +440 -0
- vllm/distributed/device_communicators/all_reduce_utils.py +317 -0
- vllm/distributed/device_communicators/base_device_communicator.py +295 -0
- vllm/distributed/device_communicators/cpu_communicator.py +201 -0
- vllm/distributed/device_communicators/cuda_communicator.py +323 -0
- vllm/distributed/device_communicators/cuda_wrapper.py +180 -0
- vllm/distributed/device_communicators/custom_all_reduce.py +311 -0
- vllm/distributed/device_communicators/mnnvl_compat.py +28 -0
- vllm/distributed/device_communicators/pynccl.py +340 -0
- vllm/distributed/device_communicators/pynccl_allocator.py +186 -0
- vllm/distributed/device_communicators/pynccl_wrapper.py +416 -0
- vllm/distributed/device_communicators/quick_all_reduce.py +278 -0
- vllm/distributed/device_communicators/ray_communicator.py +258 -0
- vllm/distributed/device_communicators/shm_broadcast.py +589 -0
- vllm/distributed/device_communicators/shm_object_storage.py +635 -0
- vllm/distributed/device_communicators/symm_mem.py +136 -0
- vllm/distributed/device_communicators/tpu_communicator.py +102 -0
- vllm/distributed/device_communicators/xpu_communicator.py +94 -0
- vllm/distributed/eplb/__init__.py +8 -0
- vllm/distributed/eplb/eplb_state.py +620 -0
- vllm/distributed/eplb/rebalance_algo.py +239 -0
- vllm/distributed/eplb/rebalance_execute.py +424 -0
- vllm/distributed/kv_events.py +362 -0
- vllm/distributed/kv_transfer/README.md +29 -0
- vllm/distributed/kv_transfer/__init__.py +13 -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 +113 -0
- vllm/distributed/kv_transfer/kv_connector/utils.py +261 -0
- vllm/distributed/kv_transfer/kv_connector/v1/__init__.py +6 -0
- vllm/distributed/kv_transfer/kv_connector/v1/base.py +388 -0
- vllm/distributed/kv_transfer/kv_connector/v1/lmcache_connector.py +168 -0
- vllm/distributed/kv_transfer/kv_connector/v1/metrics.py +100 -0
- vllm/distributed/kv_transfer/kv_connector/v1/multi_connector.py +328 -0
- vllm/distributed/kv_transfer/kv_connector/v1/nixl_connector.py +1473 -0
- vllm/distributed/kv_transfer/kv_connector/v1/offloading_connector.py +485 -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 +488 -0
- vllm/distributed/kv_transfer/kv_connector/v1/p2p/p2p_nccl_engine.py +550 -0
- vllm/distributed/kv_transfer/kv_connector/v1/p2p/tensor_memory_pool.py +267 -0
- vllm/distributed/kv_transfer/kv_connector/v1/shared_storage_connector.py +418 -0
- vllm/distributed/kv_transfer/kv_lookup_buffer/__init__.py +0 -0
- vllm/distributed/kv_transfer/kv_lookup_buffer/base.py +175 -0
- vllm/distributed/kv_transfer/kv_lookup_buffer/mooncake_store.py +161 -0
- vllm/distributed/kv_transfer/kv_lookup_buffer/simple_buffer.py +237 -0
- vllm/distributed/kv_transfer/kv_pipe/__init__.py +0 -0
- vllm/distributed/kv_transfer/kv_pipe/base.py +67 -0
- vllm/distributed/kv_transfer/kv_pipe/mooncake_pipe.py +290 -0
- vllm/distributed/kv_transfer/kv_pipe/pynccl_pipe.py +280 -0
- vllm/distributed/kv_transfer/kv_transfer_state.py +73 -0
- vllm/distributed/parallel_state.py +1532 -0
- vllm/distributed/tpu_distributed_utils.py +178 -0
- vllm/distributed/utils.py +536 -0
- vllm/engine/__init__.py +0 -0
- vllm/engine/arg_utils.py +1778 -0
- vllm/engine/async_llm_engine.py +6 -0
- vllm/engine/llm_engine.py +6 -0
- vllm/engine/metrics.py +577 -0
- vllm/engine/metrics_types.py +84 -0
- vllm/engine/protocol.py +333 -0
- vllm/entrypoints/__init__.py +0 -0
- vllm/entrypoints/api_server.py +178 -0
- vllm/entrypoints/chat_utils.py +1705 -0
- vllm/entrypoints/cli/__init__.py +12 -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 +55 -0
- vllm/entrypoints/cli/benchmark/serve.py +21 -0
- vllm/entrypoints/cli/benchmark/throughput.py +21 -0
- vllm/entrypoints/cli/collect_env.py +36 -0
- vllm/entrypoints/cli/main.py +60 -0
- vllm/entrypoints/cli/openai.py +233 -0
- vllm/entrypoints/cli/run_batch.py +67 -0
- vllm/entrypoints/cli/serve.py +232 -0
- vllm/entrypoints/cli/types.py +29 -0
- vllm/entrypoints/constants.py +10 -0
- vllm/entrypoints/context.py +481 -0
- vllm/entrypoints/harmony_utils.py +436 -0
- vllm/entrypoints/launcher.py +164 -0
- vllm/entrypoints/llm.py +1629 -0
- vllm/entrypoints/logger.py +79 -0
- vllm/entrypoints/openai/__init__.py +0 -0
- vllm/entrypoints/openai/api_server.py +1953 -0
- vllm/entrypoints/openai/cli_args.py +288 -0
- vllm/entrypoints/openai/logits_processors.py +90 -0
- vllm/entrypoints/openai/protocol.py +2757 -0
- vllm/entrypoints/openai/run_batch.py +491 -0
- vllm/entrypoints/openai/serving_chat.py +1597 -0
- vllm/entrypoints/openai/serving_classification.py +173 -0
- vllm/entrypoints/openai/serving_completion.py +692 -0
- vllm/entrypoints/openai/serving_embedding.py +631 -0
- vllm/entrypoints/openai/serving_engine.py +992 -0
- vllm/entrypoints/openai/serving_models.py +288 -0
- vllm/entrypoints/openai/serving_pooling.py +276 -0
- vllm/entrypoints/openai/serving_responses.py +1709 -0
- vllm/entrypoints/openai/serving_score.py +479 -0
- vllm/entrypoints/openai/serving_tokenization.py +196 -0
- vllm/entrypoints/openai/serving_transcription.py +136 -0
- vllm/entrypoints/openai/speech_to_text.py +388 -0
- vllm/entrypoints/openai/tool_parsers/__init__.py +55 -0
- vllm/entrypoints/openai/tool_parsers/abstract_tool_parser.py +164 -0
- vllm/entrypoints/openai/tool_parsers/deepseekv31_tool_parser.py +367 -0
- vllm/entrypoints/openai/tool_parsers/deepseekv3_tool_parser.py +370 -0
- vllm/entrypoints/openai/tool_parsers/glm4_moe_tool_parser.py +185 -0
- vllm/entrypoints/openai/tool_parsers/granite_20b_fc_tool_parser.py +259 -0
- vllm/entrypoints/openai/tool_parsers/granite_tool_parser.py +237 -0
- vllm/entrypoints/openai/tool_parsers/hermes_tool_parser.py +455 -0
- vllm/entrypoints/openai/tool_parsers/hunyuan_a13b_tool_parser.py +372 -0
- vllm/entrypoints/openai/tool_parsers/internlm2_tool_parser.py +216 -0
- vllm/entrypoints/openai/tool_parsers/jamba_tool_parser.py +308 -0
- vllm/entrypoints/openai/tool_parsers/kimi_k2_tool_parser.py +377 -0
- vllm/entrypoints/openai/tool_parsers/llama4_pythonic_tool_parser.py +316 -0
- vllm/entrypoints/openai/tool_parsers/llama_tool_parser.py +269 -0
- vllm/entrypoints/openai/tool_parsers/longcat_tool_parser.py +39 -0
- vllm/entrypoints/openai/tool_parsers/minimax_tool_parser.py +816 -0
- vllm/entrypoints/openai/tool_parsers/mistral_tool_parser.py +369 -0
- vllm/entrypoints/openai/tool_parsers/openai_tool_parser.py +93 -0
- vllm/entrypoints/openai/tool_parsers/phi4mini_tool_parser.py +112 -0
- vllm/entrypoints/openai/tool_parsers/pythonic_tool_parser.py +308 -0
- vllm/entrypoints/openai/tool_parsers/qwen3coder_tool_parser.py +707 -0
- vllm/entrypoints/openai/tool_parsers/qwen3xml_tool_parser.py +1137 -0
- vllm/entrypoints/openai/tool_parsers/seed_oss_tool_parser.py +679 -0
- vllm/entrypoints/openai/tool_parsers/step3_tool_parser.py +296 -0
- vllm/entrypoints/openai/tool_parsers/utils.py +124 -0
- vllm/entrypoints/openai/tool_parsers/xlam_tool_parser.py +524 -0
- vllm/entrypoints/renderer.py +395 -0
- vllm/entrypoints/score_utils.py +232 -0
- vllm/entrypoints/ssl.py +75 -0
- vllm/entrypoints/tool.py +139 -0
- vllm/entrypoints/tool_server.py +206 -0
- vllm/entrypoints/utils.py +233 -0
- vllm/env_override.py +23 -0
- vllm/envs.py +1590 -0
- vllm/executor/__init__.py +0 -0
- vllm/executor/executor_base.py +381 -0
- vllm/executor/msgspec_utils.py +35 -0
- vllm/executor/ray_distributed_executor.py +699 -0
- vllm/executor/ray_utils.py +410 -0
- vllm/executor/uniproc_executor.py +176 -0
- vllm/forward_context.py +402 -0
- vllm/inputs/__init__.py +30 -0
- vllm/inputs/data.py +356 -0
- vllm/inputs/parse.py +151 -0
- vllm/inputs/preprocess.py +664 -0
- vllm/logger.py +229 -0
- vllm/logging_utils/__init__.py +10 -0
- vllm/logging_utils/dump_input.py +81 -0
- vllm/logging_utils/formatter.py +79 -0
- vllm/logging_utils/log_time.py +32 -0
- vllm/logits_process.py +119 -0
- vllm/logprobs.py +28 -0
- vllm/lora/__init__.py +0 -0
- vllm/lora/layers/__init__.py +34 -0
- vllm/lora/layers/base.py +69 -0
- vllm/lora/layers/base_linear.py +185 -0
- vllm/lora/layers/column_parallel_linear.py +609 -0
- vllm/lora/layers/logits_processor.py +247 -0
- vllm/lora/layers/qkv_x_parallel_linear.py +8 -0
- vllm/lora/layers/replicated_linear.py +60 -0
- vllm/lora/layers/row_parallel_linear.py +196 -0
- vllm/lora/layers/utils.py +65 -0
- vllm/lora/layers/vocal_parallel_embedding.py +174 -0
- vllm/lora/lora_weights.py +199 -0
- vllm/lora/models.py +816 -0
- vllm/lora/ops/__init__.py +0 -0
- vllm/lora/ops/ipex_ops/__init__.py +7 -0
- vllm/lora/ops/ipex_ops/lora_ops.py +44 -0
- vllm/lora/ops/torch_ops/__init__.py +16 -0
- vllm/lora/ops/torch_ops/lora_ops.py +119 -0
- vllm/lora/ops/triton_ops/__init__.py +12 -0
- vllm/lora/ops/triton_ops/kernel_utils.py +243 -0
- vllm/lora/ops/triton_ops/lora_expand_op.py +289 -0
- vllm/lora/ops/triton_ops/lora_kernel_metadata.py +148 -0
- vllm/lora/ops/triton_ops/lora_shrink_op.py +243 -0
- vllm/lora/ops/triton_ops/utils.py +126 -0
- vllm/lora/ops/xla_ops/__init__.py +7 -0
- vllm/lora/ops/xla_ops/lora_ops.py +144 -0
- vllm/lora/peft_helper.py +127 -0
- vllm/lora/punica_wrapper/__init__.py +10 -0
- vllm/lora/punica_wrapper/punica_base.py +458 -0
- vllm/lora/punica_wrapper/punica_cpu.py +349 -0
- vllm/lora/punica_wrapper/punica_gpu.py +272 -0
- vllm/lora/punica_wrapper/punica_selector.py +20 -0
- vllm/lora/punica_wrapper/punica_tpu.py +391 -0
- vllm/lora/punica_wrapper/punica_xpu.py +276 -0
- vllm/lora/punica_wrapper/utils.py +136 -0
- vllm/lora/request.py +97 -0
- vllm/lora/resolver.py +85 -0
- vllm/lora/utils.py +246 -0
- vllm/lora/worker_manager.py +267 -0
- vllm/model_executor/__init__.py +12 -0
- vllm/model_executor/custom_op.py +194 -0
- vllm/model_executor/layers/__init__.py +0 -0
- vllm/model_executor/layers/activation.py +575 -0
- vllm/model_executor/layers/attention_layer_base.py +23 -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 +225 -0
- vllm/model_executor/layers/fla/ops/chunk_delta_h.py +290 -0
- vllm/model_executor/layers/fla/ops/chunk_o.py +177 -0
- vllm/model_executor/layers/fla/ops/chunk_scaled_dot_kkt.py +140 -0
- vllm/model_executor/layers/fla/ops/cumsum.py +226 -0
- vllm/model_executor/layers/fla/ops/fused_recurrent.py +366 -0
- vllm/model_executor/layers/fla/ops/index.py +39 -0
- vllm/model_executor/layers/fla/ops/l2norm.py +143 -0
- vllm/model_executor/layers/fla/ops/layernorm_guard.py +337 -0
- vllm/model_executor/layers/fla/ops/op.py +39 -0
- vllm/model_executor/layers/fla/ops/solve_tril.py +365 -0
- vllm/model_executor/layers/fla/ops/utils.py +180 -0
- vllm/model_executor/layers/fla/ops/wy_fast.py +114 -0
- vllm/model_executor/layers/fused_moe/__init__.py +89 -0
- vllm/model_executor/layers/fused_moe/batched_deep_gemm_moe.py +322 -0
- vllm/model_executor/layers/fused_moe/batched_triton_or_deep_gemm_moe.py +141 -0
- vllm/model_executor/layers/fused_moe/config.py +804 -0
- vllm/model_executor/layers/fused_moe/configs/E=1,N=14336,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a16.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=1,N=14336,device_name=NVIDIA_A100-SXM4-80GB.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=1,N=1792,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a16.json +218 -0
- vllm/model_executor/layers/fused_moe/configs/E=1,N=1792,device_name=NVIDIA_A100-SXM4-80GB.json +218 -0
- vllm/model_executor/layers/fused_moe/configs/E=1,N=3072,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a16.json +218 -0
- vllm/model_executor/layers/fused_moe/configs/E=1,N=3072,device_name=NVIDIA_H100_80GB_HBM3,dtype=int8_w8a16.json +218 -0
- vllm/model_executor/layers/fused_moe/configs/E=1,N=3072,device_name=NVIDIA_H100_80GB_HBM3.json +218 -0
- vllm/model_executor/layers/fused_moe/configs/E=1,N=3584,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a16.json +218 -0
- vllm/model_executor/layers/fused_moe/configs/E=1,N=3584,device_name=NVIDIA_A100-SXM4-80GB.json +218 -0
- vllm/model_executor/layers/fused_moe/configs/E=1,N=7168,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a16.json +218 -0
- vllm/model_executor/layers/fused_moe/configs/E=1,N=7168,device_name=NVIDIA_A100-SXM4-80GB.json +218 -0
- vllm/model_executor/layers/fused_moe/configs/E=128,N=1024,device_name=AMD_Instinct_MI300X,dtype=fp8_w8a8.json +164 -0
- vllm/model_executor/layers/fused_moe/configs/E=128,N=1024,device_name=AMD_Instinct_MI300X.json +200 -0
- vllm/model_executor/layers/fused_moe/configs/E=128,N=1024,device_name=NVIDIA_H100,dtype=fp8_w8a8.json +123 -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=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=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=1344,device_name=NVIDIA_A100-SXM4-40GB.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=16,N=1344,device_name=NVIDIA_A100-SXM4-80GB.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=16,N=1344,device_name=NVIDIA_H100_80GB_HBM3.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=16,N=14336,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a16.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=16,N=14336,device_name=NVIDIA_A100-SXM4-80GB.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=16,N=1792,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a16.json +218 -0
- vllm/model_executor/layers/fused_moe/configs/E=16,N=1792,device_name=NVIDIA_A100-SXM4-80GB.json +218 -0
- vllm/model_executor/layers/fused_moe/configs/E=16,N=2688,device_name=NVIDIA_A100-SXM4-80GB.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=16,N=2688,device_name=NVIDIA_H100_80GB_HBM3.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=16,N=3072,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a16.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=16,N=3072,device_name=NVIDIA_H100_80GB_HBM3,dtype=int8_w8a16.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=16,N=3200,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8.json +130 -0
- vllm/model_executor/layers/fused_moe/configs/E=16,N=3584,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a16.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=16,N=3584,device_name=NVIDIA_A100-SXM4-80GB.json +218 -0
- vllm/model_executor/layers/fused_moe/configs/E=16,N=6400,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8.json +130 -0
- vllm/model_executor/layers/fused_moe/configs/E=16,N=7168,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a16.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=16,N=7168,device_name=NVIDIA_A100-SXM4-80GB.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=16,N=7168,device_name=NVIDIA_H100_80GB_HBM3,dtype=int8_w8a16.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=16,N=800,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8.json +130 -0
- vllm/model_executor/layers/fused_moe/configs/E=160,N=192,device_name=NVIDIA_A800-SXM4-80GB.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=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=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=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=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=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_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.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_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=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_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=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 +300 -0
- vllm/model_executor/layers/fused_moe/cutlass_moe.py +957 -0
- vllm/model_executor/layers/fused_moe/deep_gemm_moe.py +362 -0
- vllm/model_executor/layers/fused_moe/deep_gemm_utils.py +413 -0
- vllm/model_executor/layers/fused_moe/deepep_ht_prepare_finalize.py +361 -0
- vllm/model_executor/layers/fused_moe/deepep_ll_prepare_finalize.py +274 -0
- vllm/model_executor/layers/fused_moe/flashinfer_cutlass_moe.py +268 -0
- vllm/model_executor/layers/fused_moe/flashinfer_cutlass_prepare_finalize.py +300 -0
- vllm/model_executor/layers/fused_moe/flashinfer_trtllm_moe.py +184 -0
- vllm/model_executor/layers/fused_moe/fused_batched_moe.py +993 -0
- vllm/model_executor/layers/fused_moe/fused_marlin_moe.py +239 -0
- vllm/model_executor/layers/fused_moe/fused_moe.py +1890 -0
- vllm/model_executor/layers/fused_moe/gpt_oss_triton_kernels_moe.py +307 -0
- vllm/model_executor/layers/fused_moe/layer.py +2195 -0
- vllm/model_executor/layers/fused_moe/modular_kernel.py +1038 -0
- vllm/model_executor/layers/fused_moe/moe_align_block_size.py +87 -0
- vllm/model_executor/layers/fused_moe/moe_pallas.py +80 -0
- vllm/model_executor/layers/fused_moe/moe_permute_unpermute.py +205 -0
- vllm/model_executor/layers/fused_moe/moe_torch_iterative.py +60 -0
- vllm/model_executor/layers/fused_moe/pplx_prepare_finalize.py +341 -0
- vllm/model_executor/layers/fused_moe/prepare_finalize.py +70 -0
- vllm/model_executor/layers/fused_moe/rocm_aiter_fused_moe.py +424 -0
- vllm/model_executor/layers/fused_moe/routing_simulator.py +291 -0
- vllm/model_executor/layers/fused_moe/topk_weight_and_reduce.py +146 -0
- vllm/model_executor/layers/fused_moe/triton_deep_gemm_moe.py +143 -0
- vllm/model_executor/layers/fused_moe/trtllm_moe.py +191 -0
- vllm/model_executor/layers/fused_moe/utils.py +274 -0
- vllm/model_executor/layers/layernorm.py +395 -0
- vllm/model_executor/layers/lightning_attn.py +661 -0
- vllm/model_executor/layers/linear.py +1603 -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 +42 -0
- vllm/model_executor/layers/mamba/linear_attn.py +403 -0
- vllm/model_executor/layers/mamba/mamba_mixer.py +466 -0
- vllm/model_executor/layers/mamba/mamba_mixer2.py +764 -0
- vllm/model_executor/layers/mamba/mamba_utils.py +186 -0
- vllm/model_executor/layers/mamba/ops/__init__.py +0 -0
- vllm/model_executor/layers/mamba/ops/causal_conv1d.py +1092 -0
- vllm/model_executor/layers/mamba/ops/layernorm_gated.py +168 -0
- vllm/model_executor/layers/mamba/ops/mamba_ssm.py +414 -0
- vllm/model_executor/layers/mamba/ops/ssd_bmm.py +242 -0
- vllm/model_executor/layers/mamba/ops/ssd_chunk_scan.py +527 -0
- vllm/model_executor/layers/mamba/ops/ssd_chunk_state.py +724 -0
- vllm/model_executor/layers/mamba/ops/ssd_combined.py +238 -0
- vllm/model_executor/layers/mamba/ops/ssd_state_passing.py +200 -0
- vllm/model_executor/layers/mamba/short_conv.py +253 -0
- vllm/model_executor/layers/mla.py +173 -0
- vllm/model_executor/layers/pooler.py +719 -0
- vllm/model_executor/layers/quantization/__init__.py +157 -0
- vllm/model_executor/layers/quantization/auto_round.py +388 -0
- vllm/model_executor/layers/quantization/awq.py +228 -0
- vllm/model_executor/layers/quantization/awq_marlin.py +554 -0
- vllm/model_executor/layers/quantization/awq_triton.py +320 -0
- vllm/model_executor/layers/quantization/base_config.py +170 -0
- vllm/model_executor/layers/quantization/bitblas.py +464 -0
- vllm/model_executor/layers/quantization/bitsandbytes.py +627 -0
- vllm/model_executor/layers/quantization/compressed_tensors/__init__.py +0 -0
- vllm/model_executor/layers/quantization/compressed_tensors/compressed_tensors.py +797 -0
- vllm/model_executor/layers/quantization/compressed_tensors/compressed_tensors_moe.py +2074 -0
- vllm/model_executor/layers/quantization/compressed_tensors/schemes/__init__.py +27 -0
- vllm/model_executor/layers/quantization/compressed_tensors/schemes/compressed_tensors_24.py +366 -0
- vllm/model_executor/layers/quantization/compressed_tensors/schemes/compressed_tensors_scheme.py +55 -0
- vllm/model_executor/layers/quantization/compressed_tensors/schemes/compressed_tensors_w4a16_24.py +160 -0
- vllm/model_executor/layers/quantization/compressed_tensors/schemes/compressed_tensors_w4a16_nvfp4.py +105 -0
- vllm/model_executor/layers/quantization/compressed_tensors/schemes/compressed_tensors_w4a4_nvfp4.py +185 -0
- vllm/model_executor/layers/quantization/compressed_tensors/schemes/compressed_tensors_w4a8_fp8.py +169 -0
- vllm/model_executor/layers/quantization/compressed_tensors/schemes/compressed_tensors_w4a8_int.py +135 -0
- vllm/model_executor/layers/quantization/compressed_tensors/schemes/compressed_tensors_w8a16_fp8.py +121 -0
- vllm/model_executor/layers/quantization/compressed_tensors/schemes/compressed_tensors_w8a8_fp8.py +157 -0
- vllm/model_executor/layers/quantization/compressed_tensors/schemes/compressed_tensors_w8a8_int8.py +111 -0
- vllm/model_executor/layers/quantization/compressed_tensors/schemes/compressed_tensors_wNa16.py +201 -0
- vllm/model_executor/layers/quantization/compressed_tensors/transform/__init__.py +0 -0
- vllm/model_executor/layers/quantization/compressed_tensors/transform/linear.py +238 -0
- vllm/model_executor/layers/quantization/compressed_tensors/transform/module.py +153 -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 +46 -0
- vllm/model_executor/layers/quantization/compressed_tensors/transform/utils.py +13 -0
- vllm/model_executor/layers/quantization/compressed_tensors/triton_scaled_mm.py +206 -0
- vllm/model_executor/layers/quantization/compressed_tensors/utils.py +216 -0
- vllm/model_executor/layers/quantization/deepspeedfp.py +196 -0
- vllm/model_executor/layers/quantization/experts_int8.py +223 -0
- vllm/model_executor/layers/quantization/fbgemm_fp8.py +172 -0
- vllm/model_executor/layers/quantization/fp8.py +1098 -0
- vllm/model_executor/layers/quantization/gguf.py +599 -0
- vllm/model_executor/layers/quantization/gptq.py +340 -0
- vllm/model_executor/layers/quantization/gptq_bitblas.py +448 -0
- vllm/model_executor/layers/quantization/gptq_marlin.py +751 -0
- vllm/model_executor/layers/quantization/gptq_marlin_24.py +297 -0
- vllm/model_executor/layers/quantization/hqq_marlin.py +333 -0
- vllm/model_executor/layers/quantization/inc.py +61 -0
- vllm/model_executor/layers/quantization/input_quant_fp8.py +156 -0
- vllm/model_executor/layers/quantization/ipex_quant.py +415 -0
- vllm/model_executor/layers/quantization/kernels/__init__.py +0 -0
- vllm/model_executor/layers/quantization/kernels/mixed_precision/MPLinearKernel.py +91 -0
- vllm/model_executor/layers/quantization/kernels/mixed_precision/__init__.py +93 -0
- vllm/model_executor/layers/quantization/kernels/mixed_precision/allspark.py +116 -0
- vllm/model_executor/layers/quantization/kernels/mixed_precision/bitblas.py +302 -0
- vllm/model_executor/layers/quantization/kernels/mixed_precision/conch.py +92 -0
- vllm/model_executor/layers/quantization/kernels/mixed_precision/cutlass.py +117 -0
- vllm/model_executor/layers/quantization/kernels/mixed_precision/dynamic_4bit.py +92 -0
- vllm/model_executor/layers/quantization/kernels/mixed_precision/exllama.py +143 -0
- vllm/model_executor/layers/quantization/kernels/mixed_precision/machete.py +144 -0
- vllm/model_executor/layers/quantization/kernels/mixed_precision/marlin.py +139 -0
- vllm/model_executor/layers/quantization/kernels/scaled_mm/ScaledMMLinearKernel.py +67 -0
- vllm/model_executor/layers/quantization/kernels/scaled_mm/__init__.py +89 -0
- vllm/model_executor/layers/quantization/kernels/scaled_mm/aiter.py +161 -0
- vllm/model_executor/layers/quantization/kernels/scaled_mm/cpu.py +206 -0
- vllm/model_executor/layers/quantization/kernels/scaled_mm/cutlass.py +137 -0
- vllm/model_executor/layers/quantization/kernels/scaled_mm/triton.py +41 -0
- vllm/model_executor/layers/quantization/kernels/scaled_mm/xla.py +104 -0
- vllm/model_executor/layers/quantization/kv_cache.py +143 -0
- vllm/model_executor/layers/quantization/modelopt.py +1596 -0
- vllm/model_executor/layers/quantization/moe_wna16.py +484 -0
- vllm/model_executor/layers/quantization/mxfp4.py +988 -0
- vllm/model_executor/layers/quantization/petit.py +306 -0
- vllm/model_executor/layers/quantization/ptpc_fp8.py +129 -0
- vllm/model_executor/layers/quantization/quark/__init__.py +0 -0
- vllm/model_executor/layers/quantization/quark/quark.py +432 -0
- vllm/model_executor/layers/quantization/quark/quark_moe.py +561 -0
- vllm/model_executor/layers/quantization/quark/schemes/__init__.py +9 -0
- vllm/model_executor/layers/quantization/quark/schemes/quark_scheme.py +55 -0
- vllm/model_executor/layers/quantization/quark/schemes/quark_w4a4_mxfp4.py +239 -0
- vllm/model_executor/layers/quantization/quark/schemes/quark_w8a8_fp8.py +163 -0
- vllm/model_executor/layers/quantization/quark/schemes/quark_w8a8_int8.py +122 -0
- vllm/model_executor/layers/quantization/quark/utils.py +105 -0
- vllm/model_executor/layers/quantization/rtn.py +466 -0
- vllm/model_executor/layers/quantization/schema.py +86 -0
- vllm/model_executor/layers/quantization/torchao.py +214 -0
- vllm/model_executor/layers/quantization/tpu_int8.py +125 -0
- vllm/model_executor/layers/quantization/utils/__init__.py +6 -0
- vllm/model_executor/layers/quantization/utils/allspark_utils.py +52 -0
- vllm/model_executor/layers/quantization/utils/bitblas_utils.py +210 -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 +79 -0
- vllm/model_executor/layers/quantization/utils/flashinfer_utils.py +248 -0
- vllm/model_executor/layers/quantization/utils/fp8_utils.py +949 -0
- vllm/model_executor/layers/quantization/utils/gptq_utils.py +146 -0
- vllm/model_executor/layers/quantization/utils/int8_utils.py +492 -0
- vllm/model_executor/layers/quantization/utils/layer_utils.py +40 -0
- vllm/model_executor/layers/quantization/utils/machete_utils.py +50 -0
- vllm/model_executor/layers/quantization/utils/marlin_utils.py +479 -0
- vllm/model_executor/layers/quantization/utils/marlin_utils_fp4.py +396 -0
- vllm/model_executor/layers/quantization/utils/marlin_utils_fp8.py +345 -0
- vllm/model_executor/layers/quantization/utils/marlin_utils_test.py +165 -0
- vllm/model_executor/layers/quantization/utils/marlin_utils_test_24.py +464 -0
- vllm/model_executor/layers/quantization/utils/mxfp4_utils.py +141 -0
- vllm/model_executor/layers/quantization/utils/mxfp8_utils.py +20 -0
- vllm/model_executor/layers/quantization/utils/nvfp4_emulation_utils.py +137 -0
- vllm/model_executor/layers/quantization/utils/nvfp4_moe_support.py +59 -0
- vllm/model_executor/layers/quantization/utils/petit_utils.py +122 -0
- vllm/model_executor/layers/quantization/utils/quant_utils.py +641 -0
- vllm/model_executor/layers/quantization/utils/w8a8_utils.py +458 -0
- vllm/model_executor/layers/resampler.py +270 -0
- vllm/model_executor/layers/rotary_embedding/__init__.py +204 -0
- vllm/model_executor/layers/rotary_embedding/base.py +177 -0
- vllm/model_executor/layers/rotary_embedding/common.py +150 -0
- vllm/model_executor/layers/rotary_embedding/deepseek_scaling_rope.py +138 -0
- vllm/model_executor/layers/rotary_embedding/dual_chunk_rope.py +197 -0
- vllm/model_executor/layers/rotary_embedding/dynamic_ntk_alpha_rope.py +41 -0
- vllm/model_executor/layers/rotary_embedding/dynamic_ntk_scaling_rope.py +67 -0
- vllm/model_executor/layers/rotary_embedding/ernie45_vl_rope.py +80 -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 +81 -0
- vllm/model_executor/layers/rotary_embedding/mrope.py +1321 -0
- vllm/model_executor/layers/rotary_embedding/ntk_scaling_rope.py +42 -0
- vllm/model_executor/layers/rotary_embedding/phi3_long_rope_scaled_rope.py +129 -0
- vllm/model_executor/layers/rotary_embedding/rocm_aiter_rope_ops.py +86 -0
- vllm/model_executor/layers/rotary_embedding/yarn_scaling_rope.py +68 -0
- vllm/model_executor/layers/shared_fused_moe/__init__.py +6 -0
- vllm/model_executor/layers/shared_fused_moe/shared_fused_moe.py +56 -0
- vllm/model_executor/layers/utils.py +195 -0
- vllm/model_executor/layers/vocab_parallel_embedding.py +487 -0
- vllm/model_executor/model_loader/__init__.py +138 -0
- vllm/model_executor/model_loader/base_loader.py +52 -0
- vllm/model_executor/model_loader/bitsandbytes_loader.py +788 -0
- vllm/model_executor/model_loader/default_loader.py +277 -0
- vllm/model_executor/model_loader/dummy_loader.py +28 -0
- vllm/model_executor/model_loader/gguf_loader.py +155 -0
- vllm/model_executor/model_loader/runai_streamer_loader.py +104 -0
- vllm/model_executor/model_loader/sharded_state_loader.py +199 -0
- vllm/model_executor/model_loader/tensorizer.py +738 -0
- vllm/model_executor/model_loader/tensorizer_loader.py +143 -0
- vllm/model_executor/model_loader/tpu.py +114 -0
- vllm/model_executor/model_loader/utils.py +292 -0
- vllm/model_executor/model_loader/weight_utils.py +990 -0
- vllm/model_executor/models/__init__.py +33 -0
- vllm/model_executor/models/adapters.py +542 -0
- vllm/model_executor/models/aimv2.py +246 -0
- vllm/model_executor/models/apertus.py +579 -0
- vllm/model_executor/models/arcee.py +422 -0
- vllm/model_executor/models/arctic.py +558 -0
- vllm/model_executor/models/aria.py +650 -0
- vllm/model_executor/models/aya_vision.py +468 -0
- vllm/model_executor/models/baichuan.py +474 -0
- vllm/model_executor/models/bailing_moe.py +642 -0
- vllm/model_executor/models/bamba.py +514 -0
- vllm/model_executor/models/bert.py +665 -0
- vllm/model_executor/models/bert_with_rope.py +687 -0
- vllm/model_executor/models/blip.py +339 -0
- vllm/model_executor/models/blip2.py +712 -0
- vllm/model_executor/models/bloom.py +374 -0
- vllm/model_executor/models/chameleon.py +1139 -0
- vllm/model_executor/models/chatglm.py +476 -0
- vllm/model_executor/models/clip.py +407 -0
- vllm/model_executor/models/cohere2_vision.py +481 -0
- vllm/model_executor/models/commandr.py +465 -0
- vllm/model_executor/models/config.py +445 -0
- vllm/model_executor/models/dbrx.py +471 -0
- vllm/model_executor/models/deepseek.py +497 -0
- vllm/model_executor/models/deepseek_eagle.py +240 -0
- vllm/model_executor/models/deepseek_mtp.py +289 -0
- vllm/model_executor/models/deepseek_v2.py +1444 -0
- vllm/model_executor/models/deepseek_vl2.py +658 -0
- vllm/model_executor/models/dots1.py +546 -0
- vllm/model_executor/models/dots_ocr.py +873 -0
- vllm/model_executor/models/ernie45.py +43 -0
- vllm/model_executor/models/ernie45_moe.py +607 -0
- vllm/model_executor/models/ernie45_vl.py +1527 -0
- vllm/model_executor/models/ernie45_vl_moe.py +727 -0
- vllm/model_executor/models/ernie_mtp.py +268 -0
- vllm/model_executor/models/exaone.py +550 -0
- vllm/model_executor/models/exaone4.py +533 -0
- vllm/model_executor/models/fairseq2_llama.py +154 -0
- vllm/model_executor/models/falcon.py +509 -0
- vllm/model_executor/models/falcon_h1.py +674 -0
- vllm/model_executor/models/fuyu.py +399 -0
- vllm/model_executor/models/gemma.py +425 -0
- vllm/model_executor/models/gemma2.py +422 -0
- vllm/model_executor/models/gemma3.py +555 -0
- vllm/model_executor/models/gemma3_mm.py +721 -0
- vllm/model_executor/models/gemma3n.py +1113 -0
- vllm/model_executor/models/gemma3n_mm.py +761 -0
- vllm/model_executor/models/glm.py +23 -0
- vllm/model_executor/models/glm4.py +304 -0
- vllm/model_executor/models/glm4_1v.py +1690 -0
- vllm/model_executor/models/glm4_moe.py +727 -0
- vllm/model_executor/models/glm4_moe_mtp.py +301 -0
- vllm/model_executor/models/glm4v.py +654 -0
- vllm/model_executor/models/gpt2.py +380 -0
- vllm/model_executor/models/gpt_bigcode.py +344 -0
- vllm/model_executor/models/gpt_j.py +339 -0
- vllm/model_executor/models/gpt_neox.py +330 -0
- vllm/model_executor/models/gpt_oss.py +712 -0
- vllm/model_executor/models/granite.py +489 -0
- vllm/model_executor/models/granite_speech.py +794 -0
- vllm/model_executor/models/granitemoe.py +550 -0
- vllm/model_executor/models/granitemoehybrid.py +614 -0
- vllm/model_executor/models/granitemoeshared.py +332 -0
- vllm/model_executor/models/gritlm.py +262 -0
- vllm/model_executor/models/grok1.py +547 -0
- vllm/model_executor/models/h2ovl.py +536 -0
- vllm/model_executor/models/hunyuan_v1.py +1042 -0
- vllm/model_executor/models/hyperclovax_vision.py +1192 -0
- vllm/model_executor/models/idefics2_vision_model.py +417 -0
- vllm/model_executor/models/idefics3.py +756 -0
- vllm/model_executor/models/interfaces.py +959 -0
- vllm/model_executor/models/interfaces_base.py +192 -0
- vllm/model_executor/models/intern_vit.py +441 -0
- vllm/model_executor/models/internlm2.py +450 -0
- vllm/model_executor/models/internlm2_ve.py +148 -0
- vllm/model_executor/models/interns1.py +838 -0
- vllm/model_executor/models/interns1_vit.py +418 -0
- vllm/model_executor/models/internvl.py +1423 -0
- vllm/model_executor/models/jais.py +373 -0
- vllm/model_executor/models/jamba.py +591 -0
- vllm/model_executor/models/jina_vl.py +144 -0
- vllm/model_executor/models/keye.py +1680 -0
- vllm/model_executor/models/keye_vl1_5.py +602 -0
- vllm/model_executor/models/kimi_vl.py +618 -0
- vllm/model_executor/models/lfm2.py +548 -0
- vllm/model_executor/models/llama.py +669 -0
- vllm/model_executor/models/llama4.py +746 -0
- vllm/model_executor/models/llama4_eagle.py +239 -0
- vllm/model_executor/models/llama_eagle.py +179 -0
- vllm/model_executor/models/llama_eagle3.py +296 -0
- vllm/model_executor/models/llava.py +870 -0
- vllm/model_executor/models/llava_next.py +571 -0
- vllm/model_executor/models/llava_next_video.py +476 -0
- vllm/model_executor/models/llava_onevision.py +942 -0
- vllm/model_executor/models/longcat_flash.py +715 -0
- vllm/model_executor/models/longcat_flash_mtp.py +352 -0
- vllm/model_executor/models/mamba.py +275 -0
- vllm/model_executor/models/mamba2.py +291 -0
- vllm/model_executor/models/medusa.py +169 -0
- vllm/model_executor/models/midashenglm.py +792 -0
- vllm/model_executor/models/mimo.py +188 -0
- vllm/model_executor/models/mimo_mtp.py +280 -0
- vllm/model_executor/models/minicpm.py +631 -0
- vllm/model_executor/models/minicpm3.py +230 -0
- vllm/model_executor/models/minicpm_eagle.py +389 -0
- vllm/model_executor/models/minicpmo.py +770 -0
- vllm/model_executor/models/minicpmv.py +1784 -0
- vllm/model_executor/models/minimax_text_01.py +986 -0
- vllm/model_executor/models/minimax_vl_01.py +426 -0
- vllm/model_executor/models/mistral3.py +628 -0
- vllm/model_executor/models/mixtral.py +606 -0
- vllm/model_executor/models/mllama4.py +1076 -0
- vllm/model_executor/models/mlp_speculator.py +206 -0
- vllm/model_executor/models/modernbert.py +374 -0
- vllm/model_executor/models/module_mapping.py +72 -0
- vllm/model_executor/models/molmo.py +1567 -0
- vllm/model_executor/models/moonvit.py +673 -0
- vllm/model_executor/models/motif.py +345 -0
- vllm/model_executor/models/mpt.py +329 -0
- vllm/model_executor/models/nano_nemotron_vl.py +1394 -0
- vllm/model_executor/models/nemotron.py +507 -0
- vllm/model_executor/models/nemotron_h.py +565 -0
- vllm/model_executor/models/nemotron_nas.py +481 -0
- vllm/model_executor/models/nemotron_vl.py +652 -0
- vllm/model_executor/models/nvlm_d.py +203 -0
- vllm/model_executor/models/olmo.py +404 -0
- vllm/model_executor/models/olmo2.py +439 -0
- vllm/model_executor/models/olmoe.py +483 -0
- vllm/model_executor/models/opt.py +412 -0
- vllm/model_executor/models/orion.py +348 -0
- vllm/model_executor/models/ovis.py +559 -0
- vllm/model_executor/models/ovis2_5.py +642 -0
- vllm/model_executor/models/paligemma.py +411 -0
- vllm/model_executor/models/persimmon.py +343 -0
- vllm/model_executor/models/phi.py +356 -0
- vllm/model_executor/models/phi3.py +19 -0
- vllm/model_executor/models/phi3v.py +698 -0
- vllm/model_executor/models/phi4_multimodal.py +1475 -0
- vllm/model_executor/models/phi4mm.py +1279 -0
- vllm/model_executor/models/phi4mm_audio.py +1254 -0
- vllm/model_executor/models/phi4mm_utils.py +1875 -0
- vllm/model_executor/models/phimoe.py +679 -0
- vllm/model_executor/models/pixtral.py +1345 -0
- vllm/model_executor/models/plamo2.py +978 -0
- vllm/model_executor/models/qwen.py +361 -0
- vllm/model_executor/models/qwen2.py +523 -0
- vllm/model_executor/models/qwen2_5_omni_thinker.py +984 -0
- vllm/model_executor/models/qwen2_5_vl.py +1481 -0
- vllm/model_executor/models/qwen2_audio.py +489 -0
- vllm/model_executor/models/qwen2_moe.py +558 -0
- vllm/model_executor/models/qwen2_rm.py +122 -0
- vllm/model_executor/models/qwen2_vl.py +1670 -0
- vllm/model_executor/models/qwen3.py +341 -0
- vllm/model_executor/models/qwen3_moe.py +692 -0
- vllm/model_executor/models/qwen3_next.py +1266 -0
- vllm/model_executor/models/qwen3_next_mtp.py +281 -0
- vllm/model_executor/models/qwen3_vl.py +1613 -0
- vllm/model_executor/models/qwen3_vl_moe.py +358 -0
- vllm/model_executor/models/qwen_vl.py +795 -0
- vllm/model_executor/models/radio.py +576 -0
- vllm/model_executor/models/registry.py +990 -0
- vllm/model_executor/models/roberta.py +252 -0
- vllm/model_executor/models/rvl.py +103 -0
- vllm/model_executor/models/seed_oss.py +485 -0
- vllm/model_executor/models/siglip.py +540 -0
- vllm/model_executor/models/siglip2navit.py +689 -0
- vllm/model_executor/models/skyworkr1v.py +911 -0
- vllm/model_executor/models/smolvlm.py +44 -0
- vllm/model_executor/models/solar.py +504 -0
- vllm/model_executor/models/stablelm.py +341 -0
- vllm/model_executor/models/starcoder2.py +354 -0
- vllm/model_executor/models/step3_text.py +510 -0
- vllm/model_executor/models/step3_vl.py +1072 -0
- vllm/model_executor/models/swin.py +475 -0
- vllm/model_executor/models/tarsier.py +639 -0
- vllm/model_executor/models/telechat2.py +151 -0
- vllm/model_executor/models/teleflm.py +79 -0
- vllm/model_executor/models/terratorch.py +294 -0
- vllm/model_executor/models/transformers.py +948 -0
- vllm/model_executor/models/ultravox.py +654 -0
- vllm/model_executor/models/utils.py +808 -0
- vllm/model_executor/models/vision.py +404 -0
- vllm/model_executor/models/voxtral.py +786 -0
- vllm/model_executor/models/whisper.py +963 -0
- vllm/model_executor/models/zamba2.py +960 -0
- vllm/model_executor/parameter.py +620 -0
- vllm/model_executor/utils.py +86 -0
- vllm/model_executor/warmup/__init__.py +0 -0
- vllm/model_executor/warmup/deep_gemm_warmup.py +230 -0
- vllm/model_executor/warmup/kernel_warmup.py +83 -0
- vllm/multimodal/__init__.py +33 -0
- vllm/multimodal/audio.py +116 -0
- vllm/multimodal/base.py +27 -0
- vllm/multimodal/cache.py +697 -0
- vllm/multimodal/evs.py +273 -0
- vllm/multimodal/hasher.py +102 -0
- vllm/multimodal/image.py +130 -0
- vllm/multimodal/inputs.py +987 -0
- vllm/multimodal/parse.py +511 -0
- vllm/multimodal/processing.py +2148 -0
- vllm/multimodal/profiling.py +284 -0
- vllm/multimodal/registry.py +345 -0
- vllm/multimodal/utils.py +503 -0
- vllm/multimodal/video.py +319 -0
- vllm/outputs.py +324 -0
- vllm/platforms/__init__.py +263 -0
- vllm/platforms/cpu.py +340 -0
- vllm/platforms/cuda.py +668 -0
- vllm/platforms/interface.py +620 -0
- vllm/platforms/rocm.py +497 -0
- vllm/platforms/tpu.py +233 -0
- vllm/platforms/xpu.py +243 -0
- vllm/plugins/__init__.py +72 -0
- vllm/plugins/io_processors/__init__.py +68 -0
- vllm/plugins/io_processors/interface.py +67 -0
- vllm/plugins/lora_resolvers/README.md +16 -0
- vllm/plugins/lora_resolvers/__init__.py +0 -0
- vllm/plugins/lora_resolvers/filesystem_resolver.py +50 -0
- vllm/pooling_params.py +191 -0
- vllm/profiler/__init__.py +0 -0
- vllm/profiler/layerwise_profile.py +375 -0
- vllm/profiler/utils.py +148 -0
- vllm/py.typed +2 -0
- vllm/ray/__init__.py +0 -0
- vllm/ray/lazy_utils.py +22 -0
- vllm/ray/ray_env.py +72 -0
- vllm/reasoning/__init__.py +29 -0
- vllm/reasoning/abs_reasoning_parsers.py +202 -0
- vllm/reasoning/basic_parsers.py +156 -0
- vllm/reasoning/deepseek_r1_reasoning_parser.py +67 -0
- vllm/reasoning/glm4_moe_reasoning_parser.py +151 -0
- vllm/reasoning/gptoss_reasoning_parser.py +87 -0
- vllm/reasoning/granite_reasoning_parser.py +363 -0
- vllm/reasoning/hunyuan_a13b_reasoning_parser.py +245 -0
- vllm/reasoning/mistral_reasoning_parser.py +56 -0
- vllm/reasoning/qwen3_reasoning_parser.py +72 -0
- vllm/reasoning/seedoss_reasoning_parser.py +28 -0
- vllm/reasoning/step3_reasoning_parser.py +109 -0
- vllm/sampling_params.py +593 -0
- vllm/scalar_type.py +349 -0
- vllm/scripts.py +15 -0
- vllm/sequence.py +103 -0
- vllm/tasks.py +11 -0
- vllm/test_utils.py +129 -0
- vllm/third_party/__init__.py +0 -0
- vllm/third_party/pynvml.py +6140 -0
- vllm/tracing.py +136 -0
- vllm/transformers_utils/__init__.py +24 -0
- vllm/transformers_utils/chat_templates/__init__.py +5 -0
- vllm/transformers_utils/chat_templates/registry.py +70 -0
- vllm/transformers_utils/chat_templates/template_basic.jinja +3 -0
- vllm/transformers_utils/chat_templates/template_blip2.jinja +11 -0
- vllm/transformers_utils/chat_templates/template_chatml.jinja +10 -0
- vllm/transformers_utils/chat_templates/template_deepseek_vl2.jinja +23 -0
- vllm/transformers_utils/chat_templates/template_fuyu.jinja +3 -0
- vllm/transformers_utils/chat_templates/template_minicpmv45.jinja +93 -0
- vllm/transformers_utils/config.py +1102 -0
- vllm/transformers_utils/config_parser_base.py +20 -0
- vllm/transformers_utils/configs/__init__.py +63 -0
- vllm/transformers_utils/configs/arctic.py +207 -0
- vllm/transformers_utils/configs/chatglm.py +72 -0
- vllm/transformers_utils/configs/deepseek_v3.py +101 -0
- vllm/transformers_utils/configs/deepseek_vl2.py +216 -0
- vllm/transformers_utils/configs/dotsocr.py +69 -0
- vllm/transformers_utils/configs/eagle.py +84 -0
- vllm/transformers_utils/configs/falcon.py +90 -0
- vllm/transformers_utils/configs/jais.py +237 -0
- vllm/transformers_utils/configs/kimi_vl.py +37 -0
- vllm/transformers_utils/configs/medusa.py +63 -0
- vllm/transformers_utils/configs/midashenglm.py +101 -0
- vllm/transformers_utils/configs/mistral.py +165 -0
- vllm/transformers_utils/configs/mlp_speculator.py +68 -0
- vllm/transformers_utils/configs/moonvit.py +33 -0
- vllm/transformers_utils/configs/nemotron.py +205 -0
- vllm/transformers_utils/configs/nemotron_h.py +259 -0
- vllm/transformers_utils/configs/nemotron_vl.py +56 -0
- vllm/transformers_utils/configs/olmo3.py +80 -0
- vllm/transformers_utils/configs/ovis.py +176 -0
- vllm/transformers_utils/configs/qwen3_next.py +275 -0
- vllm/transformers_utils/configs/radio.py +91 -0
- vllm/transformers_utils/configs/speculators/__init__.py +2 -0
- vllm/transformers_utils/configs/speculators/algos.py +32 -0
- vllm/transformers_utils/configs/speculators/base.py +111 -0
- vllm/transformers_utils/configs/step3_vl.py +123 -0
- vllm/transformers_utils/configs/ultravox.py +116 -0
- vllm/transformers_utils/detokenizer_utils.py +199 -0
- vllm/transformers_utils/dynamic_module.py +60 -0
- vllm/transformers_utils/processor.py +299 -0
- vllm/transformers_utils/processors/__init__.py +16 -0
- vllm/transformers_utils/processors/deepseek_vl2.py +362 -0
- vllm/transformers_utils/processors/ovis.py +420 -0
- vllm/transformers_utils/processors/ovis2_5.py +458 -0
- vllm/transformers_utils/runai_utils.py +104 -0
- vllm/transformers_utils/s3_utils.py +93 -0
- vllm/transformers_utils/tokenizer.py +292 -0
- vllm/transformers_utils/tokenizer_base.py +154 -0
- vllm/transformers_utils/tokenizers/__init__.py +10 -0
- vllm/transformers_utils/tokenizers/mistral.py +521 -0
- vllm/transformers_utils/utils.py +108 -0
- vllm/triton_utils/__init__.py +16 -0
- vllm/triton_utils/importing.py +96 -0
- vllm/usage/__init__.py +0 -0
- vllm/usage/usage_lib.py +259 -0
- vllm/utils/__init__.py +3566 -0
- vllm/utils/deep_gemm.py +319 -0
- vllm/utils/flashinfer.py +443 -0
- vllm/utils/jsontree.py +178 -0
- vllm/utils/tensor_schema.py +235 -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 +919 -0
- vllm/v1/attention/backends/flash_attn.py +795 -0
- vllm/v1/attention/backends/flashinfer.py +1181 -0
- vllm/v1/attention/backends/flex_attention.py +861 -0
- vllm/v1/attention/backends/gdn_attn.py +332 -0
- vllm/v1/attention/backends/linear_attn.py +67 -0
- vllm/v1/attention/backends/mamba1_attn.py +81 -0
- vllm/v1/attention/backends/mamba2_attn.py +232 -0
- vllm/v1/attention/backends/mamba_attn.py +52 -0
- vllm/v1/attention/backends/mla/__init__.py +0 -0
- vllm/v1/attention/backends/mla/common.py +1783 -0
- vllm/v1/attention/backends/mla/cutlass_mla.py +248 -0
- vllm/v1/attention/backends/mla/flashattn_mla.py +271 -0
- vllm/v1/attention/backends/mla/flashinfer_mla.py +114 -0
- vllm/v1/attention/backends/mla/flashmla.py +203 -0
- vllm/v1/attention/backends/mla/flashmla_sparse.py +544 -0
- vllm/v1/attention/backends/mla/indexer.py +342 -0
- vllm/v1/attention/backends/mla/rocm_aiter_mla.py +255 -0
- vllm/v1/attention/backends/mla/triton_mla.py +177 -0
- vllm/v1/attention/backends/pallas.py +409 -0
- vllm/v1/attention/backends/rocm_aiter_fa.py +549 -0
- vllm/v1/attention/backends/rocm_attn.py +426 -0
- vllm/v1/attention/backends/short_conv_attn.py +94 -0
- vllm/v1/attention/backends/tree_attn.py +451 -0
- vllm/v1/attention/backends/triton_attn.py +361 -0
- vllm/v1/attention/backends/utils.py +990 -0
- vllm/v1/attention/backends/xformers.py +438 -0
- vllm/v1/core/__init__.py +0 -0
- vllm/v1/core/block_pool.py +416 -0
- vllm/v1/core/encoder_cache_manager.py +333 -0
- vllm/v1/core/kv_cache_coordinator.py +440 -0
- vllm/v1/core/kv_cache_manager.py +399 -0
- vllm/v1/core/kv_cache_utils.py +1291 -0
- vllm/v1/core/sched/__init__.py +0 -0
- vllm/v1/core/sched/async_scheduler.py +47 -0
- vllm/v1/core/sched/interface.py +158 -0
- vllm/v1/core/sched/output.py +166 -0
- vllm/v1/core/sched/request_queue.py +224 -0
- vllm/v1/core/sched/scheduler.py +1296 -0
- vllm/v1/core/sched/utils.py +69 -0
- vllm/v1/core/single_type_kv_cache_manager.py +671 -0
- vllm/v1/cudagraph_dispatcher.py +125 -0
- vllm/v1/engine/__init__.py +203 -0
- vllm/v1/engine/async_llm.py +742 -0
- vllm/v1/engine/coordinator.py +357 -0
- vllm/v1/engine/core.py +1235 -0
- vllm/v1/engine/core_client.py +1334 -0
- vllm/v1/engine/detokenizer.py +349 -0
- vllm/v1/engine/exceptions.py +17 -0
- vllm/v1/engine/llm_engine.py +370 -0
- vllm/v1/engine/logprobs.py +201 -0
- vllm/v1/engine/output_processor.py +576 -0
- vllm/v1/engine/parallel_sampling.py +133 -0
- vllm/v1/engine/processor.py +545 -0
- vllm/v1/engine/utils.py +860 -0
- vllm/v1/executor/__init__.py +0 -0
- vllm/v1/executor/abstract.py +137 -0
- vllm/v1/executor/multiproc_executor.py +726 -0
- vllm/v1/executor/ray_distributed_executor.py +108 -0
- vllm/v1/executor/utils.py +23 -0
- vllm/v1/kv_cache_interface.py +375 -0
- vllm/v1/kv_offload/__init__.py +0 -0
- vllm/v1/kv_offload/abstract.py +165 -0
- vllm/v1/kv_offload/backend.py +96 -0
- vllm/v1/kv_offload/backends/__init__.py +0 -0
- vllm/v1/kv_offload/backends/cpu.py +61 -0
- vllm/v1/kv_offload/cpu.py +75 -0
- vllm/v1/kv_offload/factory.py +56 -0
- vllm/v1/kv_offload/lru_manager.py +132 -0
- vllm/v1/kv_offload/mediums.py +39 -0
- vllm/v1/kv_offload/spec.py +61 -0
- vllm/v1/kv_offload/worker/__init__.py +0 -0
- vllm/v1/kv_offload/worker/cpu_gpu.py +171 -0
- vllm/v1/kv_offload/worker/worker.py +142 -0
- vllm/v1/metrics/__init__.py +0 -0
- vllm/v1/metrics/loggers.py +741 -0
- vllm/v1/metrics/prometheus.py +82 -0
- vllm/v1/metrics/ray_wrappers.py +152 -0
- vllm/v1/metrics/reader.py +246 -0
- vllm/v1/metrics/stats.py +257 -0
- vllm/v1/outputs.py +161 -0
- vllm/v1/pool/__init__.py +0 -0
- vllm/v1/pool/metadata.py +77 -0
- vllm/v1/request.py +241 -0
- vllm/v1/sample/__init__.py +0 -0
- vllm/v1/sample/logits_processor/__init__.py +294 -0
- vllm/v1/sample/logits_processor/builtin.py +275 -0
- vllm/v1/sample/logits_processor/interface.py +97 -0
- vllm/v1/sample/logits_processor/state.py +161 -0
- vllm/v1/sample/metadata.py +43 -0
- vllm/v1/sample/ops/__init__.py +0 -0
- vllm/v1/sample/ops/bad_words.py +39 -0
- vllm/v1/sample/ops/logprobs.py +26 -0
- vllm/v1/sample/ops/penalties.py +43 -0
- vllm/v1/sample/ops/topk_topp_sampler.py +292 -0
- vllm/v1/sample/rejection_sampler.py +623 -0
- vllm/v1/sample/sampler.py +285 -0
- vllm/v1/sample/tpu/__init__.py +0 -0
- vllm/v1/sample/tpu/metadata.py +124 -0
- vllm/v1/sample/tpu/sampler.py +213 -0
- vllm/v1/serial_utils.py +423 -0
- vllm/v1/spec_decode/__init__.py +0 -0
- vllm/v1/spec_decode/eagle.py +1011 -0
- vllm/v1/spec_decode/medusa.py +66 -0
- vllm/v1/spec_decode/metadata.py +62 -0
- vllm/v1/spec_decode/metrics.py +211 -0
- vllm/v1/spec_decode/ngram_proposer.py +276 -0
- vllm/v1/spec_decode/utils.py +14 -0
- vllm/v1/structured_output/__init__.py +295 -0
- vllm/v1/structured_output/backend_guidance.py +245 -0
- vllm/v1/structured_output/backend_lm_format_enforcer.py +167 -0
- vllm/v1/structured_output/backend_outlines.py +320 -0
- vllm/v1/structured_output/backend_types.py +134 -0
- vllm/v1/structured_output/backend_xgrammar.py +327 -0
- vllm/v1/structured_output/request.py +86 -0
- vllm/v1/structured_output/utils.py +454 -0
- vllm/v1/utils.py +396 -0
- vllm/v1/worker/__init__.py +0 -0
- vllm/v1/worker/block_table.py +210 -0
- vllm/v1/worker/cpu_model_runner.py +175 -0
- vllm/v1/worker/cpu_worker.py +156 -0
- vllm/v1/worker/gpu_input_batch.py +863 -0
- vllm/v1/worker/gpu_model_runner.py +4160 -0
- vllm/v1/worker/gpu_ubatch_wrapper.py +399 -0
- vllm/v1/worker/gpu_worker.py +710 -0
- vllm/v1/worker/kv_connector_model_runner_mixin.py +132 -0
- vllm/v1/worker/lora_model_runner_mixin.py +183 -0
- vllm/v1/worker/tpu_input_batch.py +587 -0
- vllm/v1/worker/tpu_model_runner.py +1946 -0
- vllm/v1/worker/tpu_worker.py +346 -0
- vllm/v1/worker/ubatch_splitting.py +192 -0
- vllm/v1/worker/ubatch_utils.py +27 -0
- vllm/v1/worker/ubatching.py +224 -0
- vllm/v1/worker/utils.py +344 -0
- vllm/v1/worker/worker_base.py +65 -0
- vllm/v1/worker/xpu_model_runner.py +57 -0
- vllm/v1/worker/xpu_worker.py +179 -0
- vllm/version.py +41 -0
- vllm/vllm_flash_attn/.gitkeep +0 -0
- vllm/worker/__init__.py +0 -0
- vllm/worker/worker_base.py +279 -0
- vllm_cpu-0.11.0.post2.dist-info/METADATA +348 -0
- vllm_cpu-0.11.0.post2.dist-info/RECORD +1398 -0
- vllm_cpu-0.11.0.post2.dist-info/WHEEL +5 -0
- vllm_cpu-0.11.0.post2.dist-info/entry_points.txt +5 -0
- vllm_cpu-0.11.0.post2.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,2148 @@
|
|
|
1
|
+
# SPDX-License-Identifier: Apache-2.0
|
|
2
|
+
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
|
|
3
|
+
import time
|
|
4
|
+
from abc import ABC, abstractmethod
|
|
5
|
+
from collections import defaultdict
|
|
6
|
+
from collections.abc import (Callable, Generator, ItemsView, Iterable, Mapping,
|
|
7
|
+
Sequence)
|
|
8
|
+
from dataclasses import dataclass, field, replace
|
|
9
|
+
from enum import Enum
|
|
10
|
+
from functools import lru_cache
|
|
11
|
+
from typing import (TYPE_CHECKING, Any, Generic, NamedTuple, Optional,
|
|
12
|
+
Protocol, Union, cast, overload)
|
|
13
|
+
|
|
14
|
+
import regex as re
|
|
15
|
+
import torch
|
|
16
|
+
from typing_extensions import TypeVar, assert_never
|
|
17
|
+
|
|
18
|
+
from vllm.logger import init_logger
|
|
19
|
+
from vllm.transformers_utils.processor import cached_processor_from_config
|
|
20
|
+
from vllm.transformers_utils.tokenizer import (AnyTokenizer, decode_tokens,
|
|
21
|
+
encode_tokens)
|
|
22
|
+
from vllm.utils import (flatten_2d_lists, full_groupby,
|
|
23
|
+
get_allowed_kwarg_only_overrides)
|
|
24
|
+
from vllm.utils.jsontree import JSONTree, json_map_leaves
|
|
25
|
+
|
|
26
|
+
from .hasher import MultiModalHasher
|
|
27
|
+
from .inputs import (MultiModalDataDict, MultiModalEncDecInputs,
|
|
28
|
+
MultiModalFieldConfig, MultiModalInputs,
|
|
29
|
+
MultiModalKwargsItem, MultiModalKwargsItems,
|
|
30
|
+
MultiModalKwargsOptionalItems, MultiModalUUIDDict,
|
|
31
|
+
PlaceholderRange)
|
|
32
|
+
from .parse import (DictEmbeddingItems, EmbeddingItems, MultiModalDataItems,
|
|
33
|
+
MultiModalDataParser)
|
|
34
|
+
|
|
35
|
+
if TYPE_CHECKING:
|
|
36
|
+
from transformers.configuration_utils import PretrainedConfig
|
|
37
|
+
from transformers.feature_extraction_utils import BatchFeature
|
|
38
|
+
from transformers.processing_utils import ProcessorMixin
|
|
39
|
+
|
|
40
|
+
from vllm.config import ModelConfig
|
|
41
|
+
|
|
42
|
+
from .cache import BaseMultiModalProcessorCache
|
|
43
|
+
from .profiling import BaseDummyInputsBuilder
|
|
44
|
+
|
|
45
|
+
logger = init_logger(__name__)
|
|
46
|
+
|
|
47
|
+
_S = TypeVar("_S", str, list[int])
|
|
48
|
+
|
|
49
|
+
PromptSeq = Union[str, list[int]]
|
|
50
|
+
"""A token sequence (list of token IDs) or text."""
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
@lru_cache(maxsize=2048)
|
|
54
|
+
def _cached_encode(
|
|
55
|
+
tokenizer: AnyTokenizer,
|
|
56
|
+
text: str,
|
|
57
|
+
*,
|
|
58
|
+
add_special_tokens: Optional[bool] = None,
|
|
59
|
+
) -> list[int]:
|
|
60
|
+
return encode_tokens(tokenizer,
|
|
61
|
+
text,
|
|
62
|
+
add_special_tokens=add_special_tokens)
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
@lru_cache(maxsize=2048)
|
|
66
|
+
def _cached_decode(
|
|
67
|
+
tokenizer: AnyTokenizer,
|
|
68
|
+
token_ids: tuple[int, ...],
|
|
69
|
+
*,
|
|
70
|
+
skip_special_tokens: Optional[bool] = None,
|
|
71
|
+
) -> str:
|
|
72
|
+
return decode_tokens(tokenizer,
|
|
73
|
+
list(token_ids),
|
|
74
|
+
skip_special_tokens=skip_special_tokens)
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
def _seq2text(tokenizer: AnyTokenizer, seq: PromptSeq) -> str:
|
|
78
|
+
if isinstance(seq, str):
|
|
79
|
+
return seq
|
|
80
|
+
|
|
81
|
+
return _cached_decode(tokenizer, tuple(seq))
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
def _seq2tokens(tokenizer: AnyTokenizer, seq: PromptSeq) -> list[int]:
|
|
85
|
+
if isinstance(seq, str):
|
|
86
|
+
return _cached_encode(tokenizer, seq, add_special_tokens=False)
|
|
87
|
+
|
|
88
|
+
return seq
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
class _GetMatchIndex(Protocol):
|
|
92
|
+
|
|
93
|
+
def __call__(
|
|
94
|
+
self,
|
|
95
|
+
tokenizer: AnyTokenizer,
|
|
96
|
+
prompt: PromptSeq,
|
|
97
|
+
start_idx: int = 0,
|
|
98
|
+
) -> Optional[int]:
|
|
99
|
+
...
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
@dataclass
|
|
103
|
+
class PromptIndex:
|
|
104
|
+
"""Resolves to an index in the prompt."""
|
|
105
|
+
get_match_index: _GetMatchIndex
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
class PromptIndexTargets:
|
|
109
|
+
|
|
110
|
+
@staticmethod
|
|
111
|
+
def start() -> PromptIndex:
|
|
112
|
+
"""
|
|
113
|
+
Resolves to the start of the prompt (before the first token).
|
|
114
|
+
|
|
115
|
+
This results in a match even if the prompt is empty.
|
|
116
|
+
"""
|
|
117
|
+
return PromptIndex(lambda tokenizer, prompt, start_idx=0: 0)
|
|
118
|
+
|
|
119
|
+
@staticmethod
|
|
120
|
+
def prefix(seq: PromptSeq) -> PromptIndex:
|
|
121
|
+
"""
|
|
122
|
+
Resolves to a location in the prompt after the given prefix.
|
|
123
|
+
"""
|
|
124
|
+
|
|
125
|
+
def get_match_index(
|
|
126
|
+
tokenizer: AnyTokenizer,
|
|
127
|
+
prompt: PromptSeq,
|
|
128
|
+
start_idx: int = 0,
|
|
129
|
+
) -> Optional[int]:
|
|
130
|
+
if start_idx != 0:
|
|
131
|
+
return None
|
|
132
|
+
|
|
133
|
+
prefix = seq
|
|
134
|
+
|
|
135
|
+
if isinstance(prompt, str):
|
|
136
|
+
if not isinstance(prefix, str):
|
|
137
|
+
# Make both `str`
|
|
138
|
+
prefix = decode_tokens(tokenizer, prefix)
|
|
139
|
+
else:
|
|
140
|
+
if isinstance(prefix, str):
|
|
141
|
+
# Make both `list[int]`
|
|
142
|
+
prefix = encode_tokens(tokenizer,
|
|
143
|
+
prefix,
|
|
144
|
+
add_special_tokens=False)
|
|
145
|
+
|
|
146
|
+
match_idx = len(prefix)
|
|
147
|
+
return match_idx if prompt[:match_idx] == prefix else None
|
|
148
|
+
|
|
149
|
+
return PromptIndex(get_match_index)
|
|
150
|
+
|
|
151
|
+
@staticmethod
|
|
152
|
+
def end() -> PromptIndex:
|
|
153
|
+
"""
|
|
154
|
+
Resolves to the end of the prompt (after the last token).
|
|
155
|
+
|
|
156
|
+
This results in a match even if the prompt is empty.
|
|
157
|
+
"""
|
|
158
|
+
return PromptIndex(lambda tokenizer, prompt, start_idx=0: len(prompt))
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
UpdateTarget = Union[PromptSeq, PromptIndex]
|
|
162
|
+
"""
|
|
163
|
+
The token sequence or text to update.
|
|
164
|
+
"""
|
|
165
|
+
|
|
166
|
+
PromptUpdateTarget = Union[Callable[[int], UpdateTarget], UpdateTarget]
|
|
167
|
+
"""
|
|
168
|
+
Given the index of the processed item within
|
|
169
|
+
[`modality`][vllm.multimodal.processing.PromptUpdate.modality],
|
|
170
|
+
output the corresponding token sequence (or text).
|
|
171
|
+
|
|
172
|
+
For convenience, you can directly pass in the token sequence (or text)
|
|
173
|
+
instead of a function if it does not depend on the input.
|
|
174
|
+
"""
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
@dataclass
|
|
178
|
+
class PromptUpdateDetails(Generic[_S]):
|
|
179
|
+
"""Details about the token sequence or text that are part of the update."""
|
|
180
|
+
|
|
181
|
+
full: _S
|
|
182
|
+
"""The full content."""
|
|
183
|
+
|
|
184
|
+
is_embed: Optional[Callable[[AnyTokenizer, PromptSeq],
|
|
185
|
+
torch.Tensor]] = None
|
|
186
|
+
"""
|
|
187
|
+
Given [`full`][vllm.multimodal.processing.PromptUpdateDetails.full],
|
|
188
|
+
return a boolean mask of shape `(len(full),)` indicating which positions
|
|
189
|
+
of `full` to assign embeddings to.
|
|
190
|
+
|
|
191
|
+
`None` (default) means to assign embeddings to all positions of `full`.
|
|
192
|
+
|
|
193
|
+
The embeddings are obtained by calling
|
|
194
|
+
[`SupportsMultiModal.get_multimodal_embeddings`][vllm.model_executor.models.interfaces.SupportsMultiModal.get_multimodal_embeddings].
|
|
195
|
+
"""
|
|
196
|
+
|
|
197
|
+
@staticmethod
|
|
198
|
+
def from_seq(seq: _S) -> "PromptUpdateDetails[_S]":
|
|
199
|
+
return PromptUpdateDetails(full=seq)
|
|
200
|
+
|
|
201
|
+
@staticmethod
|
|
202
|
+
def select_text(
|
|
203
|
+
seq: _S,
|
|
204
|
+
embed_text: str,
|
|
205
|
+
) -> "PromptUpdateDetails[_S]":
|
|
206
|
+
|
|
207
|
+
def is_embed(tokenizer: AnyTokenizer, full: PromptSeq) -> torch.Tensor:
|
|
208
|
+
embed_token_ids = encode_tokens(tokenizer, embed_text)
|
|
209
|
+
token_ids = _seq2tokens(tokenizer, full)
|
|
210
|
+
|
|
211
|
+
return torch.isin(
|
|
212
|
+
torch.tensor(token_ids),
|
|
213
|
+
torch.tensor(embed_token_ids),
|
|
214
|
+
)
|
|
215
|
+
|
|
216
|
+
return PromptUpdateDetails(full=seq, is_embed=is_embed)
|
|
217
|
+
|
|
218
|
+
@staticmethod
|
|
219
|
+
def select_token_id(
|
|
220
|
+
seq: _S,
|
|
221
|
+
embed_token_id: int,
|
|
222
|
+
) -> "PromptUpdateDetails[_S]":
|
|
223
|
+
|
|
224
|
+
def is_embed(tokenizer: AnyTokenizer, full: PromptSeq) -> torch.Tensor:
|
|
225
|
+
token_ids = _seq2tokens(tokenizer, full)
|
|
226
|
+
|
|
227
|
+
return torch.tensor(token_ids) == embed_token_id
|
|
228
|
+
|
|
229
|
+
return PromptUpdateDetails(full=seq, is_embed=is_embed)
|
|
230
|
+
|
|
231
|
+
|
|
232
|
+
PromptUpdateInfo = Union[PromptSeq, PromptUpdateDetails]
|
|
233
|
+
"""
|
|
234
|
+
The token sequence or text that are part of the update.
|
|
235
|
+
|
|
236
|
+
If only part of the content corresponds to feature placeholders, you can
|
|
237
|
+
use [`PromptUpdateDetails`][vllm.multimodal.processing.PromptUpdateDetails] to
|
|
238
|
+
specify which part.
|
|
239
|
+
"""
|
|
240
|
+
|
|
241
|
+
PromptUpdateContent = Union[Callable[[int], PromptUpdateInfo],
|
|
242
|
+
PromptUpdateInfo]
|
|
243
|
+
"""
|
|
244
|
+
Given the index of the processed item within
|
|
245
|
+
[`modality`][vllm.multimodal.processing.PromptUpdate.modality],
|
|
246
|
+
output the corresponding token sequence (or text).
|
|
247
|
+
|
|
248
|
+
For convenience, you can directly pass in the token sequence (or text)
|
|
249
|
+
instead of a function if it does not depend on the input.
|
|
250
|
+
"""
|
|
251
|
+
|
|
252
|
+
|
|
253
|
+
class UpdateMode(str, Enum):
|
|
254
|
+
INSERT = "insert"
|
|
255
|
+
REPLACE = "replace"
|
|
256
|
+
|
|
257
|
+
|
|
258
|
+
@dataclass
|
|
259
|
+
class PromptUpdate(ABC):
|
|
260
|
+
"""
|
|
261
|
+
Defines how to update a prompt with placeholder tokens.
|
|
262
|
+
"""
|
|
263
|
+
|
|
264
|
+
modality: str
|
|
265
|
+
"""The modality for which the update is made."""
|
|
266
|
+
|
|
267
|
+
target: PromptUpdateTarget
|
|
268
|
+
"""The token sequence (or text) to update."""
|
|
269
|
+
|
|
270
|
+
@property
|
|
271
|
+
@abstractmethod
|
|
272
|
+
def content(self) -> PromptUpdateContent:
|
|
273
|
+
"""The placeholder tokens that are part of the update."""
|
|
274
|
+
raise NotImplementedError
|
|
275
|
+
|
|
276
|
+
@property
|
|
277
|
+
@abstractmethod
|
|
278
|
+
def mode(self) -> UpdateMode:
|
|
279
|
+
"""Defines how to update the prompt."""
|
|
280
|
+
raise NotImplementedError
|
|
281
|
+
|
|
282
|
+
def _resolve_target(self, item_idx: int) -> UpdateTarget:
|
|
283
|
+
target = self.target
|
|
284
|
+
if callable(target):
|
|
285
|
+
target = target(item_idx)
|
|
286
|
+
|
|
287
|
+
return target
|
|
288
|
+
|
|
289
|
+
def _resolve_content(self, item_idx: int) -> PromptUpdateDetails:
|
|
290
|
+
content = self.content
|
|
291
|
+
if callable(content):
|
|
292
|
+
content = content(item_idx)
|
|
293
|
+
|
|
294
|
+
if not isinstance(content, PromptUpdateDetails):
|
|
295
|
+
content = PromptUpdateDetails.from_seq(content)
|
|
296
|
+
|
|
297
|
+
return content
|
|
298
|
+
|
|
299
|
+
def resolve(self, item_idx: int) -> "ResolvedPromptUpdate":
|
|
300
|
+
"""
|
|
301
|
+
Given the index of the processed item within
|
|
302
|
+
[`modality`][vllm.multimodal.processing.PromptUpdate.modality],
|
|
303
|
+
output a copy of this object with its lazy attributes resolved.
|
|
304
|
+
"""
|
|
305
|
+
return ResolvedPromptUpdate(
|
|
306
|
+
modality=self.modality,
|
|
307
|
+
item_idx=item_idx,
|
|
308
|
+
mode=self.mode,
|
|
309
|
+
target=self._resolve_target(item_idx),
|
|
310
|
+
content=self._resolve_content(item_idx),
|
|
311
|
+
)
|
|
312
|
+
|
|
313
|
+
|
|
314
|
+
@dataclass
|
|
315
|
+
class PromptInsertion(PromptUpdate):
|
|
316
|
+
"""
|
|
317
|
+
Defines how to insert placeholder tokens into a prompt.
|
|
318
|
+
|
|
319
|
+
Example:
|
|
320
|
+
|
|
321
|
+
For each image, insert a number of ``<image>`` feature placeholders
|
|
322
|
+
equal to the feature size of the vision encoder after the ``<s>`` token:
|
|
323
|
+
|
|
324
|
+
```python
|
|
325
|
+
PromptInsertion(
|
|
326
|
+
modality="image",
|
|
327
|
+
target="<s>",
|
|
328
|
+
insertion="<image>" * image_feature_size,
|
|
329
|
+
)
|
|
330
|
+
```
|
|
331
|
+
|
|
332
|
+
Insert these tokens at the start of the prompt:
|
|
333
|
+
|
|
334
|
+
```python
|
|
335
|
+
PromptInsertion(
|
|
336
|
+
modality="image",
|
|
337
|
+
target=PromptIndexTargets.start(),
|
|
338
|
+
insertion="<image>" * image_feature_size,
|
|
339
|
+
)
|
|
340
|
+
```
|
|
341
|
+
|
|
342
|
+
Insert these tokens after a prefix ``Images:``:
|
|
343
|
+
|
|
344
|
+
```python
|
|
345
|
+
PromptInsertion(
|
|
346
|
+
modality="image",
|
|
347
|
+
target=PromptIndexTargets.prefix("Images:"),
|
|
348
|
+
insertion="<image>" * image_feature_size,
|
|
349
|
+
)
|
|
350
|
+
```
|
|
351
|
+
|
|
352
|
+
Insert these tokens at the end of the prompt:
|
|
353
|
+
|
|
354
|
+
```python
|
|
355
|
+
PromptInsertion(
|
|
356
|
+
modality="image",
|
|
357
|
+
target=PromptIndexTargets.end(),
|
|
358
|
+
insertion="<image>" * image_feature_size,
|
|
359
|
+
)
|
|
360
|
+
```
|
|
361
|
+
"""
|
|
362
|
+
|
|
363
|
+
insertion: PromptUpdateContent = field(repr=False)
|
|
364
|
+
"""
|
|
365
|
+
Given the index of the processed item within
|
|
366
|
+
[`modality`][vllm.multimodal.processing.PromptUpdate.modality],
|
|
367
|
+
output the token sequence (or text) to insert right after
|
|
368
|
+
[`target`][vllm.multimodal.processing.PromptUpdate.target].
|
|
369
|
+
|
|
370
|
+
For convenience, you can directly pass in the token sequence (or text)
|
|
371
|
+
instead of a function if it does not depend on the input.
|
|
372
|
+
"""
|
|
373
|
+
|
|
374
|
+
@property
|
|
375
|
+
def content(self) -> PromptUpdateContent:
|
|
376
|
+
return self.insertion
|
|
377
|
+
|
|
378
|
+
@property
|
|
379
|
+
def mode(self) -> UpdateMode:
|
|
380
|
+
return UpdateMode.INSERT
|
|
381
|
+
|
|
382
|
+
|
|
383
|
+
@dataclass
|
|
384
|
+
class PromptReplacement(PromptUpdate):
|
|
385
|
+
"""
|
|
386
|
+
Defines how to replace portions of an input prompt with placeholder tokens.
|
|
387
|
+
|
|
388
|
+
Example:
|
|
389
|
+
|
|
390
|
+
For each image, replace one ``<image>`` input placeholder in the prompt
|
|
391
|
+
with a number of ``<image>`` feature placeholders
|
|
392
|
+
equal to the feature size of the vision encoder:
|
|
393
|
+
|
|
394
|
+
```python
|
|
395
|
+
PromptReplacement(
|
|
396
|
+
modality="image",
|
|
397
|
+
target="<image>",
|
|
398
|
+
replacement="<image>" * image_feature_size,
|
|
399
|
+
)
|
|
400
|
+
```
|
|
401
|
+
|
|
402
|
+
As above, but further pad the feature placeholders with ``<image_bos>``
|
|
403
|
+
and `<image_eos>``, which are not supposed to be passed to the vision
|
|
404
|
+
encoder:
|
|
405
|
+
|
|
406
|
+
```python
|
|
407
|
+
PromptReplacement(
|
|
408
|
+
modality="image",
|
|
409
|
+
target="<image>",
|
|
410
|
+
replacement=PromptUpdateDetails(
|
|
411
|
+
full="".join([
|
|
412
|
+
"<image_bos>",
|
|
413
|
+
"<image>" * image_feature_size,
|
|
414
|
+
"<image_eos>",
|
|
415
|
+
]),
|
|
416
|
+
features="<image>" * image_feature_size,
|
|
417
|
+
),
|
|
418
|
+
)
|
|
419
|
+
```
|
|
420
|
+
|
|
421
|
+
To avoid unnecessary tokenization during prompt replacement,
|
|
422
|
+
we recommended passing token sequences instead of text:
|
|
423
|
+
|
|
424
|
+
```python
|
|
425
|
+
PromptReplacement(
|
|
426
|
+
modality="image",
|
|
427
|
+
target=[image_token_id],
|
|
428
|
+
replacement=PromptUpdateDetails(
|
|
429
|
+
full=([image_bos_id] + [image_token_id] * image_feature_size
|
|
430
|
+
+ [image_eos_id]),
|
|
431
|
+
features=[image_token_id] * image_feature_size,
|
|
432
|
+
),
|
|
433
|
+
)
|
|
434
|
+
```
|
|
435
|
+
"""
|
|
436
|
+
|
|
437
|
+
replacement: PromptUpdateContent = field(repr=False)
|
|
438
|
+
"""
|
|
439
|
+
Given the index of the processed item within
|
|
440
|
+
[`modality`][vllm.multimodal.processing.PromptUpdate.modality],
|
|
441
|
+
output the token sequence (or text) to replace
|
|
442
|
+
[`target`][vllm.multimodal.processing.PromptUpdate.target].
|
|
443
|
+
|
|
444
|
+
For convenience, you can directly pass in the token sequence (or text)
|
|
445
|
+
instead of a function if it does not depend on the input.
|
|
446
|
+
"""
|
|
447
|
+
|
|
448
|
+
@property
|
|
449
|
+
def content(self) -> PromptUpdateContent:
|
|
450
|
+
return self.replacement
|
|
451
|
+
|
|
452
|
+
@property
|
|
453
|
+
def mode(self) -> UpdateMode:
|
|
454
|
+
return UpdateMode.REPLACE
|
|
455
|
+
|
|
456
|
+
|
|
457
|
+
class _HasModalityAttr(Protocol):
|
|
458
|
+
modality: str
|
|
459
|
+
|
|
460
|
+
|
|
461
|
+
class _HasModalityProp(Protocol):
|
|
462
|
+
|
|
463
|
+
@property
|
|
464
|
+
def modality(self) -> str:
|
|
465
|
+
...
|
|
466
|
+
|
|
467
|
+
|
|
468
|
+
_M = TypeVar("_M", bound=Union[_HasModalityAttr, _HasModalityProp])
|
|
469
|
+
|
|
470
|
+
|
|
471
|
+
def full_groupby_modality(values: Iterable[_M]) -> ItemsView[str, list[_M]]:
|
|
472
|
+
"""Convenience function to apply [`full_groupby`][vllm.utils.full_groupby]
|
|
473
|
+
based on modality."""
|
|
474
|
+
return full_groupby(values, key=lambda x: x.modality)
|
|
475
|
+
|
|
476
|
+
|
|
477
|
+
class PromptTargetMatch(NamedTuple):
|
|
478
|
+
start_idx: int
|
|
479
|
+
end_idx: int
|
|
480
|
+
|
|
481
|
+
|
|
482
|
+
@dataclass(frozen=True)
|
|
483
|
+
class ResolvedPromptUpdate:
|
|
484
|
+
"""
|
|
485
|
+
A [`PromptUpdate`][vllm.multimodal.processing.PromptUpdate] with its
|
|
486
|
+
lazy attributes resolved, apart from those related to tokenization.
|
|
487
|
+
"""
|
|
488
|
+
|
|
489
|
+
modality: str
|
|
490
|
+
"""The modality for which the update is made."""
|
|
491
|
+
|
|
492
|
+
item_idx: int
|
|
493
|
+
"""The index within `modality` of the item this update pertains to."""
|
|
494
|
+
|
|
495
|
+
mode: UpdateMode
|
|
496
|
+
"""Defines how to update the prompt."""
|
|
497
|
+
|
|
498
|
+
target: UpdateTarget
|
|
499
|
+
"""The token sequence (or text) to update."""
|
|
500
|
+
|
|
501
|
+
content: PromptUpdateDetails = field(repr=False)
|
|
502
|
+
"""The placeholder tokens that are part of the update."""
|
|
503
|
+
|
|
504
|
+
def iter_token_matches(
|
|
505
|
+
self,
|
|
506
|
+
prompt: list[int],
|
|
507
|
+
tokenizer: AnyTokenizer,
|
|
508
|
+
*,
|
|
509
|
+
start_idx: int = 0,
|
|
510
|
+
) -> Generator[PromptTargetMatch]:
|
|
511
|
+
"""Yield each instance of `self.target` found in `prompt`."""
|
|
512
|
+
target = self.target
|
|
513
|
+
|
|
514
|
+
if isinstance(target, PromptIndex):
|
|
515
|
+
match_idx = target.get_match_index(tokenizer, prompt, start_idx)
|
|
516
|
+
if match_idx is not None:
|
|
517
|
+
yield PromptTargetMatch(match_idx, match_idx)
|
|
518
|
+
|
|
519
|
+
return
|
|
520
|
+
|
|
521
|
+
target_token_ids = _seq2tokens(tokenizer, target)
|
|
522
|
+
|
|
523
|
+
for match in iter_token_matches(prompt,
|
|
524
|
+
target_token_ids,
|
|
525
|
+
start_idx=start_idx):
|
|
526
|
+
yield PromptTargetMatch(match.start_idx, match.end_idx)
|
|
527
|
+
|
|
528
|
+
def iter_text_matches(
|
|
529
|
+
self,
|
|
530
|
+
prompt: str,
|
|
531
|
+
tokenizer: AnyTokenizer,
|
|
532
|
+
*,
|
|
533
|
+
start_idx: int = 0,
|
|
534
|
+
) -> Generator[PromptTargetMatch]:
|
|
535
|
+
"""Yield each instance of `self.target` found in `prompt`."""
|
|
536
|
+
target = self.target
|
|
537
|
+
|
|
538
|
+
if isinstance(target, PromptIndex):
|
|
539
|
+
match_idx = target.get_match_index(tokenizer, prompt, start_idx)
|
|
540
|
+
if match_idx is not None:
|
|
541
|
+
yield PromptTargetMatch(match_idx, match_idx)
|
|
542
|
+
|
|
543
|
+
return
|
|
544
|
+
|
|
545
|
+
target_text = _seq2text(tokenizer, target)
|
|
546
|
+
|
|
547
|
+
for match in re.finditer(re.escape(target_text), prompt,
|
|
548
|
+
pos=start_idx):
|
|
549
|
+
yield PromptTargetMatch(match.start(), match.end())
|
|
550
|
+
|
|
551
|
+
def iter_matches(
|
|
552
|
+
self,
|
|
553
|
+
prompt: Union[list[int], str],
|
|
554
|
+
tokenizer: AnyTokenizer,
|
|
555
|
+
*,
|
|
556
|
+
start_idx: int = 0,
|
|
557
|
+
) -> Generator[PromptTargetMatch]:
|
|
558
|
+
"""Yield each instance of `self.target` found in `prompt`."""
|
|
559
|
+
if isinstance(prompt, str):
|
|
560
|
+
return self.iter_text_matches(prompt,
|
|
561
|
+
tokenizer,
|
|
562
|
+
start_idx=start_idx)
|
|
563
|
+
|
|
564
|
+
return self.iter_token_matches(prompt, tokenizer, start_idx=start_idx)
|
|
565
|
+
|
|
566
|
+
def with_target(self, target: UpdateTarget):
|
|
567
|
+
return replace(self, target=target)
|
|
568
|
+
|
|
569
|
+
def with_content(self, content: PromptUpdateInfo):
|
|
570
|
+
if not isinstance(content, PromptUpdateDetails):
|
|
571
|
+
content = PromptUpdateDetails.from_seq(content)
|
|
572
|
+
|
|
573
|
+
return replace(self, content=content)
|
|
574
|
+
|
|
575
|
+
|
|
576
|
+
class _TokenMatch(NamedTuple):
|
|
577
|
+
start_idx: int
|
|
578
|
+
end_idx: int
|
|
579
|
+
|
|
580
|
+
|
|
581
|
+
def iter_token_matches(
|
|
582
|
+
token_ids: list[int],
|
|
583
|
+
match_ids: list[int],
|
|
584
|
+
*,
|
|
585
|
+
start_idx: int = 0,
|
|
586
|
+
) -> Generator[_TokenMatch]:
|
|
587
|
+
"""
|
|
588
|
+
Yield each occurrence of `match_ids` in `token_ids`.
|
|
589
|
+
|
|
590
|
+
Note that empty matches are ignored.
|
|
591
|
+
"""
|
|
592
|
+
prompt_len = len(token_ids)
|
|
593
|
+
match_len = len(match_ids)
|
|
594
|
+
|
|
595
|
+
if match_len == 0:
|
|
596
|
+
return
|
|
597
|
+
|
|
598
|
+
while start_idx < prompt_len - match_len + 1:
|
|
599
|
+
end_idx = start_idx + match_len
|
|
600
|
+
|
|
601
|
+
if token_ids[start_idx:end_idx] == match_ids:
|
|
602
|
+
yield _TokenMatch(start_idx=start_idx, end_idx=end_idx)
|
|
603
|
+
|
|
604
|
+
# Exclude overlapping matches
|
|
605
|
+
start_idx = end_idx
|
|
606
|
+
else:
|
|
607
|
+
start_idx += 1
|
|
608
|
+
|
|
609
|
+
|
|
610
|
+
def replace_token_matches(
|
|
611
|
+
token_ids: list[int],
|
|
612
|
+
match_ids: list[int],
|
|
613
|
+
new_ids: list[int],
|
|
614
|
+
) -> list[int]:
|
|
615
|
+
"""
|
|
616
|
+
Replace each occurrence of `match_ids` in `token_ids`
|
|
617
|
+
with `new_ids`.
|
|
618
|
+
|
|
619
|
+
Note that empty matches are ignored.
|
|
620
|
+
"""
|
|
621
|
+
out_seqs = list[list[int]]()
|
|
622
|
+
prev_end_idx = 0
|
|
623
|
+
|
|
624
|
+
for match in iter_token_matches(token_ids, match_ids):
|
|
625
|
+
start_idx = match.start_idx
|
|
626
|
+
end_idx = match.end_idx
|
|
627
|
+
|
|
628
|
+
out_seqs.append(token_ids[prev_end_idx:start_idx])
|
|
629
|
+
out_seqs.append(new_ids)
|
|
630
|
+
prev_end_idx = end_idx
|
|
631
|
+
|
|
632
|
+
out_seqs.append(token_ids[prev_end_idx:])
|
|
633
|
+
|
|
634
|
+
return flatten_2d_lists(out_seqs)
|
|
635
|
+
|
|
636
|
+
|
|
637
|
+
@dataclass
|
|
638
|
+
class PlaceholderFeaturesInfo:
|
|
639
|
+
modality: str
|
|
640
|
+
item_idx: int
|
|
641
|
+
start_idx: int
|
|
642
|
+
tokens: list[int]
|
|
643
|
+
is_embed: Optional[torch.Tensor]
|
|
644
|
+
|
|
645
|
+
@property
|
|
646
|
+
def length(self) -> int:
|
|
647
|
+
return len(self.tokens)
|
|
648
|
+
|
|
649
|
+
def to_range(self) -> PlaceholderRange:
|
|
650
|
+
# TODO: Is it worth it to optimize this by stripping the
|
|
651
|
+
# leading and ending positions where `is_embed=False`?
|
|
652
|
+
return PlaceholderRange(
|
|
653
|
+
offset=self.start_idx,
|
|
654
|
+
length=self.length,
|
|
655
|
+
is_embed=self.is_embed,
|
|
656
|
+
)
|
|
657
|
+
|
|
658
|
+
|
|
659
|
+
_MatchToApply = tuple[tuple[str, int], tuple[PromptTargetMatch, int]]
|
|
660
|
+
|
|
661
|
+
|
|
662
|
+
def _find_matches(
|
|
663
|
+
prompt: _S,
|
|
664
|
+
mm_prompt_updates: "MultiModalPromptUpdates",
|
|
665
|
+
tokenizer: AnyTokenizer,
|
|
666
|
+
*,
|
|
667
|
+
prev_end_idx: int = 0,
|
|
668
|
+
current_result: "MultiModalPromptUpdatesApplyResult",
|
|
669
|
+
) -> tuple[Optional[UpdateMode], list[_MatchToApply]]:
|
|
670
|
+
mode: Optional[UpdateMode] = None
|
|
671
|
+
mm_matches = dict[tuple[str, int], tuple[PromptTargetMatch, int]]()
|
|
672
|
+
|
|
673
|
+
for modality, modality_updates in mm_prompt_updates.items():
|
|
674
|
+
for item_idx, item_updates in enumerate(modality_updates):
|
|
675
|
+
if current_result[modality][item_idx] is not None:
|
|
676
|
+
continue # Updates have already been applied for this item
|
|
677
|
+
|
|
678
|
+
for update_idx, update in enumerate(item_updates):
|
|
679
|
+
if (modality, item_idx) in mm_matches:
|
|
680
|
+
break # Already found a match for this item
|
|
681
|
+
|
|
682
|
+
for match in update.iter_matches(
|
|
683
|
+
prompt,
|
|
684
|
+
tokenizer,
|
|
685
|
+
start_idx=prev_end_idx,
|
|
686
|
+
):
|
|
687
|
+
# All matches should share the same mode
|
|
688
|
+
if mode is None:
|
|
689
|
+
mode = update.mode
|
|
690
|
+
elif mode != update.mode:
|
|
691
|
+
continue
|
|
692
|
+
|
|
693
|
+
mm_matches[(modality, item_idx)] = match, update_idx
|
|
694
|
+
break # Get only the first valid match per item
|
|
695
|
+
|
|
696
|
+
# Prioritize earlier matches
|
|
697
|
+
matches_to_apply = sorted(mm_matches.items(), key=lambda item: item[1][0])
|
|
698
|
+
|
|
699
|
+
# To avoid conflicts, only replace one non-empty item at a time
|
|
700
|
+
if mode == UpdateMode.REPLACE:
|
|
701
|
+
matches_to_apply_ = list[_MatchToApply]()
|
|
702
|
+
has_non_empty_matches = False
|
|
703
|
+
|
|
704
|
+
for item in matches_to_apply:
|
|
705
|
+
_, (match, _) = item
|
|
706
|
+
if match.start_idx == match.end_idx:
|
|
707
|
+
matches_to_apply_.append(item)
|
|
708
|
+
elif not has_non_empty_matches:
|
|
709
|
+
has_non_empty_matches = True
|
|
710
|
+
matches_to_apply_.append(item)
|
|
711
|
+
|
|
712
|
+
matches_to_apply = matches_to_apply_
|
|
713
|
+
|
|
714
|
+
return mode, matches_to_apply
|
|
715
|
+
|
|
716
|
+
|
|
717
|
+
def _apply_matches(
|
|
718
|
+
prompt: _S,
|
|
719
|
+
mm_prompt_updates: "MultiModalPromptUpdates",
|
|
720
|
+
tokenizer: AnyTokenizer,
|
|
721
|
+
) -> tuple[list[_S], "MultiModalPromptUpdatesApplyResult"]:
|
|
722
|
+
prompt_len = len(prompt)
|
|
723
|
+
|
|
724
|
+
out_seqs = list[Union[str, list[int]]]()
|
|
725
|
+
out_result: MultiModalPromptUpdatesApplyResult = {
|
|
726
|
+
m: [None] * len(items)
|
|
727
|
+
for m, items in mm_prompt_updates.items()
|
|
728
|
+
}
|
|
729
|
+
|
|
730
|
+
start_idx = prev_end_idx = 0
|
|
731
|
+
while start_idx < max(prompt_len, 1): # Allow inserts into empty prompt
|
|
732
|
+
found = False
|
|
733
|
+
|
|
734
|
+
mode, matches_to_apply = _find_matches(
|
|
735
|
+
prompt,
|
|
736
|
+
mm_prompt_updates,
|
|
737
|
+
tokenizer,
|
|
738
|
+
prev_end_idx=prev_end_idx,
|
|
739
|
+
current_result=out_result,
|
|
740
|
+
)
|
|
741
|
+
|
|
742
|
+
if mode is not None:
|
|
743
|
+
for (modality, item_idx), (match, update_idx) in matches_to_apply:
|
|
744
|
+
found = True
|
|
745
|
+
|
|
746
|
+
matched_update = mm_prompt_updates[modality][item_idx][
|
|
747
|
+
update_idx]
|
|
748
|
+
matched_content = matched_update.content.full
|
|
749
|
+
|
|
750
|
+
if mode == UpdateMode.INSERT:
|
|
751
|
+
end_idx_to_insert = match.end_idx
|
|
752
|
+
elif mode == UpdateMode.REPLACE:
|
|
753
|
+
end_idx_to_insert = match.start_idx
|
|
754
|
+
else:
|
|
755
|
+
assert_never(mode)
|
|
756
|
+
|
|
757
|
+
out_seqs.append(prompt[prev_end_idx:end_idx_to_insert])
|
|
758
|
+
out_seqs.append(
|
|
759
|
+
_seq2text(tokenizer, matched_content
|
|
760
|
+
) if isinstance(prompt, str) else _seq2tokens(
|
|
761
|
+
tokenizer, matched_content))
|
|
762
|
+
out_result[modality][item_idx] = update_idx
|
|
763
|
+
|
|
764
|
+
# Exclude overlapping matches
|
|
765
|
+
start_idx = prev_end_idx = match.end_idx
|
|
766
|
+
|
|
767
|
+
if not found:
|
|
768
|
+
start_idx += 1
|
|
769
|
+
|
|
770
|
+
out_seqs.append(prompt[prev_end_idx:])
|
|
771
|
+
|
|
772
|
+
return cast(list[_S], out_seqs), out_result
|
|
773
|
+
|
|
774
|
+
|
|
775
|
+
def apply_token_matches(
|
|
776
|
+
prompt: list[int],
|
|
777
|
+
mm_prompt_updates: "MultiModalPromptUpdates",
|
|
778
|
+
tokenizer: AnyTokenizer,
|
|
779
|
+
) -> tuple[list[int], "MultiModalPromptUpdatesApplyResult"]:
|
|
780
|
+
"""
|
|
781
|
+
Apply the updates in `mm_prompt_updates` to `prompt`.
|
|
782
|
+
|
|
783
|
+
Matches are exclusive even when multiple modalities share
|
|
784
|
+
the same placeholder tokens. In that case, the modality that
|
|
785
|
+
appears earlier in `mm_prompt_updates` takes priority.
|
|
786
|
+
"""
|
|
787
|
+
token_id_seqs, result = _apply_matches(prompt, mm_prompt_updates,
|
|
788
|
+
tokenizer)
|
|
789
|
+
|
|
790
|
+
return flatten_2d_lists(token_id_seqs), result
|
|
791
|
+
|
|
792
|
+
|
|
793
|
+
def apply_text_matches(
|
|
794
|
+
prompt: str,
|
|
795
|
+
mm_prompt_updates: "MultiModalPromptUpdates",
|
|
796
|
+
tokenizer: AnyTokenizer,
|
|
797
|
+
) -> tuple[str, "MultiModalPromptUpdatesApplyResult"]:
|
|
798
|
+
"""
|
|
799
|
+
Apply the updates in `mm_prompt_updates` to `prompt`.
|
|
800
|
+
|
|
801
|
+
Matches are exclusive even when multiple modalities share
|
|
802
|
+
the same placeholder tokens. In that case, the modality that
|
|
803
|
+
appears earlier in `mm_prompt_updates` takes priority.
|
|
804
|
+
"""
|
|
805
|
+
texts, result = _apply_matches(prompt, mm_prompt_updates, tokenizer)
|
|
806
|
+
|
|
807
|
+
return "".join(texts), result
|
|
808
|
+
|
|
809
|
+
|
|
810
|
+
def _iter_placeholders(
|
|
811
|
+
prompt: list[int],
|
|
812
|
+
mm_prompt_updates: "MultiModalPromptUpdates",
|
|
813
|
+
tokenizer: AnyTokenizer,
|
|
814
|
+
) -> Iterable[PlaceholderFeaturesInfo]:
|
|
815
|
+
"""
|
|
816
|
+
Yield each set of placeholder tokens found in `prompt`.
|
|
817
|
+
|
|
818
|
+
Matches are exclusive even when multiple modalities share
|
|
819
|
+
the same placeholder tokens. In that case, the modality that
|
|
820
|
+
appears earlier in `mm_prompt_updates` takes priority.
|
|
821
|
+
|
|
822
|
+
Note that empty matches are ignored.
|
|
823
|
+
"""
|
|
824
|
+
prompt_len = len(prompt)
|
|
825
|
+
mm_item_counts = {m: len(items) for m, items in mm_prompt_updates.items()}
|
|
826
|
+
|
|
827
|
+
item_idx_by_modality = defaultdict[str, int](lambda: 0)
|
|
828
|
+
|
|
829
|
+
start_idx = 0
|
|
830
|
+
while start_idx < prompt_len:
|
|
831
|
+
found = False
|
|
832
|
+
|
|
833
|
+
for modality, modality_updates in mm_prompt_updates.items():
|
|
834
|
+
item_idx = item_idx_by_modality[modality]
|
|
835
|
+
if item_idx >= mm_item_counts.get(modality, 0):
|
|
836
|
+
continue
|
|
837
|
+
|
|
838
|
+
for update in modality_updates[item_idx]:
|
|
839
|
+
content = update.content
|
|
840
|
+
content_tokens_full = _seq2tokens(tokenizer, content.full)
|
|
841
|
+
content_len_full = len(content_tokens_full)
|
|
842
|
+
end_idx_full = start_idx + content_len_full
|
|
843
|
+
|
|
844
|
+
if content_len_full == 0 or end_idx_full > prompt_len:
|
|
845
|
+
continue
|
|
846
|
+
|
|
847
|
+
if prompt[start_idx:end_idx_full] == content_tokens_full:
|
|
848
|
+
content_is_embed = content.is_embed
|
|
849
|
+
if content_is_embed is not None:
|
|
850
|
+
content_is_embed = content_is_embed(
|
|
851
|
+
tokenizer, content.full)
|
|
852
|
+
|
|
853
|
+
yield PlaceholderFeaturesInfo(
|
|
854
|
+
modality=modality,
|
|
855
|
+
item_idx=item_idx,
|
|
856
|
+
start_idx=start_idx,
|
|
857
|
+
tokens=content_tokens_full,
|
|
858
|
+
is_embed=content_is_embed,
|
|
859
|
+
)
|
|
860
|
+
|
|
861
|
+
# Exclude overlapping matches
|
|
862
|
+
start_idx = end_idx_full
|
|
863
|
+
item_idx_by_modality[modality] += 1
|
|
864
|
+
found = True
|
|
865
|
+
break
|
|
866
|
+
|
|
867
|
+
if found:
|
|
868
|
+
break # Go back to the outer while loop
|
|
869
|
+
|
|
870
|
+
if not found:
|
|
871
|
+
start_idx += 1
|
|
872
|
+
|
|
873
|
+
|
|
874
|
+
def find_mm_placeholders(
|
|
875
|
+
prompt: list[int],
|
|
876
|
+
mm_prompt_updates: "MultiModalPromptUpdates",
|
|
877
|
+
tokenizer: AnyTokenizer,
|
|
878
|
+
) -> Mapping[str, list[PlaceholderFeaturesInfo]]:
|
|
879
|
+
it = _iter_placeholders(prompt, mm_prompt_updates, tokenizer)
|
|
880
|
+
return dict(full_groupby_modality(it))
|
|
881
|
+
|
|
882
|
+
|
|
883
|
+
_T = TypeVar("_T")
|
|
884
|
+
_C = TypeVar("_C", bound="PretrainedConfig", default="PretrainedConfig")
|
|
885
|
+
_P = TypeVar("_P", bound="ProcessorMixin", default="ProcessorMixin")
|
|
886
|
+
|
|
887
|
+
|
|
888
|
+
@dataclass(frozen=True)
|
|
889
|
+
class InputProcessingContext:
|
|
890
|
+
"""
|
|
891
|
+
Contains information about the model which may be used to
|
|
892
|
+
modify the inputs.
|
|
893
|
+
"""
|
|
894
|
+
|
|
895
|
+
model_config: "ModelConfig"
|
|
896
|
+
"""The configuration of the model."""
|
|
897
|
+
|
|
898
|
+
tokenizer: AnyTokenizer
|
|
899
|
+
"""The tokenizer used to tokenize the inputs."""
|
|
900
|
+
|
|
901
|
+
@overload
|
|
902
|
+
def get_hf_config(self, /) -> "PretrainedConfig":
|
|
903
|
+
...
|
|
904
|
+
|
|
905
|
+
@overload
|
|
906
|
+
def get_hf_config(
|
|
907
|
+
self,
|
|
908
|
+
typ: Union[type[_C], tuple[type[_C], ...]],
|
|
909
|
+
/,
|
|
910
|
+
) -> _C:
|
|
911
|
+
...
|
|
912
|
+
|
|
913
|
+
def get_hf_config(
|
|
914
|
+
self,
|
|
915
|
+
typ: Optional[Union[type[Any], tuple[type[Any], ...]]] = None,
|
|
916
|
+
/,
|
|
917
|
+
) -> Any:
|
|
918
|
+
"""
|
|
919
|
+
Get the HuggingFace configuration
|
|
920
|
+
(`transformers.PretrainedConfig`) of the model,
|
|
921
|
+
additionally checking its type.
|
|
922
|
+
|
|
923
|
+
Raises:
|
|
924
|
+
TypeError: If the configuration is not of the specified type.
|
|
925
|
+
"""
|
|
926
|
+
if typ is None:
|
|
927
|
+
from transformers.configuration_utils import PretrainedConfig
|
|
928
|
+
|
|
929
|
+
typ = PretrainedConfig
|
|
930
|
+
|
|
931
|
+
hf_config = self.model_config.hf_config
|
|
932
|
+
if not isinstance(hf_config, typ):
|
|
933
|
+
raise TypeError("Invalid type of HuggingFace config. "
|
|
934
|
+
f"Expected type: {typ}, but "
|
|
935
|
+
f"found type: {type(hf_config)}")
|
|
936
|
+
|
|
937
|
+
return hf_config
|
|
938
|
+
|
|
939
|
+
def get_hf_image_processor_config(self) -> dict[str, Any]:
|
|
940
|
+
"""
|
|
941
|
+
Get the HuggingFace image processor configuration of the model.
|
|
942
|
+
"""
|
|
943
|
+
return self.model_config.hf_image_processor_config
|
|
944
|
+
|
|
945
|
+
def get_mm_config(self):
|
|
946
|
+
"""
|
|
947
|
+
Get the multimodal config of the model.
|
|
948
|
+
|
|
949
|
+
Raises:
|
|
950
|
+
RuntimeError: If the model is not a multimodal model.
|
|
951
|
+
"""
|
|
952
|
+
mm_config = self.model_config.multimodal_config
|
|
953
|
+
if mm_config is None:
|
|
954
|
+
raise RuntimeError("Not a multimodal model")
|
|
955
|
+
|
|
956
|
+
return mm_config
|
|
957
|
+
|
|
958
|
+
@overload
|
|
959
|
+
def get_hf_processor(self, /, **kwargs: object) -> "ProcessorMixin":
|
|
960
|
+
...
|
|
961
|
+
|
|
962
|
+
@overload
|
|
963
|
+
def get_hf_processor(
|
|
964
|
+
self,
|
|
965
|
+
typ: Union[type[_P], tuple[type[_P], ...]],
|
|
966
|
+
/,
|
|
967
|
+
**kwargs: object,
|
|
968
|
+
) -> _P:
|
|
969
|
+
...
|
|
970
|
+
|
|
971
|
+
def get_hf_processor(
|
|
972
|
+
self,
|
|
973
|
+
typ: Optional[Union[type[Any], tuple[type[Any], ...]]] = None,
|
|
974
|
+
/,
|
|
975
|
+
**kwargs: object,
|
|
976
|
+
) -> Any:
|
|
977
|
+
"""
|
|
978
|
+
Get the HuggingFace processor
|
|
979
|
+
(`transformers.ProcessorMixin`) of the model,
|
|
980
|
+
additionally checking its type.
|
|
981
|
+
|
|
982
|
+
Raises:
|
|
983
|
+
TypeError: If the processor is not of the specified type.
|
|
984
|
+
"""
|
|
985
|
+
if typ is None:
|
|
986
|
+
from transformers.processing_utils import ProcessorMixin
|
|
987
|
+
|
|
988
|
+
typ = ProcessorMixin
|
|
989
|
+
|
|
990
|
+
return cached_processor_from_config(
|
|
991
|
+
self.model_config,
|
|
992
|
+
processor_cls=typ,
|
|
993
|
+
tokenizer=self.tokenizer,
|
|
994
|
+
**kwargs,
|
|
995
|
+
)
|
|
996
|
+
|
|
997
|
+
def init_processor(
|
|
998
|
+
self,
|
|
999
|
+
typ: type[_T],
|
|
1000
|
+
/,
|
|
1001
|
+
**kwargs: object,
|
|
1002
|
+
) -> _T:
|
|
1003
|
+
"""
|
|
1004
|
+
Initialize a HuggingFace-like processor class, merging the
|
|
1005
|
+
keyword arguments with those in the model's configuration.
|
|
1006
|
+
"""
|
|
1007
|
+
mm_config = self.model_config.get_multimodal_config()
|
|
1008
|
+
base_kwargs = mm_config.mm_processor_kwargs
|
|
1009
|
+
if base_kwargs is None:
|
|
1010
|
+
base_kwargs = {}
|
|
1011
|
+
|
|
1012
|
+
merged_kwargs = {**base_kwargs, **kwargs}
|
|
1013
|
+
|
|
1014
|
+
return typ(**merged_kwargs)
|
|
1015
|
+
|
|
1016
|
+
def _postprocess_output(
|
|
1017
|
+
self,
|
|
1018
|
+
output: JSONTree,
|
|
1019
|
+
) -> JSONTree:
|
|
1020
|
+
|
|
1021
|
+
def _postprocess_one(x: object):
|
|
1022
|
+
if isinstance(x, torch.Tensor): # noqa: SIM102
|
|
1023
|
+
# This mimics the behavior of transformers.BatchFeature
|
|
1024
|
+
if x.is_floating_point():
|
|
1025
|
+
x = x.to(dtype=self.model_config.dtype)
|
|
1026
|
+
|
|
1027
|
+
return x
|
|
1028
|
+
|
|
1029
|
+
return json_map_leaves(_postprocess_one, output)
|
|
1030
|
+
|
|
1031
|
+
def call_hf_processor(
|
|
1032
|
+
self,
|
|
1033
|
+
hf_processor: "ProcessorMixin",
|
|
1034
|
+
data: Mapping[str, object],
|
|
1035
|
+
kwargs: Mapping[str, object] = {},
|
|
1036
|
+
*,
|
|
1037
|
+
num_tries: int = 1,
|
|
1038
|
+
max_tries: int = 5,
|
|
1039
|
+
) -> Union["BatchFeature", JSONTree]:
|
|
1040
|
+
"""
|
|
1041
|
+
Call `hf_processor` on the prompt `data`
|
|
1042
|
+
(text, image, audio...) with configurable options `kwargs`.
|
|
1043
|
+
"""
|
|
1044
|
+
assert callable(hf_processor)
|
|
1045
|
+
|
|
1046
|
+
mm_config = self.model_config.get_multimodal_config()
|
|
1047
|
+
merged_kwargs = mm_config.merge_mm_processor_kwargs(kwargs)
|
|
1048
|
+
|
|
1049
|
+
allowed_kwargs = get_allowed_kwarg_only_overrides(
|
|
1050
|
+
hf_processor,
|
|
1051
|
+
merged_kwargs,
|
|
1052
|
+
requires_kw_only=False,
|
|
1053
|
+
allow_var_kwargs=True,
|
|
1054
|
+
)
|
|
1055
|
+
|
|
1056
|
+
try:
|
|
1057
|
+
output = hf_processor(**data,
|
|
1058
|
+
**allowed_kwargs,
|
|
1059
|
+
return_tensors="pt")
|
|
1060
|
+
except Exception as exc:
|
|
1061
|
+
# See https://github.com/huggingface/tokenizers/issues/537
|
|
1062
|
+
if (isinstance(exc, RuntimeError) and exc
|
|
1063
|
+
and exc.args[0] == "Already borrowed"
|
|
1064
|
+
and num_tries < max_tries):
|
|
1065
|
+
logger.warning(
|
|
1066
|
+
"Failed to acquire tokenizer in current thread. "
|
|
1067
|
+
"Retrying (%d/%d)...", num_tries, max_tries)
|
|
1068
|
+
time.sleep(0.5)
|
|
1069
|
+
return self.call_hf_processor(
|
|
1070
|
+
hf_processor,
|
|
1071
|
+
data,
|
|
1072
|
+
kwargs,
|
|
1073
|
+
num_tries=num_tries + 1,
|
|
1074
|
+
max_tries=max_tries,
|
|
1075
|
+
)
|
|
1076
|
+
|
|
1077
|
+
msg = (f"Failed to apply {type(hf_processor).__name__} "
|
|
1078
|
+
f"on data={data} with kwargs={allowed_kwargs}")
|
|
1079
|
+
|
|
1080
|
+
raise ValueError(msg) from exc
|
|
1081
|
+
|
|
1082
|
+
# this emulates output.to(dtype=self.model_config.dtype)
|
|
1083
|
+
from transformers.feature_extraction_utils import BatchFeature
|
|
1084
|
+
|
|
1085
|
+
if isinstance(output, BatchFeature):
|
|
1086
|
+
output_ = self._postprocess_output(output.data)
|
|
1087
|
+
return BatchFeature(output_)
|
|
1088
|
+
|
|
1089
|
+
logger.warning_once(
|
|
1090
|
+
"%s did not return `BatchFeature`. "
|
|
1091
|
+
"Make sure to match the behaviour of `ProcessorMixin` when "
|
|
1092
|
+
"implementing custom processors.",
|
|
1093
|
+
type(hf_processor).__name__,
|
|
1094
|
+
)
|
|
1095
|
+
|
|
1096
|
+
return self._postprocess_output(output)
|
|
1097
|
+
|
|
1098
|
+
|
|
1099
|
+
class BaseProcessingInfo:
|
|
1100
|
+
"""Base class to provide the information necessary for data processing."""
|
|
1101
|
+
|
|
1102
|
+
def __init__(self, ctx: InputProcessingContext) -> None:
|
|
1103
|
+
super().__init__()
|
|
1104
|
+
|
|
1105
|
+
self.ctx = ctx
|
|
1106
|
+
|
|
1107
|
+
@property
|
|
1108
|
+
def model_id(self) -> str:
|
|
1109
|
+
return self.ctx.model_config.model
|
|
1110
|
+
|
|
1111
|
+
def get_tokenizer(self) -> AnyTokenizer:
|
|
1112
|
+
return self.ctx.tokenizer
|
|
1113
|
+
|
|
1114
|
+
def get_hf_config(self) -> "PretrainedConfig":
|
|
1115
|
+
return self.ctx.get_hf_config()
|
|
1116
|
+
|
|
1117
|
+
def get_hf_processor(self, **kwargs: object) -> "ProcessorMixin":
|
|
1118
|
+
"""
|
|
1119
|
+
Subclasses can override this method to handle
|
|
1120
|
+
specific kwargs from model config or user inputs.
|
|
1121
|
+
"""
|
|
1122
|
+
return self.ctx.get_hf_processor(**kwargs)
|
|
1123
|
+
|
|
1124
|
+
@abstractmethod
|
|
1125
|
+
def get_supported_mm_limits(self) -> Mapping[str, Optional[int]]:
|
|
1126
|
+
"""
|
|
1127
|
+
Return the maximum supported number of items for each modality.
|
|
1128
|
+
|
|
1129
|
+
A value of `None` means unlimited number of items.
|
|
1130
|
+
|
|
1131
|
+
Omitting a modality from the returned dictionary means that
|
|
1132
|
+
it is not supported at all.
|
|
1133
|
+
"""
|
|
1134
|
+
raise NotImplementedError
|
|
1135
|
+
|
|
1136
|
+
def get_allowed_mm_limits(self) -> Mapping[str, int]:
|
|
1137
|
+
"""Return the maximum allowed number of items for each modality."""
|
|
1138
|
+
supported_mm_limits = self.get_supported_mm_limits()
|
|
1139
|
+
mm_config = self.ctx.get_mm_config()
|
|
1140
|
+
|
|
1141
|
+
allowed_limits = dict[str, int]()
|
|
1142
|
+
for modality, supported_limit in supported_mm_limits.items():
|
|
1143
|
+
user_limit = mm_config.get_limit_per_prompt(modality)
|
|
1144
|
+
|
|
1145
|
+
allowed_limits[modality] = (user_limit if supported_limit is None
|
|
1146
|
+
else min(user_limit, supported_limit))
|
|
1147
|
+
|
|
1148
|
+
return allowed_limits
|
|
1149
|
+
|
|
1150
|
+
def get_mm_max_tokens_per_item(
|
|
1151
|
+
self,
|
|
1152
|
+
seq_len: int,
|
|
1153
|
+
mm_counts: Mapping[str, int],
|
|
1154
|
+
) -> Optional[Mapping[str, int]]:
|
|
1155
|
+
"""
|
|
1156
|
+
Return the maximum number of tokens per item of for each modality.
|
|
1157
|
+
|
|
1158
|
+
When `None` (the default) is returned, vLLM will generate dummy inputs
|
|
1159
|
+
(images/videos) at maximum possible sizes and process them to determine
|
|
1160
|
+
the maximum token count per modality.
|
|
1161
|
+
|
|
1162
|
+
This approach works but can be very slow for certain models (e.g.,
|
|
1163
|
+
Qwen2.5-VL), leading to very long startup time. For better performance,
|
|
1164
|
+
each model can override this method to return pre-computed maximum token
|
|
1165
|
+
counts, avoiding the need for dummy input generation and processing.
|
|
1166
|
+
|
|
1167
|
+
Note:
|
|
1168
|
+
The maximum number of tokens per item of each modality returned
|
|
1169
|
+
from this function should respect the model's maximum sequence
|
|
1170
|
+
length and the maximum number of items of each modality allowed,
|
|
1171
|
+
and agree with dummy inputs (images/videos) at maximum possible
|
|
1172
|
+
sizes.
|
|
1173
|
+
"""
|
|
1174
|
+
return None
|
|
1175
|
+
|
|
1176
|
+
|
|
1177
|
+
_I = TypeVar("_I", bound=BaseProcessingInfo)
|
|
1178
|
+
|
|
1179
|
+
MultiModalHashes = dict[str, list[str]]
|
|
1180
|
+
"""
|
|
1181
|
+
A collection of hashes with a similar structure as
|
|
1182
|
+
[`MultiModalKwargsItems`][vllm.multimodal.inputs.MultiModalKwargsItems].
|
|
1183
|
+
"""
|
|
1184
|
+
|
|
1185
|
+
MultiModalPromptUpdates = Mapping[str, list[Sequence[ResolvedPromptUpdate]]]
|
|
1186
|
+
"""
|
|
1187
|
+
A collection of prompt updates with a similar structure as
|
|
1188
|
+
[`MultiModalKwargsItems`][vllm.multimodal.inputs.MultiModalKwargsItems].
|
|
1189
|
+
"""
|
|
1190
|
+
|
|
1191
|
+
MultiModalPromptUpdatesApplyResult = Mapping[str, list[Optional[int]]]
|
|
1192
|
+
"""
|
|
1193
|
+
For an item `MultiModalPromptUpdates[k][i]`,
|
|
1194
|
+
`MultiModalPromptUpdatesApplyResult[k][i]` represents the index of the
|
|
1195
|
+
`ResolvedPromptUpdate` instance that has been applied, or `None` if none of the
|
|
1196
|
+
`ResolvedPromptUpdate` instances have been applied.
|
|
1197
|
+
"""
|
|
1198
|
+
|
|
1199
|
+
|
|
1200
|
+
class MultiModalProcessingInfo(NamedTuple):
|
|
1201
|
+
kwargs: MultiModalKwargsOptionalItems
|
|
1202
|
+
hashes: MultiModalHashes
|
|
1203
|
+
prompt_updates: MultiModalPromptUpdates
|
|
1204
|
+
|
|
1205
|
+
|
|
1206
|
+
class BaseMultiModalProcessor(ABC, Generic[_I]):
|
|
1207
|
+
"""
|
|
1208
|
+
Abstract base class to process multi-modal inputs to be used in vLLM.
|
|
1209
|
+
|
|
1210
|
+
Not to be confused with `transformers.ProcessorMixin`.
|
|
1211
|
+
"""
|
|
1212
|
+
|
|
1213
|
+
def __init__(
|
|
1214
|
+
self,
|
|
1215
|
+
info: _I,
|
|
1216
|
+
dummy_inputs: "BaseDummyInputsBuilder[_I]",
|
|
1217
|
+
*,
|
|
1218
|
+
cache: Optional["BaseMultiModalProcessorCache"] = None,
|
|
1219
|
+
) -> None:
|
|
1220
|
+
super().__init__()
|
|
1221
|
+
|
|
1222
|
+
self.info = info
|
|
1223
|
+
self.dummy_inputs = dummy_inputs
|
|
1224
|
+
self.cache = cache
|
|
1225
|
+
|
|
1226
|
+
self.data_parser = self._get_data_parser()
|
|
1227
|
+
|
|
1228
|
+
# Avoid unnecessary recomputation
|
|
1229
|
+
self._supported_mm_limits = self.info.get_supported_mm_limits()
|
|
1230
|
+
self._allowed_mm_limits = self.info.get_allowed_mm_limits()
|
|
1231
|
+
|
|
1232
|
+
@property
|
|
1233
|
+
def supported_mm_limits(self):
|
|
1234
|
+
return self._supported_mm_limits
|
|
1235
|
+
|
|
1236
|
+
@property
|
|
1237
|
+
def allowed_mm_limits(self):
|
|
1238
|
+
return self._allowed_mm_limits
|
|
1239
|
+
|
|
1240
|
+
def __call__(
|
|
1241
|
+
self,
|
|
1242
|
+
prompt: str,
|
|
1243
|
+
mm_data: MultiModalDataDict,
|
|
1244
|
+
hf_processor_mm_kwargs: Mapping[str, object],
|
|
1245
|
+
*,
|
|
1246
|
+
mm_uuids: Optional[MultiModalUUIDDict] = None,
|
|
1247
|
+
) -> MultiModalInputs:
|
|
1248
|
+
return self.apply(prompt,
|
|
1249
|
+
mm_data,
|
|
1250
|
+
hf_processor_mm_kwargs,
|
|
1251
|
+
mm_uuids=mm_uuids)
|
|
1252
|
+
|
|
1253
|
+
def _get_data_parser(self) -> MultiModalDataParser:
|
|
1254
|
+
"""
|
|
1255
|
+
Construct a parser to preprocess multi-modal data items
|
|
1256
|
+
before passing them to
|
|
1257
|
+
[`_get_hf_mm_data`][vllm.multimodal.processing.BaseMultiModalProcessor._get_hf_mm_data].
|
|
1258
|
+
|
|
1259
|
+
You can support additional modalities by creating a subclass
|
|
1260
|
+
of [`MultiModalDataParser`][vllm.multimodal.parse.MultiModalDataParser]
|
|
1261
|
+
that has additional subparsers.
|
|
1262
|
+
"""
|
|
1263
|
+
return MultiModalDataParser()
|
|
1264
|
+
|
|
1265
|
+
def validate_num_items(
|
|
1266
|
+
self,
|
|
1267
|
+
modality: str,
|
|
1268
|
+
num_items: int,
|
|
1269
|
+
) -> None:
|
|
1270
|
+
supported_limit = self.supported_mm_limits.get(modality, 0)
|
|
1271
|
+
allowed_limit = self.allowed_mm_limits.get(modality, 0)
|
|
1272
|
+
|
|
1273
|
+
if supported_limit is None:
|
|
1274
|
+
supported_limit = allowed_limit
|
|
1275
|
+
|
|
1276
|
+
limit = min(supported_limit, allowed_limit)
|
|
1277
|
+
|
|
1278
|
+
if num_items > limit:
|
|
1279
|
+
msg = (f"At most {limit} {modality}(s) may be provided in "
|
|
1280
|
+
"one prompt.")
|
|
1281
|
+
|
|
1282
|
+
if num_items <= supported_limit:
|
|
1283
|
+
msg += " Set `--limit-mm-per-prompt` to increase this limit."
|
|
1284
|
+
|
|
1285
|
+
raise ValueError(msg)
|
|
1286
|
+
|
|
1287
|
+
def _to_mm_items(
|
|
1288
|
+
self,
|
|
1289
|
+
mm_data: MultiModalDataDict,
|
|
1290
|
+
) -> MultiModalDataItems:
|
|
1291
|
+
"""
|
|
1292
|
+
Normalize
|
|
1293
|
+
[`MultiModalDataDict`][vllm.multimodal.inputs.MultiModalDataDict]
|
|
1294
|
+
to [`MultiModalDataItems`][vllm.multimodal.parse.MultiModalDataItems]
|
|
1295
|
+
before passing them to
|
|
1296
|
+
[`_get_hf_mm_data`][vllm.multimodal.processing.BaseMultiModalProcessor._get_hf_mm_data].
|
|
1297
|
+
"""
|
|
1298
|
+
mm_items = self.data_parser.parse_mm_data(mm_data)
|
|
1299
|
+
for modality, items in mm_items.items():
|
|
1300
|
+
self.validate_num_items(modality, len(items))
|
|
1301
|
+
|
|
1302
|
+
return mm_items
|
|
1303
|
+
|
|
1304
|
+
@abstractmethod
|
|
1305
|
+
def _get_mm_fields_config(
|
|
1306
|
+
self,
|
|
1307
|
+
hf_inputs: "BatchFeature",
|
|
1308
|
+
hf_processor_mm_kwargs: Mapping[str, object],
|
|
1309
|
+
) -> Mapping[str, MultiModalFieldConfig]:
|
|
1310
|
+
"""Given the HF-processed data, output the metadata of each field."""
|
|
1311
|
+
raise NotImplementedError
|
|
1312
|
+
|
|
1313
|
+
@abstractmethod
|
|
1314
|
+
def _get_prompt_updates(
|
|
1315
|
+
self,
|
|
1316
|
+
mm_items: MultiModalDataItems,
|
|
1317
|
+
hf_processor_mm_kwargs: Mapping[str, object],
|
|
1318
|
+
out_mm_kwargs: MultiModalKwargsItems,
|
|
1319
|
+
) -> Sequence[PromptUpdate]:
|
|
1320
|
+
"""
|
|
1321
|
+
Given the original multi-modal items for this modality
|
|
1322
|
+
and HF-processed data, output the updates to perform.
|
|
1323
|
+
|
|
1324
|
+
The information returned by this method is used to update token inputs
|
|
1325
|
+
which bypass the HF processor. It is also used to update the output of
|
|
1326
|
+
HF processor if the HF process does not apply prompt updates to text
|
|
1327
|
+
inputs.
|
|
1328
|
+
|
|
1329
|
+
Moreover, this information is critical to determine the token positions
|
|
1330
|
+
in order to construct
|
|
1331
|
+
[`PlaceholderRange`][vllm.multimodal.inputs.PlaceholderRange]
|
|
1332
|
+
for each multi-modal item.
|
|
1333
|
+
"""
|
|
1334
|
+
raise NotImplementedError
|
|
1335
|
+
|
|
1336
|
+
def _bind_and_group_updates(
|
|
1337
|
+
self,
|
|
1338
|
+
prompt_updates: Sequence[PromptUpdate],
|
|
1339
|
+
mm_item_counts: Mapping[str, int],
|
|
1340
|
+
) -> MultiModalPromptUpdates:
|
|
1341
|
+
return {
|
|
1342
|
+
modality: [[update.resolve(item_idx) for update in updates]
|
|
1343
|
+
for item_idx in range(mm_item_counts.get(modality, 0))]
|
|
1344
|
+
for modality, updates in full_groupby_modality(prompt_updates)
|
|
1345
|
+
}
|
|
1346
|
+
|
|
1347
|
+
def _get_mm_prompt_updates(
|
|
1348
|
+
self,
|
|
1349
|
+
mm_items: MultiModalDataItems,
|
|
1350
|
+
hf_processor_mm_kwargs: Mapping[str, object],
|
|
1351
|
+
out_mm_kwargs: MultiModalKwargsItems,
|
|
1352
|
+
) -> MultiModalPromptUpdates:
|
|
1353
|
+
unbound_prompt_updates = self._get_prompt_updates(
|
|
1354
|
+
mm_items=mm_items,
|
|
1355
|
+
hf_processor_mm_kwargs=hf_processor_mm_kwargs,
|
|
1356
|
+
out_mm_kwargs=out_mm_kwargs,
|
|
1357
|
+
)
|
|
1358
|
+
|
|
1359
|
+
mm_prompt_updates = self._bind_and_group_updates(
|
|
1360
|
+
unbound_prompt_updates,
|
|
1361
|
+
mm_items.get_all_counts(),
|
|
1362
|
+
)
|
|
1363
|
+
|
|
1364
|
+
for modality, prompt_updates in mm_prompt_updates.items():
|
|
1365
|
+
for item_idx, item_prompt_updates in enumerate(prompt_updates):
|
|
1366
|
+
if len(item_prompt_updates) > 1:
|
|
1367
|
+
logger.warning_once(
|
|
1368
|
+
"Detected %d prompt updates for `mm_items[%r][%s]`. "
|
|
1369
|
+
"Multiple prompt updates per item is now "
|
|
1370
|
+
"deprecated and may be removed in v0.13. "
|
|
1371
|
+
"Instead, please specify dynamic update targets "
|
|
1372
|
+
"in the same prompt update definition by passing "
|
|
1373
|
+
"a function to `PromptUpdate.target`.",
|
|
1374
|
+
len(prompt_updates),
|
|
1375
|
+
modality,
|
|
1376
|
+
item_idx,
|
|
1377
|
+
)
|
|
1378
|
+
|
|
1379
|
+
return mm_prompt_updates
|
|
1380
|
+
|
|
1381
|
+
def _find_mm_placeholders(
|
|
1382
|
+
self,
|
|
1383
|
+
new_token_ids: list[int],
|
|
1384
|
+
mm_prompt_updates: MultiModalPromptUpdates,
|
|
1385
|
+
) -> Mapping[str, list[PlaceholderFeaturesInfo]]:
|
|
1386
|
+
tokenizer = self.info.get_tokenizer()
|
|
1387
|
+
|
|
1388
|
+
return find_mm_placeholders(new_token_ids, mm_prompt_updates,
|
|
1389
|
+
tokenizer)
|
|
1390
|
+
|
|
1391
|
+
def _get_hf_mm_data(
|
|
1392
|
+
self,
|
|
1393
|
+
mm_items: MultiModalDataItems,
|
|
1394
|
+
) -> tuple[Mapping[str, object], Mapping[str, object]]:
|
|
1395
|
+
processor_data = dict[str, object]()
|
|
1396
|
+
passthrough_data = dict[str, object]()
|
|
1397
|
+
|
|
1398
|
+
for items in mm_items.values():
|
|
1399
|
+
processor_data.update(items.get_processor_data())
|
|
1400
|
+
passthrough_data.update(items.get_passthrough_data())
|
|
1401
|
+
|
|
1402
|
+
return processor_data, passthrough_data
|
|
1403
|
+
|
|
1404
|
+
def _call_hf_processor(
|
|
1405
|
+
self,
|
|
1406
|
+
prompt: str,
|
|
1407
|
+
# Not to be confused with `mm_data` in `self.apply`.
|
|
1408
|
+
# This refers to the data to be passed to HF processor.
|
|
1409
|
+
mm_data: Mapping[str, object],
|
|
1410
|
+
mm_kwargs: Mapping[str, object],
|
|
1411
|
+
tok_kwargs: Mapping[str, object],
|
|
1412
|
+
) -> "BatchFeature":
|
|
1413
|
+
"""
|
|
1414
|
+
Call the HF processor on the prompt text and
|
|
1415
|
+
associated multi-modal data.
|
|
1416
|
+
"""
|
|
1417
|
+
return self.info.ctx.call_hf_processor(
|
|
1418
|
+
self.info.get_hf_processor(**mm_kwargs),
|
|
1419
|
+
dict(text=prompt, **mm_data),
|
|
1420
|
+
dict(**mm_kwargs, **tok_kwargs),
|
|
1421
|
+
)
|
|
1422
|
+
|
|
1423
|
+
def _hf_processor_applies_updates(
|
|
1424
|
+
self,
|
|
1425
|
+
prompt_text: str,
|
|
1426
|
+
mm_items: MultiModalDataItems,
|
|
1427
|
+
hf_processor_mm_kwargs: Mapping[str, object],
|
|
1428
|
+
tokenization_kwargs: Mapping[str, object],
|
|
1429
|
+
) -> bool:
|
|
1430
|
+
"""
|
|
1431
|
+
Return whether the HF processor applies prompt updates.
|
|
1432
|
+
|
|
1433
|
+
For most HF processors, this should be `True` when multi-modal
|
|
1434
|
+
data items are passed, but `False` when multi-modal embeddings
|
|
1435
|
+
are passed.
|
|
1436
|
+
"""
|
|
1437
|
+
return not any(
|
|
1438
|
+
isinstance(items, (EmbeddingItems, DictEmbeddingItems))
|
|
1439
|
+
for items in mm_items.values())
|
|
1440
|
+
|
|
1441
|
+
def _apply_hf_processor_text_mm(
|
|
1442
|
+
self,
|
|
1443
|
+
prompt_text: str,
|
|
1444
|
+
mm_items: MultiModalDataItems,
|
|
1445
|
+
hf_processor_mm_kwargs: Mapping[str, object],
|
|
1446
|
+
tokenization_kwargs: Mapping[str, object],
|
|
1447
|
+
) -> tuple[list[int], "BatchFeature", bool]:
|
|
1448
|
+
"""
|
|
1449
|
+
Apply the HF processor on the prompt text and multi-modal data
|
|
1450
|
+
together.
|
|
1451
|
+
|
|
1452
|
+
In addition, return whether prompt updates have been applied.
|
|
1453
|
+
"""
|
|
1454
|
+
processor_data, passthrough_data = self._get_hf_mm_data(mm_items)
|
|
1455
|
+
|
|
1456
|
+
processed_data = self._call_hf_processor(
|
|
1457
|
+
prompt=prompt_text,
|
|
1458
|
+
mm_data=processor_data,
|
|
1459
|
+
mm_kwargs=hf_processor_mm_kwargs,
|
|
1460
|
+
tok_kwargs=tokenization_kwargs,
|
|
1461
|
+
)
|
|
1462
|
+
processed_data.update(passthrough_data)
|
|
1463
|
+
|
|
1464
|
+
prompt_ids, = processed_data.pop("input_ids").tolist()
|
|
1465
|
+
|
|
1466
|
+
is_update_applied = self._hf_processor_applies_updates(
|
|
1467
|
+
prompt_text=prompt_text,
|
|
1468
|
+
mm_items=mm_items,
|
|
1469
|
+
hf_processor_mm_kwargs=hf_processor_mm_kwargs,
|
|
1470
|
+
tokenization_kwargs=tokenization_kwargs,
|
|
1471
|
+
)
|
|
1472
|
+
|
|
1473
|
+
return prompt_ids, processed_data, is_update_applied
|
|
1474
|
+
|
|
1475
|
+
def _apply_hf_processor_text_only(
|
|
1476
|
+
self,
|
|
1477
|
+
prompt_text: str,
|
|
1478
|
+
tokenization_kwargs: Mapping[str, object],
|
|
1479
|
+
) -> list[int]:
|
|
1480
|
+
"""
|
|
1481
|
+
Apply the HF processor on the prompt text only.
|
|
1482
|
+
|
|
1483
|
+
Since HF processor requires that text and multi-modal items
|
|
1484
|
+
correspond to each other, we create dummy multi-modal items
|
|
1485
|
+
to go along with the text.
|
|
1486
|
+
"""
|
|
1487
|
+
prompt_ids, _, _ = self._apply_hf_processor_text_mm(
|
|
1488
|
+
prompt_text=prompt_text,
|
|
1489
|
+
mm_items=MultiModalDataItems({}),
|
|
1490
|
+
hf_processor_mm_kwargs={},
|
|
1491
|
+
tokenization_kwargs=tokenization_kwargs,
|
|
1492
|
+
)
|
|
1493
|
+
|
|
1494
|
+
return prompt_ids
|
|
1495
|
+
|
|
1496
|
+
def _apply_hf_processor_tokens_only(
|
|
1497
|
+
self,
|
|
1498
|
+
prompt_tokens: list[int],
|
|
1499
|
+
) -> list[int]:
|
|
1500
|
+
"""
|
|
1501
|
+
Apply the HF processor on the prompt tokens only.
|
|
1502
|
+
|
|
1503
|
+
Most HF processors accept prompt text but not prompt tokens.
|
|
1504
|
+
If the HF processor adds or removes tokens that are not related to
|
|
1505
|
+
multi-modal data, you should override this method so it is consistent
|
|
1506
|
+
with the output of
|
|
1507
|
+
[`_apply_hf_processor_text_only`][vllm.multimodal.processing.BaseMultiModalProcessor._apply_hf_processor_text_only]
|
|
1508
|
+
on the
|
|
1509
|
+
corresponding text.
|
|
1510
|
+
"""
|
|
1511
|
+
return prompt_tokens
|
|
1512
|
+
|
|
1513
|
+
def _apply_hf_processor_mm_only(
|
|
1514
|
+
self,
|
|
1515
|
+
mm_items: MultiModalDataItems,
|
|
1516
|
+
hf_processor_mm_kwargs: Mapping[str, object],
|
|
1517
|
+
tokenization_kwargs: Mapping[str, object],
|
|
1518
|
+
) -> "BatchFeature":
|
|
1519
|
+
"""
|
|
1520
|
+
Apply the HF processor on the multi-modal data only.
|
|
1521
|
+
|
|
1522
|
+
Since HF processor requires that text and multi-modal items
|
|
1523
|
+
correspond to each other, we generate dummy text using
|
|
1524
|
+
[`DummyInputsBuilder`][vllm.multimodal.profiling.BaseDummyInputsBuilder]
|
|
1525
|
+
to go along with the multi-modal data.
|
|
1526
|
+
"""
|
|
1527
|
+
mm_counts = mm_items.get_all_counts()
|
|
1528
|
+
|
|
1529
|
+
_, mm_processed_data, _ = self._apply_hf_processor_text_mm(
|
|
1530
|
+
prompt_text=self.dummy_inputs.get_dummy_text(mm_counts),
|
|
1531
|
+
mm_items=mm_items,
|
|
1532
|
+
hf_processor_mm_kwargs=hf_processor_mm_kwargs,
|
|
1533
|
+
tokenization_kwargs=tokenization_kwargs,
|
|
1534
|
+
)
|
|
1535
|
+
|
|
1536
|
+
return mm_processed_data
|
|
1537
|
+
|
|
1538
|
+
def _apply_hf_processor_main(
|
|
1539
|
+
self,
|
|
1540
|
+
prompt: Union[str, list[int]],
|
|
1541
|
+
mm_items: MultiModalDataItems,
|
|
1542
|
+
hf_processor_mm_kwargs: Mapping[str, object],
|
|
1543
|
+
tokenization_kwargs: Mapping[str, object],
|
|
1544
|
+
*,
|
|
1545
|
+
enable_hf_prompt_update: bool,
|
|
1546
|
+
) -> tuple[list[int], "BatchFeature", bool]:
|
|
1547
|
+
"""
|
|
1548
|
+
Apply the HF processor on the prompt text and multi-modal data.
|
|
1549
|
+
|
|
1550
|
+
In addition, return whether prompt updates have been applied
|
|
1551
|
+
(for most HF processors, this should be `True`).
|
|
1552
|
+
|
|
1553
|
+
Note:
|
|
1554
|
+
If `enable_hf_prompt_update=False`, we use HF processor
|
|
1555
|
+
to perform prompt updates if available; HF processor requires
|
|
1556
|
+
that the prompt corresponds to multi-modal items.
|
|
1557
|
+
"""
|
|
1558
|
+
if isinstance(prompt, str):
|
|
1559
|
+
if enable_hf_prompt_update:
|
|
1560
|
+
return self._apply_hf_processor_text_mm(
|
|
1561
|
+
prompt_text=prompt,
|
|
1562
|
+
mm_items=mm_items,
|
|
1563
|
+
hf_processor_mm_kwargs=hf_processor_mm_kwargs,
|
|
1564
|
+
tokenization_kwargs=tokenization_kwargs,
|
|
1565
|
+
)
|
|
1566
|
+
|
|
1567
|
+
prompt_ids = self._apply_hf_processor_text_only(
|
|
1568
|
+
prompt, tokenization_kwargs)
|
|
1569
|
+
else:
|
|
1570
|
+
prompt_ids = self._apply_hf_processor_tokens_only(prompt)
|
|
1571
|
+
|
|
1572
|
+
mm_processed_data = self._apply_hf_processor_mm_only(
|
|
1573
|
+
mm_items=mm_items,
|
|
1574
|
+
hf_processor_mm_kwargs=hf_processor_mm_kwargs,
|
|
1575
|
+
tokenization_kwargs=tokenization_kwargs,
|
|
1576
|
+
)
|
|
1577
|
+
|
|
1578
|
+
return prompt_ids, mm_processed_data, False
|
|
1579
|
+
|
|
1580
|
+
def _hash_mm_items(
|
|
1581
|
+
self,
|
|
1582
|
+
mm_items: MultiModalDataItems,
|
|
1583
|
+
hf_processor_mm_kwargs: Mapping[str, object],
|
|
1584
|
+
tokenization_kwargs: Mapping[str, object],
|
|
1585
|
+
*,
|
|
1586
|
+
mm_uuids: Optional[MultiModalUUIDDict] = None,
|
|
1587
|
+
) -> MultiModalHashes:
|
|
1588
|
+
"""Create MM hashes to be returned.
|
|
1589
|
+
|
|
1590
|
+
|
|
1591
|
+
Note: When overrides are provided via callers of `apply`,
|
|
1592
|
+
`_hash_mm_items` will be bypassed and the overrides will be used.
|
|
1593
|
+
"""
|
|
1594
|
+
model_id = self.info.model_id
|
|
1595
|
+
|
|
1596
|
+
hashes: MultiModalHashes = {}
|
|
1597
|
+
mm_uuids = mm_uuids or {}
|
|
1598
|
+
|
|
1599
|
+
for modality, items in mm_items.items():
|
|
1600
|
+
if modality in mm_uuids:
|
|
1601
|
+
mm_uuids_per_modality = mm_uuids[modality]
|
|
1602
|
+
if isinstance(mm_uuids_per_modality, str):
|
|
1603
|
+
mm_uuids_per_modality = [mm_uuids_per_modality]
|
|
1604
|
+
|
|
1605
|
+
# For None entries, compute a hash; otherwise, use provided ID.
|
|
1606
|
+
computed: list[str] = []
|
|
1607
|
+
for i, item in enumerate(items):
|
|
1608
|
+
item_uuid = mm_uuids_per_modality[i]
|
|
1609
|
+
|
|
1610
|
+
# NOTE: Even if a item_uuid is provided, we still compute a
|
|
1611
|
+
# hash if `hf_processor_mm_kwargs` or `tokenization_kwargs`
|
|
1612
|
+
# are provided. This is because the processed multimodal
|
|
1613
|
+
# inputs can be different depending on the processor kwargs.
|
|
1614
|
+
if item_uuid is None or \
|
|
1615
|
+
hf_processor_mm_kwargs or \
|
|
1616
|
+
tokenization_kwargs:
|
|
1617
|
+
|
|
1618
|
+
# NOTE: use provided hash string to hash with kwargs
|
|
1619
|
+
# if available for better performance.
|
|
1620
|
+
item = item_uuid if item_uuid is not None else item
|
|
1621
|
+
computed.append(
|
|
1622
|
+
MultiModalHasher.hash_kwargs(
|
|
1623
|
+
model_id=model_id,
|
|
1624
|
+
**{modality: item},
|
|
1625
|
+
**hf_processor_mm_kwargs,
|
|
1626
|
+
**tokenization_kwargs))
|
|
1627
|
+
else:
|
|
1628
|
+
computed.append(item_uuid)
|
|
1629
|
+
hashes[modality] = computed
|
|
1630
|
+
else:
|
|
1631
|
+
hashes[modality] = [
|
|
1632
|
+
MultiModalHasher.hash_kwargs(model_id=model_id,
|
|
1633
|
+
**{modality: item},
|
|
1634
|
+
**hf_processor_mm_kwargs,
|
|
1635
|
+
**tokenization_kwargs)
|
|
1636
|
+
for item in items
|
|
1637
|
+
]
|
|
1638
|
+
|
|
1639
|
+
return hashes
|
|
1640
|
+
|
|
1641
|
+
def _get_cache_missing_items(
|
|
1642
|
+
self,
|
|
1643
|
+
cache: "BaseMultiModalProcessorCache",
|
|
1644
|
+
mm_data_items: MultiModalDataItems,
|
|
1645
|
+
mm_hashes: MultiModalHashes,
|
|
1646
|
+
) -> MultiModalDataItems:
|
|
1647
|
+
mm_is_cached = {
|
|
1648
|
+
modality: cache.is_cached(hashes)
|
|
1649
|
+
for modality, hashes in mm_hashes.items()
|
|
1650
|
+
}
|
|
1651
|
+
|
|
1652
|
+
mm_missing_idxs = {
|
|
1653
|
+
modality: [
|
|
1654
|
+
idx for idx, item_is_cached in enumerate(items_is_cached)
|
|
1655
|
+
if not item_is_cached
|
|
1656
|
+
]
|
|
1657
|
+
for modality, items_is_cached in mm_is_cached.items()
|
|
1658
|
+
}
|
|
1659
|
+
mm_missing_data = {}
|
|
1660
|
+
for modality, idxs in mm_missing_idxs.items():
|
|
1661
|
+
missing_modality_data = []
|
|
1662
|
+
for idx in idxs:
|
|
1663
|
+
data = mm_data_items[modality][idx]
|
|
1664
|
+
if data is None:
|
|
1665
|
+
raise ValueError(
|
|
1666
|
+
f"Cache miss for {modality} at index {idx} "
|
|
1667
|
+
f"but data is not provided.")
|
|
1668
|
+
else:
|
|
1669
|
+
missing_modality_data.append(data)
|
|
1670
|
+
mm_missing_data[modality] = missing_modality_data
|
|
1671
|
+
|
|
1672
|
+
return self._to_mm_items(mm_missing_data)
|
|
1673
|
+
|
|
1674
|
+
def _recompute_cached_prompt_update(
|
|
1675
|
+
self,
|
|
1676
|
+
cached_update: ResolvedPromptUpdate,
|
|
1677
|
+
new_item_idx: int,
|
|
1678
|
+
) -> ResolvedPromptUpdate:
|
|
1679
|
+
"""
|
|
1680
|
+
Override this if other attributes of `ResolvedPromptUpdate`
|
|
1681
|
+
also need to be recomputed after retrieving from the cache.
|
|
1682
|
+
"""
|
|
1683
|
+
return replace(cached_update, item_idx=new_item_idx)
|
|
1684
|
+
|
|
1685
|
+
def _merge_mm_kwargs(
|
|
1686
|
+
self,
|
|
1687
|
+
cache: "BaseMultiModalProcessorCache",
|
|
1688
|
+
mm_hashes: MultiModalHashes,
|
|
1689
|
+
mm_missing_kwargs: MultiModalKwargsItems,
|
|
1690
|
+
mm_missing_prompt_updates: MultiModalPromptUpdates,
|
|
1691
|
+
) -> tuple[MultiModalKwargsOptionalItems, MultiModalPromptUpdates]:
|
|
1692
|
+
# Need to calculate this at the beginning to avoid skipping cache logic
|
|
1693
|
+
# for subsequently repeated items in the same modality
|
|
1694
|
+
mm_is_cached = {
|
|
1695
|
+
modality: cache.is_cached(hashes)
|
|
1696
|
+
for modality, hashes in mm_hashes.items()
|
|
1697
|
+
}
|
|
1698
|
+
|
|
1699
|
+
mm_missing_next_idx = defaultdict[str, int](lambda: 0)
|
|
1700
|
+
|
|
1701
|
+
merged_kwargs = defaultdict[str,
|
|
1702
|
+
list[Optional[MultiModalKwargsItem]]](list)
|
|
1703
|
+
merged_prompt_updates = defaultdict[
|
|
1704
|
+
str, list[Sequence[ResolvedPromptUpdate]]](list)
|
|
1705
|
+
for modality, hashes in mm_hashes.items():
|
|
1706
|
+
missing_kwargs = mm_missing_kwargs.get(modality, [])
|
|
1707
|
+
missing_prompt_updates = mm_missing_prompt_updates.get(
|
|
1708
|
+
modality, [])
|
|
1709
|
+
|
|
1710
|
+
for item_idx, item_hash in enumerate(hashes):
|
|
1711
|
+
kwargs: Optional[MultiModalKwargsItem]
|
|
1712
|
+
if not mm_is_cached[modality][item_idx]:
|
|
1713
|
+
missing_next_idx = mm_missing_next_idx[modality]
|
|
1714
|
+
kwargs = missing_kwargs[missing_next_idx]
|
|
1715
|
+
updates = missing_prompt_updates[missing_next_idx]
|
|
1716
|
+
|
|
1717
|
+
mm_missing_next_idx[modality] += 1
|
|
1718
|
+
|
|
1719
|
+
item = kwargs, updates
|
|
1720
|
+
else:
|
|
1721
|
+
item = None
|
|
1722
|
+
|
|
1723
|
+
kwargs, updates = cache.get_and_update_item(item, item_hash)
|
|
1724
|
+
|
|
1725
|
+
merged_kwargs[modality].append(kwargs)
|
|
1726
|
+
merged_prompt_updates[modality].append([
|
|
1727
|
+
self._recompute_cached_prompt_update(update, item_idx)
|
|
1728
|
+
for update in updates
|
|
1729
|
+
])
|
|
1730
|
+
|
|
1731
|
+
mm_kwargs = MultiModalKwargsItems(merged_kwargs)
|
|
1732
|
+
mm_prompt_updates = dict(merged_prompt_updates)
|
|
1733
|
+
|
|
1734
|
+
return mm_kwargs, mm_prompt_updates
|
|
1735
|
+
|
|
1736
|
+
def _apply_hf_processor(
|
|
1737
|
+
self,
|
|
1738
|
+
prompt: Union[str, list[int]],
|
|
1739
|
+
mm_data_items: MultiModalDataItems,
|
|
1740
|
+
hf_processor_mm_kwargs: Mapping[str, object],
|
|
1741
|
+
tokenization_kwargs: Mapping[str, object],
|
|
1742
|
+
*,
|
|
1743
|
+
mm_uuids: Optional[MultiModalUUIDDict] = None,
|
|
1744
|
+
) -> tuple[list[int], MultiModalProcessingInfo, bool]:
|
|
1745
|
+
(
|
|
1746
|
+
prompt_ids,
|
|
1747
|
+
mm_processed_data,
|
|
1748
|
+
is_update_applied,
|
|
1749
|
+
) = self._apply_hf_processor_main(
|
|
1750
|
+
prompt=prompt,
|
|
1751
|
+
mm_items=mm_data_items,
|
|
1752
|
+
hf_processor_mm_kwargs=hf_processor_mm_kwargs,
|
|
1753
|
+
tokenization_kwargs=tokenization_kwargs,
|
|
1754
|
+
enable_hf_prompt_update=True,
|
|
1755
|
+
)
|
|
1756
|
+
|
|
1757
|
+
mm_kwargs = MultiModalKwargsItems.from_hf_inputs(
|
|
1758
|
+
mm_processed_data,
|
|
1759
|
+
self._get_mm_fields_config(mm_processed_data,
|
|
1760
|
+
hf_processor_mm_kwargs),
|
|
1761
|
+
)
|
|
1762
|
+
|
|
1763
|
+
# Use overrides if provided; fallback to data-dependent hashing.
|
|
1764
|
+
mm_hashes = self._hash_mm_items(mm_data_items,
|
|
1765
|
+
hf_processor_mm_kwargs,
|
|
1766
|
+
tokenization_kwargs,
|
|
1767
|
+
mm_uuids=mm_uuids)
|
|
1768
|
+
|
|
1769
|
+
mm_prompt_updates = self._get_mm_prompt_updates(
|
|
1770
|
+
mm_data_items,
|
|
1771
|
+
hf_processor_mm_kwargs,
|
|
1772
|
+
mm_kwargs,
|
|
1773
|
+
)
|
|
1774
|
+
|
|
1775
|
+
mm_info = MultiModalProcessingInfo(
|
|
1776
|
+
kwargs=mm_kwargs,
|
|
1777
|
+
hashes=mm_hashes,
|
|
1778
|
+
prompt_updates=mm_prompt_updates,
|
|
1779
|
+
)
|
|
1780
|
+
|
|
1781
|
+
return prompt_ids, mm_info, is_update_applied
|
|
1782
|
+
|
|
1783
|
+
def _cached_apply_hf_processor(
|
|
1784
|
+
self,
|
|
1785
|
+
prompt: Union[str, list[int]],
|
|
1786
|
+
mm_data_items: MultiModalDataItems,
|
|
1787
|
+
hf_processor_mm_kwargs: Mapping[str, object],
|
|
1788
|
+
tokenization_kwargs: Mapping[str, object],
|
|
1789
|
+
*,
|
|
1790
|
+
mm_uuids: Optional[MultiModalUUIDDict] = None,
|
|
1791
|
+
) -> tuple[list[int], MultiModalProcessingInfo, bool]:
|
|
1792
|
+
"""
|
|
1793
|
+
Apply the HF processor on the full prompt text,
|
|
1794
|
+
caching the results and reusing cached results.
|
|
1795
|
+
"""
|
|
1796
|
+
cache = self.cache
|
|
1797
|
+
|
|
1798
|
+
_, passthrough_data = self._get_hf_mm_data(mm_data_items)
|
|
1799
|
+
if cache is None or passthrough_data:
|
|
1800
|
+
return self._apply_hf_processor(
|
|
1801
|
+
prompt=prompt,
|
|
1802
|
+
mm_data_items=mm_data_items,
|
|
1803
|
+
hf_processor_mm_kwargs=hf_processor_mm_kwargs,
|
|
1804
|
+
tokenization_kwargs=tokenization_kwargs,
|
|
1805
|
+
mm_uuids=mm_uuids,
|
|
1806
|
+
)
|
|
1807
|
+
|
|
1808
|
+
mm_hashes = self._hash_mm_items(mm_data_items,
|
|
1809
|
+
hf_processor_mm_kwargs,
|
|
1810
|
+
tokenization_kwargs,
|
|
1811
|
+
mm_uuids=mm_uuids)
|
|
1812
|
+
|
|
1813
|
+
mm_missing_data_items = self._get_cache_missing_items(
|
|
1814
|
+
cache=cache,
|
|
1815
|
+
mm_data_items=mm_data_items,
|
|
1816
|
+
mm_hashes=mm_hashes,
|
|
1817
|
+
)
|
|
1818
|
+
|
|
1819
|
+
# NOTE: `prompt` does not correspond to `mm_missing_data_items`,
|
|
1820
|
+
# so we can't apply prompt updates until the new multimodal
|
|
1821
|
+
# items are combined with the cached multimodal items
|
|
1822
|
+
(
|
|
1823
|
+
prompt_ids,
|
|
1824
|
+
mm_missing_processed_data,
|
|
1825
|
+
is_update_applied,
|
|
1826
|
+
) = self._apply_hf_processor_main(
|
|
1827
|
+
prompt=prompt,
|
|
1828
|
+
mm_items=mm_missing_data_items,
|
|
1829
|
+
hf_processor_mm_kwargs=hf_processor_mm_kwargs,
|
|
1830
|
+
tokenization_kwargs=tokenization_kwargs,
|
|
1831
|
+
enable_hf_prompt_update=False,
|
|
1832
|
+
)
|
|
1833
|
+
|
|
1834
|
+
mm_missing_kwargs = MultiModalKwargsItems.from_hf_inputs(
|
|
1835
|
+
mm_missing_processed_data,
|
|
1836
|
+
self._get_mm_fields_config(mm_missing_processed_data,
|
|
1837
|
+
hf_processor_mm_kwargs),
|
|
1838
|
+
)
|
|
1839
|
+
|
|
1840
|
+
mm_missing_prompt_updates = self._get_mm_prompt_updates(
|
|
1841
|
+
mm_missing_data_items,
|
|
1842
|
+
hf_processor_mm_kwargs,
|
|
1843
|
+
mm_missing_kwargs,
|
|
1844
|
+
)
|
|
1845
|
+
|
|
1846
|
+
mm_kwargs, mm_prompt_updates = self._merge_mm_kwargs(
|
|
1847
|
+
cache,
|
|
1848
|
+
mm_hashes=mm_hashes,
|
|
1849
|
+
mm_missing_kwargs=mm_missing_kwargs,
|
|
1850
|
+
mm_missing_prompt_updates=mm_missing_prompt_updates,
|
|
1851
|
+
)
|
|
1852
|
+
|
|
1853
|
+
mm_info = MultiModalProcessingInfo(
|
|
1854
|
+
kwargs=mm_kwargs,
|
|
1855
|
+
hashes=mm_hashes,
|
|
1856
|
+
prompt_updates=mm_prompt_updates,
|
|
1857
|
+
)
|
|
1858
|
+
|
|
1859
|
+
return prompt_ids, mm_info, is_update_applied
|
|
1860
|
+
|
|
1861
|
+
def _apply_token_matches(
|
|
1862
|
+
self,
|
|
1863
|
+
prompt: list[int],
|
|
1864
|
+
mm_prompt_updates: MultiModalPromptUpdates,
|
|
1865
|
+
) -> tuple[list[int], MultiModalPromptUpdatesApplyResult]:
|
|
1866
|
+
tokenizer = self.info.get_tokenizer()
|
|
1867
|
+
return apply_token_matches(prompt, mm_prompt_updates, tokenizer)
|
|
1868
|
+
|
|
1869
|
+
def _apply_text_matches(
|
|
1870
|
+
self,
|
|
1871
|
+
prompt: str,
|
|
1872
|
+
mm_prompt_updates: MultiModalPromptUpdates,
|
|
1873
|
+
) -> tuple[str, MultiModalPromptUpdatesApplyResult]:
|
|
1874
|
+
tokenizer = self.info.get_tokenizer()
|
|
1875
|
+
return apply_text_matches(prompt, mm_prompt_updates, tokenizer)
|
|
1876
|
+
|
|
1877
|
+
def _apply_prompt_updates(
|
|
1878
|
+
self,
|
|
1879
|
+
token_ids: list[int],
|
|
1880
|
+
mm_prompt_updates: MultiModalPromptUpdates,
|
|
1881
|
+
) -> tuple[list[int], str, Mapping[str, list[PlaceholderFeaturesInfo]]]:
|
|
1882
|
+
tokenizer = self.info.get_tokenizer()
|
|
1883
|
+
|
|
1884
|
+
new_token_ids, match_result = self._apply_token_matches(
|
|
1885
|
+
token_ids,
|
|
1886
|
+
mm_prompt_updates,
|
|
1887
|
+
)
|
|
1888
|
+
|
|
1889
|
+
# If the search text does not represent a special token,
|
|
1890
|
+
# it may have different token IDs in the prompt, because
|
|
1891
|
+
# the tokens may go across the boundaries of the search text.
|
|
1892
|
+
# ----
|
|
1893
|
+
# e.g. when searching for "foo" in "food", if "food" itself makes
|
|
1894
|
+
# up a token, then the token ID of "foo" will not appear at all
|
|
1895
|
+
# ----
|
|
1896
|
+
# Since it is inefficient to search for all possible tokenizations
|
|
1897
|
+
# of the search text in the prompt, we instead perform string-based
|
|
1898
|
+
# updates on the decoded token IDs, then encode them back.
|
|
1899
|
+
if all(
|
|
1900
|
+
all(update_idx is not None for update_idx in update_idxs)
|
|
1901
|
+
for update_idxs in match_result.values()):
|
|
1902
|
+
new_text = decode_tokens(tokenizer, new_token_ids)
|
|
1903
|
+
else:
|
|
1904
|
+
new_text, match_result = self._apply_text_matches(
|
|
1905
|
+
decode_tokens(tokenizer, token_ids),
|
|
1906
|
+
mm_prompt_updates,
|
|
1907
|
+
)
|
|
1908
|
+
|
|
1909
|
+
new_token_ids = encode_tokens(
|
|
1910
|
+
tokenizer,
|
|
1911
|
+
new_text,
|
|
1912
|
+
add_special_tokens=False,
|
|
1913
|
+
)
|
|
1914
|
+
|
|
1915
|
+
matched_updates = defaultdict[
|
|
1916
|
+
str, list[Sequence[ResolvedPromptUpdate]]](list)
|
|
1917
|
+
for modality, update_idxs in match_result.items():
|
|
1918
|
+
for item_idx, update_idx in enumerate(update_idxs):
|
|
1919
|
+
assert update_idx is not None, (
|
|
1920
|
+
"Failed to apply prompt replacement for "
|
|
1921
|
+
f"mm_items[{modality!r}][{item_idx}]")
|
|
1922
|
+
|
|
1923
|
+
matched_updates[modality].append(
|
|
1924
|
+
[mm_prompt_updates[modality][item_idx][update_idx]])
|
|
1925
|
+
|
|
1926
|
+
placeholders = self._find_mm_placeholders(
|
|
1927
|
+
new_token_ids,
|
|
1928
|
+
dict(matched_updates),
|
|
1929
|
+
)
|
|
1930
|
+
|
|
1931
|
+
return new_token_ids, new_text, placeholders
|
|
1932
|
+
|
|
1933
|
+
def _validate_mm_kwargs(
|
|
1934
|
+
self,
|
|
1935
|
+
mm_kwargs: MultiModalKwargsOptionalItems,
|
|
1936
|
+
mm_item_counts: Mapping[str, int],
|
|
1937
|
+
) -> None:
|
|
1938
|
+
for modality, item_count in mm_item_counts.items():
|
|
1939
|
+
items = mm_kwargs.get(modality, [])
|
|
1940
|
+
|
|
1941
|
+
if len(items) != item_count:
|
|
1942
|
+
raise RuntimeError(
|
|
1943
|
+
f"Expected there to be {item_count} {modality} items in "
|
|
1944
|
+
f"keyword arguments corresponding to {item_count} "
|
|
1945
|
+
f"{modality} data items, but only found {len(items)}! "
|
|
1946
|
+
"There is likely a problem with your "
|
|
1947
|
+
"implementation of merged multi-modal processor for this "
|
|
1948
|
+
"model (usually arising from an inconsistency between "
|
|
1949
|
+
"`_call_hf_processor` and `_get_mm_fields_config`).")
|
|
1950
|
+
|
|
1951
|
+
def _validate_mm_placeholders(
|
|
1952
|
+
self,
|
|
1953
|
+
mm_placeholders: Mapping[str, list[PlaceholderFeaturesInfo]],
|
|
1954
|
+
mm_item_counts: Mapping[str, int],
|
|
1955
|
+
) -> None:
|
|
1956
|
+
for modality, item_count in mm_item_counts.items():
|
|
1957
|
+
placeholders = mm_placeholders.get(modality, [])
|
|
1958
|
+
|
|
1959
|
+
if len(placeholders) != item_count:
|
|
1960
|
+
# NOTE: If you are a model developer, this can also arise from
|
|
1961
|
+
# an inconsistency between `_call_hf_processor` and
|
|
1962
|
+
# `_get_mm_fields_config` implementations
|
|
1963
|
+
raise RuntimeError(
|
|
1964
|
+
f"Expected there to be {item_count} prompt updates "
|
|
1965
|
+
f"corresponding to {item_count} {modality} items, but "
|
|
1966
|
+
f"instead found {len(placeholders)} prompt updates! "
|
|
1967
|
+
"This is likely because you forgot to include input "
|
|
1968
|
+
"placeholder tokens (e.g., `<image>`, `<|image_pad|>`) "
|
|
1969
|
+
"in the prompt. If the model has a chat template, make "
|
|
1970
|
+
"sure you have applied it before calling `LLM.generate`.")
|
|
1971
|
+
|
|
1972
|
+
def _maybe_apply_prompt_updates(
|
|
1973
|
+
self,
|
|
1974
|
+
mm_items: MultiModalDataItems,
|
|
1975
|
+
prompt_ids: list[int],
|
|
1976
|
+
mm_kwargs: MultiModalKwargsOptionalItems,
|
|
1977
|
+
mm_prompt_updates: MultiModalPromptUpdates,
|
|
1978
|
+
is_update_applied: bool,
|
|
1979
|
+
) -> tuple[list[int], str, Mapping[str, list[PlaceholderFeaturesInfo]]]:
|
|
1980
|
+
mm_item_counts = mm_items.get_all_counts()
|
|
1981
|
+
self._validate_mm_kwargs(mm_kwargs, mm_item_counts)
|
|
1982
|
+
|
|
1983
|
+
if is_update_applied:
|
|
1984
|
+
mm_placeholders = self._find_mm_placeholders(
|
|
1985
|
+
prompt_ids,
|
|
1986
|
+
mm_prompt_updates,
|
|
1987
|
+
)
|
|
1988
|
+
self._validate_mm_placeholders(mm_placeholders, mm_item_counts)
|
|
1989
|
+
|
|
1990
|
+
tokenizer = self.info.get_tokenizer()
|
|
1991
|
+
prompt = decode_tokens(tokenizer, prompt_ids)
|
|
1992
|
+
else:
|
|
1993
|
+
(
|
|
1994
|
+
prompt_ids,
|
|
1995
|
+
prompt,
|
|
1996
|
+
mm_placeholders,
|
|
1997
|
+
) = self._apply_prompt_updates(
|
|
1998
|
+
prompt_ids,
|
|
1999
|
+
mm_prompt_updates,
|
|
2000
|
+
)
|
|
2001
|
+
self._validate_mm_placeholders(mm_placeholders, mm_item_counts)
|
|
2002
|
+
|
|
2003
|
+
return prompt_ids, prompt, mm_placeholders
|
|
2004
|
+
|
|
2005
|
+
def apply(
|
|
2006
|
+
self,
|
|
2007
|
+
prompt: Union[str, list[int]],
|
|
2008
|
+
mm_data: MultiModalDataDict,
|
|
2009
|
+
hf_processor_mm_kwargs: Mapping[str, object],
|
|
2010
|
+
tokenization_kwargs: Optional[Mapping[str, object]] = None,
|
|
2011
|
+
*,
|
|
2012
|
+
mm_uuids: Optional[MultiModalUUIDDict] = None,
|
|
2013
|
+
) -> MultiModalInputs:
|
|
2014
|
+
"""
|
|
2015
|
+
Process multi-modal inputs to be used in vLLM.
|
|
2016
|
+
|
|
2017
|
+
The main steps are:
|
|
2018
|
+
|
|
2019
|
+
1. Apply HF Processor on prompt text and multi-modal data together,
|
|
2020
|
+
outputting token IDs and processed tensors.
|
|
2021
|
+
2. Find and update sequences in the token IDs with placeholder tokens.
|
|
2022
|
+
The number of placeholder tokens equals the feature size of the
|
|
2023
|
+
multi-modal data outputted by the multi-modal encoder.
|
|
2024
|
+
3. Extract information about the placeholder tokens from the
|
|
2025
|
+
processed token IDs.
|
|
2026
|
+
"""
|
|
2027
|
+
mm_items = self._to_mm_items(mm_data)
|
|
2028
|
+
|
|
2029
|
+
if tokenization_kwargs is None:
|
|
2030
|
+
tokenization_kwargs = {}
|
|
2031
|
+
|
|
2032
|
+
(
|
|
2033
|
+
prompt_ids,
|
|
2034
|
+
mm_info,
|
|
2035
|
+
is_update_applied,
|
|
2036
|
+
) = self._cached_apply_hf_processor(
|
|
2037
|
+
prompt,
|
|
2038
|
+
mm_items,
|
|
2039
|
+
hf_processor_mm_kwargs,
|
|
2040
|
+
tokenization_kwargs=tokenization_kwargs,
|
|
2041
|
+
mm_uuids=mm_uuids,
|
|
2042
|
+
)
|
|
2043
|
+
|
|
2044
|
+
# NOTE: tokenization_kwargs are not required to init processor
|
|
2045
|
+
prompt_ids, prompt, mm_placeholders = self._maybe_apply_prompt_updates(
|
|
2046
|
+
mm_items=mm_items,
|
|
2047
|
+
prompt_ids=prompt_ids,
|
|
2048
|
+
mm_kwargs=mm_info.kwargs,
|
|
2049
|
+
mm_prompt_updates=mm_info.prompt_updates,
|
|
2050
|
+
is_update_applied=is_update_applied,
|
|
2051
|
+
)
|
|
2052
|
+
|
|
2053
|
+
mm_placeholder_ranges = {
|
|
2054
|
+
modality: [item.to_range() for item in placeholders]
|
|
2055
|
+
for modality, placeholders in mm_placeholders.items()
|
|
2056
|
+
}
|
|
2057
|
+
|
|
2058
|
+
return MultiModalInputs(
|
|
2059
|
+
type="multimodal",
|
|
2060
|
+
prompt=prompt,
|
|
2061
|
+
prompt_token_ids=prompt_ids,
|
|
2062
|
+
mm_kwargs=mm_info.kwargs,
|
|
2063
|
+
mm_hashes=mm_info.hashes,
|
|
2064
|
+
mm_placeholders=mm_placeholder_ranges,
|
|
2065
|
+
)
|
|
2066
|
+
|
|
2067
|
+
|
|
2068
|
+
class EncDecMultiModalProcessor(BaseMultiModalProcessor[_I]):
|
|
2069
|
+
|
|
2070
|
+
@abstractmethod
|
|
2071
|
+
def create_encoder_prompt(
|
|
2072
|
+
self,
|
|
2073
|
+
prompt: Union[str, list[int]],
|
|
2074
|
+
mm_data: MultiModalDataDict,
|
|
2075
|
+
) -> Union[str, list[int]]:
|
|
2076
|
+
"""
|
|
2077
|
+
Create input prompt for the encoder. HF processor will be applied on
|
|
2078
|
+
this prompt during profiling and generation.
|
|
2079
|
+
"""
|
|
2080
|
+
raise NotImplementedError
|
|
2081
|
+
|
|
2082
|
+
@property
|
|
2083
|
+
def pad_dummy_encoder_prompt(self) -> bool:
|
|
2084
|
+
return False
|
|
2085
|
+
|
|
2086
|
+
def create_decoder_prompt(
|
|
2087
|
+
self,
|
|
2088
|
+
prompt: Union[str, list[int]],
|
|
2089
|
+
mm_data: MultiModalDataDict,
|
|
2090
|
+
) -> Union[str, list[int]]:
|
|
2091
|
+
"""Create input prompt for the decoder."""
|
|
2092
|
+
return prompt
|
|
2093
|
+
|
|
2094
|
+
def _get_enc_dec_inputs(
|
|
2095
|
+
self,
|
|
2096
|
+
prompt: Union[str, list[int]],
|
|
2097
|
+
mm_data: MultiModalDataDict,
|
|
2098
|
+
encoder_inputs: MultiModalInputs,
|
|
2099
|
+
):
|
|
2100
|
+
tokenizer = self.info.get_tokenizer()
|
|
2101
|
+
decoder_prompt_raw = self.create_decoder_prompt(prompt, mm_data)
|
|
2102
|
+
if isinstance(decoder_prompt_raw, str):
|
|
2103
|
+
decoder_prompt = decoder_prompt_raw
|
|
2104
|
+
decoder_prompt_ids = encode_tokens(tokenizer,
|
|
2105
|
+
decoder_prompt_raw,
|
|
2106
|
+
add_special_tokens=False)
|
|
2107
|
+
else:
|
|
2108
|
+
decoder_prompt = decode_tokens(tokenizer, decoder_prompt_raw)
|
|
2109
|
+
decoder_prompt_ids = decoder_prompt_raw
|
|
2110
|
+
|
|
2111
|
+
mm_inputs = MultiModalEncDecInputs(
|
|
2112
|
+
encoder_prompt=encoder_inputs["prompt"],
|
|
2113
|
+
encoder_prompt_token_ids=encoder_inputs["prompt_token_ids"],
|
|
2114
|
+
**encoder_inputs)
|
|
2115
|
+
mm_inputs["prompt"] = decoder_prompt
|
|
2116
|
+
mm_inputs["prompt_token_ids"] = decoder_prompt_ids
|
|
2117
|
+
return mm_inputs
|
|
2118
|
+
|
|
2119
|
+
def apply(
|
|
2120
|
+
self,
|
|
2121
|
+
prompt: Union[str, list[int]],
|
|
2122
|
+
mm_data: MultiModalDataDict,
|
|
2123
|
+
hf_processor_mm_kwargs: Mapping[str, object],
|
|
2124
|
+
tokenization_kwargs: Optional[Mapping[str, object]] = None,
|
|
2125
|
+
*,
|
|
2126
|
+
mm_uuids: Optional[MultiModalUUIDDict] = None,
|
|
2127
|
+
) -> MultiModalEncDecInputs:
|
|
2128
|
+
"""
|
|
2129
|
+
Process multi-modal inputs to be used in vLLM.
|
|
2130
|
+
The main processing steps are modified to fit encoder-decoder model:
|
|
2131
|
+
1. Create encoder prompt from input prompt text.
|
|
2132
|
+
2. Apply the HF processor on encoder prompt.
|
|
2133
|
+
3. Copy the input prompt text as decoder prompt inputs.
|
|
2134
|
+
"""
|
|
2135
|
+
encoder_prompt = self.create_encoder_prompt(prompt, mm_data)
|
|
2136
|
+
encoder_inputs = super().apply(
|
|
2137
|
+
encoder_prompt,
|
|
2138
|
+
mm_data,
|
|
2139
|
+
hf_processor_mm_kwargs,
|
|
2140
|
+
tokenization_kwargs,
|
|
2141
|
+
mm_uuids=mm_uuids,
|
|
2142
|
+
)
|
|
2143
|
+
|
|
2144
|
+
return self._get_enc_dec_inputs(
|
|
2145
|
+
prompt=prompt,
|
|
2146
|
+
mm_data=mm_data,
|
|
2147
|
+
encoder_inputs=encoder_inputs,
|
|
2148
|
+
)
|