vllm-cpu-amxbf16 0.11.2.post2__cp310-cp310-manylinux_2_17_x86_64.whl

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