vllm-cpu-amxbf16 0.9.1__cp312-cp312-manylinux_2_17_x86_64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (1197) hide show
  1. vllm/_C.abi3.so +0 -0
  2. vllm/__init__.py +53 -0
  3. vllm/_custom_ops.py +1828 -0
  4. vllm/_ipex_ops.py +244 -0
  5. vllm/_version.py +34 -0
  6. vllm/adapter_commons/__init__.py +0 -0
  7. vllm/adapter_commons/layers.py +16 -0
  8. vllm/adapter_commons/models.py +106 -0
  9. vllm/adapter_commons/request.py +26 -0
  10. vllm/adapter_commons/utils.py +93 -0
  11. vllm/adapter_commons/worker_manager.py +39 -0
  12. vllm/assets/__init__.py +0 -0
  13. vllm/assets/audio.py +45 -0
  14. vllm/assets/base.py +41 -0
  15. vllm/assets/image.py +34 -0
  16. vllm/assets/video.py +115 -0
  17. vllm/attention/__init__.py +20 -0
  18. vllm/attention/backends/__init__.py +0 -0
  19. vllm/attention/backends/abstract.py +308 -0
  20. vllm/attention/backends/blocksparse_attn.py +461 -0
  21. vllm/attention/backends/cpu_mla.py +307 -0
  22. vllm/attention/backends/dual_chunk_flash_attn.py +1498 -0
  23. vllm/attention/backends/flash_attn.py +1003 -0
  24. vllm/attention/backends/flashinfer.py +1104 -0
  25. vllm/attention/backends/flashmla.py +244 -0
  26. vllm/attention/backends/hpu_attn.py +313 -0
  27. vllm/attention/backends/ipex_attn.py +398 -0
  28. vllm/attention/backends/mla/__init__.py +0 -0
  29. vllm/attention/backends/mla/common.py +1385 -0
  30. vllm/attention/backends/pallas.py +351 -0
  31. vllm/attention/backends/placeholder_attn.py +400 -0
  32. vllm/attention/backends/rocm_aiter_mla.py +435 -0
  33. vllm/attention/backends/rocm_flash_attn.py +975 -0
  34. vllm/attention/backends/torch_sdpa.py +703 -0
  35. vllm/attention/backends/triton_mla.py +115 -0
  36. vllm/attention/backends/utils.py +610 -0
  37. vllm/attention/backends/xformers.py +802 -0
  38. vllm/attention/layer.py +468 -0
  39. vllm/attention/ops/__init__.py +0 -0
  40. vllm/attention/ops/blocksparse_attention/__init__.py +0 -0
  41. vllm/attention/ops/blocksparse_attention/blocksparse_attention_kernel.py +433 -0
  42. vllm/attention/ops/blocksparse_attention/interface.py +239 -0
  43. vllm/attention/ops/blocksparse_attention/utils.py +246 -0
  44. vllm/attention/ops/chunked_prefill_paged_decode.py +368 -0
  45. vllm/attention/ops/flashmla.py +116 -0
  46. vllm/attention/ops/hpu_paged_attn.py +88 -0
  47. vllm/attention/ops/ipex_attn.py +195 -0
  48. vllm/attention/ops/merge_attn_states.py +43 -0
  49. vllm/attention/ops/nki_flash_attn.py +906 -0
  50. vllm/attention/ops/paged_attn.py +256 -0
  51. vllm/attention/ops/prefix_prefill.py +902 -0
  52. vllm/attention/ops/rocm_aiter_mla.py +100 -0
  53. vllm/attention/ops/rocm_aiter_paged_attn.py +102 -0
  54. vllm/attention/ops/triton_decode_attention.py +674 -0
  55. vllm/attention/ops/triton_flash_attention.py +979 -0
  56. vllm/attention/ops/triton_merge_attn_states.py +97 -0
  57. vllm/attention/ops/triton_unified_attention.py +334 -0
  58. vllm/attention/selector.py +187 -0
  59. vllm/attention/utils/fa_utils.py +55 -0
  60. vllm/beam_search.py +87 -0
  61. vllm/benchmarks/__init__.py +0 -0
  62. vllm/benchmarks/datasets.py +1185 -0
  63. vllm/benchmarks/endpoint_request_func.py +381 -0
  64. vllm/benchmarks/latency.py +168 -0
  65. vllm/benchmarks/serve.py +1135 -0
  66. vllm/benchmarks/throughput.py +609 -0
  67. vllm/benchmarks/utils.py +70 -0
  68. vllm/collect_env.py +820 -0
  69. vllm/compilation/__init__.py +0 -0
  70. vllm/compilation/activation_quant_fusion.py +89 -0
  71. vllm/compilation/backends.py +563 -0
  72. vllm/compilation/base_piecewise_backend.py +72 -0
  73. vllm/compilation/collective_fusion.py +127 -0
  74. vllm/compilation/compiler_interface.py +544 -0
  75. vllm/compilation/counter.py +38 -0
  76. vllm/compilation/cuda_piecewise_backend.py +214 -0
  77. vllm/compilation/decorators.py +250 -0
  78. vllm/compilation/fix_functionalization.py +191 -0
  79. vllm/compilation/fusion.py +618 -0
  80. vllm/compilation/fx_utils.py +62 -0
  81. vllm/compilation/inductor_pass.py +115 -0
  82. vllm/compilation/monitor.py +39 -0
  83. vllm/compilation/multi_output_match.py +109 -0
  84. vllm/compilation/noop_elimination.py +137 -0
  85. vllm/compilation/pass_manager.py +78 -0
  86. vllm/compilation/sequence_parallelism.py +268 -0
  87. vllm/compilation/torch25_custom_graph_pass.py +42 -0
  88. vllm/compilation/vllm_inductor_pass.py +67 -0
  89. vllm/compilation/wrapper.py +135 -0
  90. vllm/config.py +4746 -0
  91. vllm/connections.py +174 -0
  92. vllm/core/__init__.py +0 -0
  93. vllm/core/block/__init__.py +0 -0
  94. vllm/core/block/block_table.py +399 -0
  95. vllm/core/block/common.py +371 -0
  96. vllm/core/block/cpu_gpu_block_allocator.py +441 -0
  97. vllm/core/block/interfaces.py +319 -0
  98. vllm/core/block/naive_block.py +466 -0
  99. vllm/core/block/prefix_caching_block.py +1135 -0
  100. vllm/core/block/utils.py +28 -0
  101. vllm/core/block_manager.py +521 -0
  102. vllm/core/evictor.py +157 -0
  103. vllm/core/interfaces.py +135 -0
  104. vllm/core/placeholder_block_space_manager.py +100 -0
  105. vllm/core/scheduler.py +2093 -0
  106. vllm/device_allocator/__init__.py +0 -0
  107. vllm/device_allocator/cumem.py +281 -0
  108. vllm/distributed/__init__.py +6 -0
  109. vllm/distributed/communication_op.py +41 -0
  110. vllm/distributed/device_communicators/__init__.py +0 -0
  111. vllm/distributed/device_communicators/all2all.py +264 -0
  112. vllm/distributed/device_communicators/base_device_communicator.py +260 -0
  113. vllm/distributed/device_communicators/cpu_communicator.py +145 -0
  114. vllm/distributed/device_communicators/cuda_communicator.py +176 -0
  115. vllm/distributed/device_communicators/cuda_wrapper.py +180 -0
  116. vllm/distributed/device_communicators/custom_all_reduce.py +304 -0
  117. vllm/distributed/device_communicators/custom_all_reduce_utils.py +259 -0
  118. vllm/distributed/device_communicators/hpu_communicator.py +46 -0
  119. vllm/distributed/device_communicators/neuron_communicator.py +20 -0
  120. vllm/distributed/device_communicators/pynccl.py +218 -0
  121. vllm/distributed/device_communicators/pynccl_wrapper.py +341 -0
  122. vllm/distributed/device_communicators/shm_broadcast.py +585 -0
  123. vllm/distributed/device_communicators/tpu_communicator.py +103 -0
  124. vllm/distributed/device_communicators/xpu_communicator.py +55 -0
  125. vllm/distributed/kv_events.py +356 -0
  126. vllm/distributed/kv_transfer/README.md +29 -0
  127. vllm/distributed/kv_transfer/__init__.py +12 -0
  128. vllm/distributed/kv_transfer/disagg_prefill_workflow.jpg +0 -0
  129. vllm/distributed/kv_transfer/kv_connector/__init__.py +0 -0
  130. vllm/distributed/kv_transfer/kv_connector/base.py +128 -0
  131. vllm/distributed/kv_transfer/kv_connector/factory.py +128 -0
  132. vllm/distributed/kv_transfer/kv_connector/lmcache_connector.py +99 -0
  133. vllm/distributed/kv_transfer/kv_connector/mooncake_store_connector.py +203 -0
  134. vllm/distributed/kv_transfer/kv_connector/simple_connector.py +329 -0
  135. vllm/distributed/kv_transfer/kv_connector/utils.py +108 -0
  136. vllm/distributed/kv_transfer/kv_connector/v1/__init__.py +6 -0
  137. vllm/distributed/kv_transfer/kv_connector/v1/base.py +283 -0
  138. vllm/distributed/kv_transfer/kv_connector/v1/lmcache_connector.py +134 -0
  139. vllm/distributed/kv_transfer/kv_connector/v1/multi_connector.py +201 -0
  140. vllm/distributed/kv_transfer/kv_connector/v1/nixl_connector.py +1030 -0
  141. vllm/distributed/kv_transfer/kv_connector/v1/shared_storage_connector.py +384 -0
  142. vllm/distributed/kv_transfer/kv_connector_agent.py +77 -0
  143. vllm/distributed/kv_transfer/kv_lookup_buffer/__init__.py +0 -0
  144. vllm/distributed/kv_transfer/kv_lookup_buffer/base.py +175 -0
  145. vllm/distributed/kv_transfer/kv_lookup_buffer/mooncake_store.py +161 -0
  146. vllm/distributed/kv_transfer/kv_lookup_buffer/simple_buffer.py +237 -0
  147. vllm/distributed/kv_transfer/kv_pipe/__init__.py +0 -0
  148. vllm/distributed/kv_transfer/kv_pipe/base.py +67 -0
  149. vllm/distributed/kv_transfer/kv_pipe/mooncake_pipe.py +280 -0
  150. vllm/distributed/kv_transfer/kv_pipe/pynccl_pipe.py +280 -0
  151. vllm/distributed/kv_transfer/kv_transfer_state.py +71 -0
  152. vllm/distributed/parallel_state.py +1296 -0
  153. vllm/distributed/tpu_distributed_utils.py +177 -0
  154. vllm/distributed/utils.py +536 -0
  155. vllm/engine/__init__.py +0 -0
  156. vllm/engine/arg_utils.py +1708 -0
  157. vllm/engine/async_llm_engine.py +1200 -0
  158. vllm/engine/async_timeout.py +173 -0
  159. vllm/engine/llm_engine.py +2097 -0
  160. vllm/engine/metrics.py +629 -0
  161. vllm/engine/metrics_types.py +94 -0
  162. vllm/engine/multiprocessing/__init__.py +148 -0
  163. vllm/engine/multiprocessing/client.py +681 -0
  164. vllm/engine/multiprocessing/engine.py +460 -0
  165. vllm/engine/output_processor/__init__.py +0 -0
  166. vllm/engine/output_processor/interfaces.py +75 -0
  167. vllm/engine/output_processor/multi_step.py +216 -0
  168. vllm/engine/output_processor/single_step.py +145 -0
  169. vllm/engine/output_processor/stop_checker.py +131 -0
  170. vllm/engine/output_processor/util.py +28 -0
  171. vllm/engine/protocol.py +317 -0
  172. vllm/entrypoints/__init__.py +0 -0
  173. vllm/entrypoints/api_server.py +178 -0
  174. vllm/entrypoints/chat_utils.py +1299 -0
  175. vllm/entrypoints/cli/__init__.py +0 -0
  176. vllm/entrypoints/cli/benchmark/__init__.py +0 -0
  177. vllm/entrypoints/cli/benchmark/base.py +39 -0
  178. vllm/entrypoints/cli/benchmark/latency.py +30 -0
  179. vllm/entrypoints/cli/benchmark/main.py +54 -0
  180. vllm/entrypoints/cli/benchmark/serve.py +30 -0
  181. vllm/entrypoints/cli/benchmark/throughput.py +30 -0
  182. vllm/entrypoints/cli/collect_env.py +35 -0
  183. vllm/entrypoints/cli/main.py +65 -0
  184. vllm/entrypoints/cli/openai.py +205 -0
  185. vllm/entrypoints/cli/run_batch.py +62 -0
  186. vllm/entrypoints/cli/serve.py +328 -0
  187. vllm/entrypoints/cli/types.py +25 -0
  188. vllm/entrypoints/launcher.py +147 -0
  189. vllm/entrypoints/llm.py +1544 -0
  190. vllm/entrypoints/logger.py +50 -0
  191. vllm/entrypoints/openai/__init__.py +0 -0
  192. vllm/entrypoints/openai/api_server.py +1387 -0
  193. vllm/entrypoints/openai/cli_args.py +315 -0
  194. vllm/entrypoints/openai/logits_processors.py +90 -0
  195. vllm/entrypoints/openai/protocol.py +1913 -0
  196. vllm/entrypoints/openai/run_batch.py +463 -0
  197. vllm/entrypoints/openai/serving_chat.py +1221 -0
  198. vllm/entrypoints/openai/serving_classification.py +160 -0
  199. vllm/entrypoints/openai/serving_completion.py +592 -0
  200. vllm/entrypoints/openai/serving_embedding.py +201 -0
  201. vllm/entrypoints/openai/serving_engine.py +986 -0
  202. vllm/entrypoints/openai/serving_models.py +315 -0
  203. vllm/entrypoints/openai/serving_pooling.py +232 -0
  204. vllm/entrypoints/openai/serving_score.py +433 -0
  205. vllm/entrypoints/openai/serving_tokenization.py +157 -0
  206. vllm/entrypoints/openai/serving_transcription.py +424 -0
  207. vllm/entrypoints/openai/tool_parsers/__init__.py +23 -0
  208. vllm/entrypoints/openai/tool_parsers/abstract_tool_parser.py +164 -0
  209. vllm/entrypoints/openai/tool_parsers/deepseekv3_tool_parser.py +370 -0
  210. vllm/entrypoints/openai/tool_parsers/granite_20b_fc_tool_parser.py +259 -0
  211. vllm/entrypoints/openai/tool_parsers/granite_tool_parser.py +237 -0
  212. vllm/entrypoints/openai/tool_parsers/hermes_tool_parser.py +371 -0
  213. vllm/entrypoints/openai/tool_parsers/internlm2_tool_parser.py +216 -0
  214. vllm/entrypoints/openai/tool_parsers/jamba_tool_parser.py +308 -0
  215. vllm/entrypoints/openai/tool_parsers/llama4_pythonic_tool_parser.py +316 -0
  216. vllm/entrypoints/openai/tool_parsers/llama_tool_parser.py +267 -0
  217. vllm/entrypoints/openai/tool_parsers/mistral_tool_parser.py +369 -0
  218. vllm/entrypoints/openai/tool_parsers/phi4mini_tool_parser.py +112 -0
  219. vllm/entrypoints/openai/tool_parsers/pythonic_tool_parser.py +308 -0
  220. vllm/entrypoints/openai/tool_parsers/utils.py +124 -0
  221. vllm/entrypoints/score_utils.py +50 -0
  222. vllm/entrypoints/ssl.py +75 -0
  223. vllm/entrypoints/utils.py +233 -0
  224. vllm/env_override.py +41 -0
  225. vllm/envs.py +944 -0
  226. vllm/executor/__init__.py +0 -0
  227. vllm/executor/executor_base.py +401 -0
  228. vllm/executor/mp_distributed_executor.py +244 -0
  229. vllm/executor/msgspec_utils.py +30 -0
  230. vllm/executor/multiproc_worker_utils.py +313 -0
  231. vllm/executor/ray_distributed_executor.py +701 -0
  232. vllm/executor/ray_utils.py +399 -0
  233. vllm/executor/uniproc_executor.py +139 -0
  234. vllm/forward_context.py +179 -0
  235. vllm/inputs/__init__.py +41 -0
  236. vllm/inputs/data.py +331 -0
  237. vllm/inputs/parse.py +151 -0
  238. vllm/inputs/preprocess.py +909 -0
  239. vllm/inputs/registry.py +237 -0
  240. vllm/jsontree.py +80 -0
  241. vllm/logger.py +212 -0
  242. vllm/logging_utils/__init__.py +8 -0
  243. vllm/logging_utils/dump_input.py +85 -0
  244. vllm/logging_utils/formatter.py +18 -0
  245. vllm/logits_process.py +119 -0
  246. vllm/lora/__init__.py +0 -0
  247. vllm/lora/fully_sharded_layers.py +355 -0
  248. vllm/lora/layers.py +1285 -0
  249. vllm/lora/lora.py +199 -0
  250. vllm/lora/models.py +818 -0
  251. vllm/lora/ops/__init__.py +0 -0
  252. vllm/lora/ops/torch_ops/__init__.py +16 -0
  253. vllm/lora/ops/torch_ops/lora_ops.py +119 -0
  254. vllm/lora/ops/triton_ops/__init__.py +12 -0
  255. vllm/lora/ops/triton_ops/kernel_utils.py +243 -0
  256. vllm/lora/ops/triton_ops/lora_expand_op.py +290 -0
  257. vllm/lora/ops/triton_ops/lora_kernel_metadata.py +148 -0
  258. vllm/lora/ops/triton_ops/lora_shrink_op.py +244 -0
  259. vllm/lora/ops/triton_ops/utils.py +120 -0
  260. vllm/lora/ops/xla_ops/__init__.py +7 -0
  261. vllm/lora/ops/xla_ops/lora_ops.py +145 -0
  262. vllm/lora/peft_helper.py +136 -0
  263. vllm/lora/punica_wrapper/__init__.py +10 -0
  264. vllm/lora/punica_wrapper/punica_base.py +485 -0
  265. vllm/lora/punica_wrapper/punica_cpu.py +349 -0
  266. vllm/lora/punica_wrapper/punica_gpu.py +290 -0
  267. vllm/lora/punica_wrapper/punica_hpu.py +145 -0
  268. vllm/lora/punica_wrapper/punica_selector.py +20 -0
  269. vllm/lora/punica_wrapper/punica_tpu.py +405 -0
  270. vllm/lora/punica_wrapper/utils.py +164 -0
  271. vllm/lora/request.py +99 -0
  272. vllm/lora/resolver.py +85 -0
  273. vllm/lora/utils.py +240 -0
  274. vllm/lora/worker_manager.py +259 -0
  275. vllm/model_executor/__init__.py +16 -0
  276. vllm/model_executor/custom_op.py +152 -0
  277. vllm/model_executor/guided_decoding/__init__.py +181 -0
  278. vllm/model_executor/guided_decoding/guidance_decoding.py +63 -0
  279. vllm/model_executor/guided_decoding/guidance_logits_processors.py +104 -0
  280. vllm/model_executor/guided_decoding/guided_fields.py +41 -0
  281. vllm/model_executor/guided_decoding/lm_format_enforcer_decoding.py +67 -0
  282. vllm/model_executor/guided_decoding/outlines_decoding.py +155 -0
  283. vllm/model_executor/guided_decoding/outlines_logits_processors.py +284 -0
  284. vllm/model_executor/guided_decoding/utils.py +242 -0
  285. vllm/model_executor/guided_decoding/xgrammar_decoding.py +426 -0
  286. vllm/model_executor/layers/__init__.py +0 -0
  287. vllm/model_executor/layers/activation.py +369 -0
  288. vllm/model_executor/layers/fused_moe/__init__.py +54 -0
  289. vllm/model_executor/layers/fused_moe/batched_deep_gemm_moe.py +125 -0
  290. vllm/model_executor/layers/fused_moe/batched_triton_or_deep_gemm_moe.py +117 -0
  291. vllm/model_executor/layers/fused_moe/configs/E=1,N=14336,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a16.json +146 -0
  292. vllm/model_executor/layers/fused_moe/configs/E=1,N=14336,device_name=NVIDIA_A100-SXM4-80GB.json +146 -0
  293. vllm/model_executor/layers/fused_moe/configs/E=1,N=1792,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a16.json +218 -0
  294. vllm/model_executor/layers/fused_moe/configs/E=1,N=1792,device_name=NVIDIA_A100-SXM4-80GB.json +218 -0
  295. vllm/model_executor/layers/fused_moe/configs/E=1,N=3072,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a16.json +218 -0
  296. vllm/model_executor/layers/fused_moe/configs/E=1,N=3072,device_name=NVIDIA_H100_80GB_HBM3,dtype=int8_w8a16.json +218 -0
  297. vllm/model_executor/layers/fused_moe/configs/E=1,N=3072,device_name=NVIDIA_H100_80GB_HBM3.json +218 -0
  298. vllm/model_executor/layers/fused_moe/configs/E=1,N=3584,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a16.json +218 -0
  299. vllm/model_executor/layers/fused_moe/configs/E=1,N=3584,device_name=NVIDIA_A100-SXM4-80GB.json +218 -0
  300. vllm/model_executor/layers/fused_moe/configs/E=1,N=7168,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a16.json +218 -0
  301. vllm/model_executor/layers/fused_moe/configs/E=1,N=7168,device_name=NVIDIA_A100-SXM4-80GB.json +218 -0
  302. vllm/model_executor/layers/fused_moe/configs/E=128,N=1024,device_name=AMD_Instinct_MI300X,dtype=fp8_w8a8.json +164 -0
  303. vllm/model_executor/layers/fused_moe/configs/E=128,N=1024,device_name=AMD_Instinct_MI300X.json +200 -0
  304. vllm/model_executor/layers/fused_moe/configs/E=128,N=192,device_name=NVIDIA_A100-SXM4-80GB.json +146 -0
  305. vllm/model_executor/layers/fused_moe/configs/E=128,N=192,device_name=NVIDIA_H100_80GB_HBM3.json +146 -0
  306. vllm/model_executor/layers/fused_moe/configs/E=128,N=192,device_name=NVIDIA_H20-3e.json +146 -0
  307. vllm/model_executor/layers/fused_moe/configs/E=128,N=192,device_name=NVIDIA_H20.json +146 -0
  308. vllm/model_executor/layers/fused_moe/configs/E=128,N=192,device_name=NVIDIA_H200.json +146 -0
  309. 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
  310. 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
  311. vllm/model_executor/layers/fused_moe/configs/E=128,N=384,device_name=NVIDIA_H20-3e.json +146 -0
  312. vllm/model_executor/layers/fused_moe/configs/E=128,N=384,device_name=NVIDIA_H20.json +146 -0
  313. 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
  314. vllm/model_executor/layers/fused_moe/configs/E=128,N=384,device_name=NVIDIA_H200.json +146 -0
  315. vllm/model_executor/layers/fused_moe/configs/E=128,N=512,device_name=NVIDIA_H100_80GB_HBM3.json +146 -0
  316. 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
  317. 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
  318. vllm/model_executor/layers/fused_moe/configs/E=128,N=768,device_name=NVIDIA_H20.json +146 -0
  319. 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
  320. vllm/model_executor/layers/fused_moe/configs/E=128,N=768,device_name=NVIDIA_H200.json +146 -0
  321. vllm/model_executor/layers/fused_moe/configs/E=128,N=96,device_name=NVIDIA_H20.json +146 -0
  322. vllm/model_executor/layers/fused_moe/configs/E=16,N=1024,device_name=AMD_Instinct_MI300X.json +200 -0
  323. vllm/model_executor/layers/fused_moe/configs/E=16,N=1024,device_name=NVIDIA_H100.json +146 -0
  324. vllm/model_executor/layers/fused_moe/configs/E=16,N=1344,device_name=NVIDIA_A100-SXM4-40GB.json +146 -0
  325. vllm/model_executor/layers/fused_moe/configs/E=16,N=1344,device_name=NVIDIA_A100-SXM4-80GB.json +146 -0
  326. vllm/model_executor/layers/fused_moe/configs/E=16,N=1344,device_name=NVIDIA_H100_80GB_HBM3.json +146 -0
  327. vllm/model_executor/layers/fused_moe/configs/E=16,N=14336,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a16.json +146 -0
  328. vllm/model_executor/layers/fused_moe/configs/E=16,N=14336,device_name=NVIDIA_A100-SXM4-80GB.json +146 -0
  329. vllm/model_executor/layers/fused_moe/configs/E=16,N=1792,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a16.json +218 -0
  330. vllm/model_executor/layers/fused_moe/configs/E=16,N=1792,device_name=NVIDIA_A100-SXM4-80GB.json +218 -0
  331. vllm/model_executor/layers/fused_moe/configs/E=16,N=2688,device_name=NVIDIA_A100-SXM4-80GB.json +146 -0
  332. vllm/model_executor/layers/fused_moe/configs/E=16,N=2688,device_name=NVIDIA_H100_80GB_HBM3.json +146 -0
  333. vllm/model_executor/layers/fused_moe/configs/E=16,N=3072,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a16.json +146 -0
  334. vllm/model_executor/layers/fused_moe/configs/E=16,N=3072,device_name=NVIDIA_H100_80GB_HBM3,dtype=int8_w8a16.json +146 -0
  335. vllm/model_executor/layers/fused_moe/configs/E=16,N=3200,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8.json +130 -0
  336. vllm/model_executor/layers/fused_moe/configs/E=16,N=3584,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a16.json +146 -0
  337. vllm/model_executor/layers/fused_moe/configs/E=16,N=3584,device_name=NVIDIA_A100-SXM4-80GB.json +218 -0
  338. vllm/model_executor/layers/fused_moe/configs/E=16,N=6400,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8.json +130 -0
  339. vllm/model_executor/layers/fused_moe/configs/E=16,N=7168,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a16.json +146 -0
  340. vllm/model_executor/layers/fused_moe/configs/E=16,N=7168,device_name=NVIDIA_A100-SXM4-80GB.json +146 -0
  341. vllm/model_executor/layers/fused_moe/configs/E=16,N=7168,device_name=NVIDIA_H100_80GB_HBM3,dtype=int8_w8a16.json +146 -0
  342. vllm/model_executor/layers/fused_moe/configs/E=16,N=800,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8.json +130 -0
  343. vllm/model_executor/layers/fused_moe/configs/E=160,N=192,device_name=NVIDIA_A800-SXM4-80GB.json +146 -0
  344. vllm/model_executor/layers/fused_moe/configs/E=256,N=1024,device_name=AMD_Instinct_MI325X,block_shape=[128,128].json +200 -0
  345. 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
  346. 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
  347. vllm/model_executor/layers/fused_moe/configs/E=256,N=128,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a8.json +146 -0
  348. 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
  349. vllm/model_executor/layers/fused_moe/configs/E=256,N=128,device_name=NVIDIA_A800-SXM4-80GB,dtype=int8_w8a8.json +146 -0
  350. 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
  351. 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
  352. 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
  353. 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
  354. 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
  355. 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
  356. 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
  357. 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
  358. 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
  359. 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
  360. 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
  361. 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
  362. 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
  363. vllm/model_executor/layers/fused_moe/configs/E=256,N=64,device_name=NVIDIA_A800-SXM4-80GB.json +146 -0
  364. vllm/model_executor/layers/fused_moe/configs/E=60,N=1408,device_name=AMD_Instinct_MI300X.json +200 -0
  365. vllm/model_executor/layers/fused_moe/configs/E=60,N=176,device_name=AMD_Instinct_MI300X.json +200 -0
  366. vllm/model_executor/layers/fused_moe/configs/E=60,N=352,device_name=AMD_Instinct_MI300X.json +200 -0
  367. vllm/model_executor/layers/fused_moe/configs/E=60,N=704,device_name=AMD_Instinct_MI300X.json +200 -0
  368. vllm/model_executor/layers/fused_moe/configs/E=64,N=1280,device_name=NVIDIA_A100-SXM4-80GB.json +146 -0
  369. vllm/model_executor/layers/fused_moe/configs/E=64,N=1280,device_name=NVIDIA_A800-SXM4-80GB.json +146 -0
  370. vllm/model_executor/layers/fused_moe/configs/E=64,N=1280,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8.json +146 -0
  371. vllm/model_executor/layers/fused_moe/configs/E=64,N=1280,device_name=NVIDIA_H100_80GB_HBM3.json +146 -0
  372. vllm/model_executor/layers/fused_moe/configs/E=64,N=1280,device_name=NVIDIA_H200,dtype=fp8_w8a8.json +146 -0
  373. vllm/model_executor/layers/fused_moe/configs/E=64,N=1280,device_name=NVIDIA_H200.json +146 -0
  374. vllm/model_executor/layers/fused_moe/configs/E=64,N=2560,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8.json +146 -0
  375. vllm/model_executor/layers/fused_moe/configs/E=64,N=2560,device_name=NVIDIA_H200,dtype=fp8_w8a8.json +146 -0
  376. vllm/model_executor/layers/fused_moe/configs/E=64,N=2560,device_name=NVIDIA_H200.json +146 -0
  377. vllm/model_executor/layers/fused_moe/configs/E=64,N=320,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8.json +146 -0
  378. vllm/model_executor/layers/fused_moe/configs/E=64,N=320,device_name=NVIDIA_H100_80GB_HBM3.json +146 -0
  379. vllm/model_executor/layers/fused_moe/configs/E=64,N=320,device_name=NVIDIA_H200,dtype=fp8_w8a8.json +146 -0
  380. vllm/model_executor/layers/fused_moe/configs/E=64,N=320,device_name=NVIDIA_H200.json +146 -0
  381. vllm/model_executor/layers/fused_moe/configs/E=64,N=640,device_name=NVIDIA_A100-SXM4-80GB.json +146 -0
  382. vllm/model_executor/layers/fused_moe/configs/E=64,N=640,device_name=NVIDIA_A800-SXM4-80GB.json +146 -0
  383. vllm/model_executor/layers/fused_moe/configs/E=64,N=640,device_name=NVIDIA_GeForce_RTX_4090,dtype=fp8_w8a8.json +146 -0
  384. vllm/model_executor/layers/fused_moe/configs/E=64,N=640,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8.json +146 -0
  385. vllm/model_executor/layers/fused_moe/configs/E=64,N=640,device_name=NVIDIA_H100_80GB_HBM3.json +146 -0
  386. vllm/model_executor/layers/fused_moe/configs/E=64,N=640,device_name=NVIDIA_H200,dtype=fp8_w8a8.json +146 -0
  387. vllm/model_executor/layers/fused_moe/configs/E=64,N=640,device_name=NVIDIA_H200.json +146 -0
  388. vllm/model_executor/layers/fused_moe/configs/E=64,N=896,device_name=NVIDIA_H20.json +146 -0
  389. vllm/model_executor/layers/fused_moe/configs/E=8,N=14336,device_name=AMD_Instinct_MI300X,dtype=fp8_w8a8.json +164 -0
  390. vllm/model_executor/layers/fused_moe/configs/E=8,N=14336,device_name=AMD_Instinct_MI300X.json +200 -0
  391. vllm/model_executor/layers/fused_moe/configs/E=8,N=14336,device_name=AMD_Instinct_MI325X,dtype=fp8_w8a8.json +164 -0
  392. vllm/model_executor/layers/fused_moe/configs/E=8,N=14336,device_name=AMD_Instinct_MI325X.json +200 -0
  393. vllm/model_executor/layers/fused_moe/configs/E=8,N=14336,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8.json +138 -0
  394. vllm/model_executor/layers/fused_moe/configs/E=8,N=14336,device_name=NVIDIA_H200,dtype=fp8_w8a8.json +146 -0
  395. vllm/model_executor/layers/fused_moe/configs/E=8,N=14336,device_name=NVIDIA_H200.json +146 -0
  396. vllm/model_executor/layers/fused_moe/configs/E=8,N=16384,device_name=AMD_Instinct_MI300X,dtype=fp8_w8a8.json +164 -0
  397. vllm/model_executor/layers/fused_moe/configs/E=8,N=16384,device_name=AMD_Instinct_MI300X.json +200 -0
  398. vllm/model_executor/layers/fused_moe/configs/E=8,N=16384,device_name=AMD_Instinct_MI325X,dtype=fp8_w8a8.json +164 -0
  399. vllm/model_executor/layers/fused_moe/configs/E=8,N=16384,device_name=AMD_Instinct_MI325X.json +200 -0
  400. vllm/model_executor/layers/fused_moe/configs/E=8,N=1792,device_name=AMD_Instinct_MI300X,dtype=fp8_w8a8.json +164 -0
  401. vllm/model_executor/layers/fused_moe/configs/E=8,N=1792,device_name=AMD_Instinct_MI300X.json +200 -0
  402. vllm/model_executor/layers/fused_moe/configs/E=8,N=1792,device_name=AMD_Instinct_MI325X,dtype=fp8_w8a8.json +164 -0
  403. vllm/model_executor/layers/fused_moe/configs/E=8,N=1792,device_name=AMD_Instinct_MI325X.json +200 -0
  404. vllm/model_executor/layers/fused_moe/configs/E=8,N=1792,device_name=NVIDIA_A100-SXM4-40GB.json +146 -0
  405. vllm/model_executor/layers/fused_moe/configs/E=8,N=1792,device_name=NVIDIA_A100-SXM4-80GB.json +146 -0
  406. vllm/model_executor/layers/fused_moe/configs/E=8,N=1792,device_name=NVIDIA_H100_80GB_HBM3.json +146 -0
  407. vllm/model_executor/layers/fused_moe/configs/E=8,N=1792,device_name=NVIDIA_H200,dtype=fp8_w8a8.json +146 -0
  408. vllm/model_executor/layers/fused_moe/configs/E=8,N=1792,device_name=NVIDIA_H200.json +146 -0
  409. vllm/model_executor/layers/fused_moe/configs/E=8,N=2048,device_name=AMD_Instinct_MI300X,dtype=fp8_w8a8.json +164 -0
  410. vllm/model_executor/layers/fused_moe/configs/E=8,N=2048,device_name=AMD_Instinct_MI300X.json +200 -0
  411. vllm/model_executor/layers/fused_moe/configs/E=8,N=2048,device_name=AMD_Instinct_MI325X,dtype=fp8_w8a8.json +164 -0
  412. vllm/model_executor/layers/fused_moe/configs/E=8,N=2048,device_name=AMD_Instinct_MI325X.json +200 -0
  413. vllm/model_executor/layers/fused_moe/configs/E=8,N=2048,device_name=NVIDIA_A100-SXM4-80GB.json +146 -0
  414. vllm/model_executor/layers/fused_moe/configs/E=8,N=2048,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8.json +146 -0
  415. vllm/model_executor/layers/fused_moe/configs/E=8,N=2048,device_name=NVIDIA_H100_80GB_HBM3.json +146 -0
  416. vllm/model_executor/layers/fused_moe/configs/E=8,N=2048,device_name=NVIDIA_H200,dtype=fp8_w8a8.json +146 -0
  417. vllm/model_executor/layers/fused_moe/configs/E=8,N=2048,device_name=NVIDIA_H200.json +146 -0
  418. vllm/model_executor/layers/fused_moe/configs/E=8,N=3584,device_name=AMD_Instinct_MI300X,dtype=fp8_w8a8.json +164 -0
  419. vllm/model_executor/layers/fused_moe/configs/E=8,N=3584,device_name=AMD_Instinct_MI300X.json +200 -0
  420. vllm/model_executor/layers/fused_moe/configs/E=8,N=3584,device_name=AMD_Instinct_MI325X,dtype=fp8_w8a8.json +164 -0
  421. vllm/model_executor/layers/fused_moe/configs/E=8,N=3584,device_name=AMD_Instinct_MI325X.json +200 -0
  422. vllm/model_executor/layers/fused_moe/configs/E=8,N=3584,device_name=NVIDIA_A100-SXM4-40GB.json +146 -0
  423. vllm/model_executor/layers/fused_moe/configs/E=8,N=3584,device_name=NVIDIA_A100-SXM4-80GB.json +146 -0
  424. vllm/model_executor/layers/fused_moe/configs/E=8,N=3584,device_name=NVIDIA_GeForce_RTX_4090,dtype=fp8_w8a8.json +146 -0
  425. vllm/model_executor/layers/fused_moe/configs/E=8,N=3584,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8.json +146 -0
  426. vllm/model_executor/layers/fused_moe/configs/E=8,N=3584,device_name=NVIDIA_H100_80GB_HBM3.json +146 -0
  427. vllm/model_executor/layers/fused_moe/configs/E=8,N=3584,device_name=NVIDIA_H200,dtype=fp8_w8a8.json +146 -0
  428. vllm/model_executor/layers/fused_moe/configs/E=8,N=3584,device_name=NVIDIA_H200.json +146 -0
  429. vllm/model_executor/layers/fused_moe/configs/E=8,N=3584,device_name=NVIDIA_L40S.json +173 -0
  430. vllm/model_executor/layers/fused_moe/configs/E=8,N=4096,device_name=AMD_Instinct_MI300X,dtype=fp8_w8a8.json +164 -0
  431. vllm/model_executor/layers/fused_moe/configs/E=8,N=4096,device_name=AMD_Instinct_MI300X.json +200 -0
  432. vllm/model_executor/layers/fused_moe/configs/E=8,N=4096,device_name=AMD_Instinct_MI325X,dtype=fp8_w8a8.json +164 -0
  433. vllm/model_executor/layers/fused_moe/configs/E=8,N=4096,device_name=AMD_Instinct_MI325X.json +200 -0
  434. vllm/model_executor/layers/fused_moe/configs/E=8,N=4096,device_name=NVIDIA_A100-SXM4-80GB.json +146 -0
  435. vllm/model_executor/layers/fused_moe/configs/E=8,N=4096,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8.json +146 -0
  436. vllm/model_executor/layers/fused_moe/configs/E=8,N=4096,device_name=NVIDIA_H100_80GB_HBM3.json +146 -0
  437. vllm/model_executor/layers/fused_moe/configs/E=8,N=4096,device_name=NVIDIA_H200,dtype=fp8_w8a8.json +146 -0
  438. vllm/model_executor/layers/fused_moe/configs/E=8,N=4096,device_name=NVIDIA_H200.json +146 -0
  439. vllm/model_executor/layers/fused_moe/configs/E=8,N=7168,device_name=AMD_Instinct_MI300X,dtype=fp8_w8a8.json +164 -0
  440. vllm/model_executor/layers/fused_moe/configs/E=8,N=7168,device_name=AMD_Instinct_MI300X.json +200 -0
  441. vllm/model_executor/layers/fused_moe/configs/E=8,N=7168,device_name=AMD_Instinct_MI325X,dtype=fp8_w8a8.json +164 -0
  442. vllm/model_executor/layers/fused_moe/configs/E=8,N=7168,device_name=AMD_Instinct_MI325X.json +200 -0
  443. vllm/model_executor/layers/fused_moe/configs/E=8,N=7168,device_name=NVIDIA_A100-SXM4-80GB.json +146 -0
  444. vllm/model_executor/layers/fused_moe/configs/E=8,N=7168,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8.json +146 -0
  445. vllm/model_executor/layers/fused_moe/configs/E=8,N=7168,device_name=NVIDIA_H100_80GB_HBM3.json +146 -0
  446. vllm/model_executor/layers/fused_moe/configs/E=8,N=7168,device_name=NVIDIA_H200,dtype=fp8_w8a8.json +146 -0
  447. vllm/model_executor/layers/fused_moe/configs/E=8,N=7168,device_name=NVIDIA_H200.json +146 -0
  448. vllm/model_executor/layers/fused_moe/configs/E=8,N=8192,device_name=AMD_Instinct_MI300X,dtype=fp8_w8a8.json +164 -0
  449. vllm/model_executor/layers/fused_moe/configs/E=8,N=8192,device_name=AMD_Instinct_MI300X.json +200 -0
  450. vllm/model_executor/layers/fused_moe/configs/E=8,N=8192,device_name=AMD_Instinct_MI325X,dtype=fp8_w8a8.json +164 -0
  451. vllm/model_executor/layers/fused_moe/configs/E=8,N=8192,device_name=AMD_Instinct_MI325X.json +200 -0
  452. vllm/model_executor/layers/fused_moe/configs/E=8,N=8192,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8.json +146 -0
  453. vllm/model_executor/layers/fused_moe/configs/E=8,N=8192,device_name=NVIDIA_H200,dtype=fp8_w8a8.json +146 -0
  454. vllm/model_executor/layers/fused_moe/configs/README +12 -0
  455. vllm/model_executor/layers/fused_moe/cutlass_moe.py +461 -0
  456. vllm/model_executor/layers/fused_moe/deep_gemm_moe.py +240 -0
  457. vllm/model_executor/layers/fused_moe/deepep_ht_prepare_finalize.py +240 -0
  458. vllm/model_executor/layers/fused_moe/deepep_ll_prepare_finalize.py +186 -0
  459. vllm/model_executor/layers/fused_moe/fused_batched_moe.py +775 -0
  460. vllm/model_executor/layers/fused_moe/fused_marlin_moe.py +232 -0
  461. vllm/model_executor/layers/fused_moe/fused_moe.py +1724 -0
  462. vllm/model_executor/layers/fused_moe/layer.py +1535 -0
  463. vllm/model_executor/layers/fused_moe/modular_kernel.py +446 -0
  464. vllm/model_executor/layers/fused_moe/moe_align_block_size.py +243 -0
  465. vllm/model_executor/layers/fused_moe/moe_pallas.py +80 -0
  466. vllm/model_executor/layers/fused_moe/moe_permute_unpermute.py +190 -0
  467. vllm/model_executor/layers/fused_moe/moe_torch_iterative.py +60 -0
  468. vllm/model_executor/layers/fused_moe/pplx_prepare_finalize.py +159 -0
  469. vllm/model_executor/layers/fused_moe/prepare_finalize.py +69 -0
  470. vllm/model_executor/layers/fused_moe/rocm_aiter_fused_moe.py +421 -0
  471. vllm/model_executor/layers/fused_moe/triton_deep_gemm_moe.py +117 -0
  472. vllm/model_executor/layers/fused_moe/utils.py +98 -0
  473. vllm/model_executor/layers/layernorm.py +288 -0
  474. vllm/model_executor/layers/lightning_attn.py +652 -0
  475. vllm/model_executor/layers/linear.py +1524 -0
  476. vllm/model_executor/layers/logits_processor.py +197 -0
  477. vllm/model_executor/layers/mamba/__init__.py +0 -0
  478. vllm/model_executor/layers/mamba/mamba2_metadata.py +125 -0
  479. vllm/model_executor/layers/mamba/mamba_mixer.py +245 -0
  480. vllm/model_executor/layers/mamba/mamba_mixer2.py +616 -0
  481. vllm/model_executor/layers/mamba/ops/__init__.py +0 -0
  482. vllm/model_executor/layers/mamba/ops/causal_conv1d.py +105 -0
  483. vllm/model_executor/layers/mamba/ops/mamba_ssm.py +414 -0
  484. vllm/model_executor/layers/mamba/ops/ssd_bmm.py +262 -0
  485. vllm/model_executor/layers/mamba/ops/ssd_chunk_scan.py +589 -0
  486. vllm/model_executor/layers/mamba/ops/ssd_chunk_state.py +751 -0
  487. vllm/model_executor/layers/mamba/ops/ssd_combined.py +232 -0
  488. vllm/model_executor/layers/mamba/ops/ssd_state_passing.py +206 -0
  489. vllm/model_executor/layers/pooler.py +350 -0
  490. vllm/model_executor/layers/quantization/__init__.py +157 -0
  491. vllm/model_executor/layers/quantization/aqlm.py +376 -0
  492. vllm/model_executor/layers/quantization/auto_round.py +310 -0
  493. vllm/model_executor/layers/quantization/awq.py +194 -0
  494. vllm/model_executor/layers/quantization/awq_marlin.py +519 -0
  495. vllm/model_executor/layers/quantization/awq_triton.py +320 -0
  496. vllm/model_executor/layers/quantization/base_config.py +151 -0
  497. vllm/model_executor/layers/quantization/bitblas.py +461 -0
  498. vllm/model_executor/layers/quantization/bitsandbytes.py +396 -0
  499. vllm/model_executor/layers/quantization/compressed_tensors/__init__.py +0 -0
  500. vllm/model_executor/layers/quantization/compressed_tensors/compressed_tensors.py +668 -0
  501. vllm/model_executor/layers/quantization/compressed_tensors/compressed_tensors_moe.py +1260 -0
  502. vllm/model_executor/layers/quantization/compressed_tensors/schemes/__init__.py +24 -0
  503. vllm/model_executor/layers/quantization/compressed_tensors/schemes/compressed_tensors_24.py +358 -0
  504. vllm/model_executor/layers/quantization/compressed_tensors/schemes/compressed_tensors_scheme.py +55 -0
  505. vllm/model_executor/layers/quantization/compressed_tensors/schemes/compressed_tensors_w4a16_24.py +160 -0
  506. vllm/model_executor/layers/quantization/compressed_tensors/schemes/compressed_tensors_w4a16_nvfp4.py +93 -0
  507. vllm/model_executor/layers/quantization/compressed_tensors/schemes/compressed_tensors_w4a4_nvfp4.py +178 -0
  508. vllm/model_executor/layers/quantization/compressed_tensors/schemes/compressed_tensors_w8a16_fp8.py +121 -0
  509. vllm/model_executor/layers/quantization/compressed_tensors/schemes/compressed_tensors_w8a8_fp8.py +150 -0
  510. vllm/model_executor/layers/quantization/compressed_tensors/schemes/compressed_tensors_w8a8_int8.py +111 -0
  511. vllm/model_executor/layers/quantization/compressed_tensors/schemes/compressed_tensors_wNa16.py +201 -0
  512. vllm/model_executor/layers/quantization/compressed_tensors/triton_scaled_mm.py +206 -0
  513. vllm/model_executor/layers/quantization/compressed_tensors/utils.py +216 -0
  514. vllm/model_executor/layers/quantization/deepspeedfp.py +195 -0
  515. vllm/model_executor/layers/quantization/experts_int8.py +196 -0
  516. vllm/model_executor/layers/quantization/fbgemm_fp8.py +172 -0
  517. vllm/model_executor/layers/quantization/fp8.py +906 -0
  518. vllm/model_executor/layers/quantization/gguf.py +565 -0
  519. vllm/model_executor/layers/quantization/gptq.py +278 -0
  520. vllm/model_executor/layers/quantization/gptq_bitblas.py +445 -0
  521. vllm/model_executor/layers/quantization/gptq_marlin.py +648 -0
  522. vllm/model_executor/layers/quantization/gptq_marlin_24.py +297 -0
  523. vllm/model_executor/layers/quantization/hqq_marlin.py +332 -0
  524. vllm/model_executor/layers/quantization/ipex_quant.py +250 -0
  525. vllm/model_executor/layers/quantization/kernels/__init__.py +0 -0
  526. vllm/model_executor/layers/quantization/kernels/mixed_precision/MPLinearKernel.py +90 -0
  527. vllm/model_executor/layers/quantization/kernels/mixed_precision/__init__.py +83 -0
  528. vllm/model_executor/layers/quantization/kernels/mixed_precision/allspark.py +116 -0
  529. vllm/model_executor/layers/quantization/kernels/mixed_precision/bitblas.py +300 -0
  530. vllm/model_executor/layers/quantization/kernels/mixed_precision/exllama.py +143 -0
  531. vllm/model_executor/layers/quantization/kernels/mixed_precision/machete.py +120 -0
  532. vllm/model_executor/layers/quantization/kernels/mixed_precision/marlin.py +131 -0
  533. vllm/model_executor/layers/quantization/kernels/scaled_mm/ScaledMMLinearKernel.py +67 -0
  534. vllm/model_executor/layers/quantization/kernels/scaled_mm/__init__.py +87 -0
  535. vllm/model_executor/layers/quantization/kernels/scaled_mm/aiter.py +120 -0
  536. vllm/model_executor/layers/quantization/kernels/scaled_mm/cutlass.py +137 -0
  537. vllm/model_executor/layers/quantization/kernels/scaled_mm/triton.py +41 -0
  538. vllm/model_executor/layers/quantization/kernels/scaled_mm/xla.py +105 -0
  539. vllm/model_executor/layers/quantization/kv_cache.py +139 -0
  540. vllm/model_executor/layers/quantization/marlin.py +261 -0
  541. vllm/model_executor/layers/quantization/modelopt.py +737 -0
  542. vllm/model_executor/layers/quantization/moe_wna16.py +449 -0
  543. vllm/model_executor/layers/quantization/neuron_quant.py +76 -0
  544. vllm/model_executor/layers/quantization/ptpc_fp8.py +127 -0
  545. vllm/model_executor/layers/quantization/qqq.py +275 -0
  546. vllm/model_executor/layers/quantization/quark/__init__.py +0 -0
  547. vllm/model_executor/layers/quantization/quark/quark.py +441 -0
  548. vllm/model_executor/layers/quantization/quark/quark_moe.py +237 -0
  549. vllm/model_executor/layers/quantization/quark/schemes/__init__.py +9 -0
  550. vllm/model_executor/layers/quantization/quark/schemes/quark_scheme.py +55 -0
  551. vllm/model_executor/layers/quantization/quark/schemes/quark_w4a4_mxfp4.py +126 -0
  552. vllm/model_executor/layers/quantization/quark/schemes/quark_w8a8_fp8.py +146 -0
  553. vllm/model_executor/layers/quantization/quark/schemes/quark_w8a8_int8.py +122 -0
  554. vllm/model_executor/layers/quantization/quark/utils.py +105 -0
  555. vllm/model_executor/layers/quantization/schema.py +86 -0
  556. vllm/model_executor/layers/quantization/torchao.py +161 -0
  557. vllm/model_executor/layers/quantization/tpu_int8.py +121 -0
  558. vllm/model_executor/layers/quantization/utils/__init__.py +6 -0
  559. vllm/model_executor/layers/quantization/utils/allspark_utils.py +52 -0
  560. vllm/model_executor/layers/quantization/utils/bitblas_utils.py +208 -0
  561. 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
  562. 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
  563. 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
  564. 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
  565. 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
  566. 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
  567. 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
  568. 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
  569. 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
  570. 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
  571. 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
  572. 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
  573. 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
  574. 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
  575. 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
  576. 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
  577. 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
  578. 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
  579. 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
  580. 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
  581. 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
  582. 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
  583. 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
  584. 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
  585. 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
  586. 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
  587. 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
  588. 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
  589. 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
  590. 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
  591. 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
  592. 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
  593. 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
  594. 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
  595. 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
  596. 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
  597. 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
  598. 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
  599. 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
  600. 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
  601. 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
  602. 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
  603. 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
  604. 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
  605. 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
  606. 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
  607. 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
  608. 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
  609. 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
  610. 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
  611. 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
  612. 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
  613. 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
  614. 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
  615. 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
  616. 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
  617. 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
  618. 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
  619. 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
  620. 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
  621. 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
  622. 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
  623. 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
  624. 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
  625. 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
  626. 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
  627. 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
  628. 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
  629. 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
  630. 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
  631. 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
  632. 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
  633. 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
  634. 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
  635. 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
  636. 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
  637. 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
  638. 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
  639. 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
  640. 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
  641. 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
  642. 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
  643. 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
  644. 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
  645. 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
  646. 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
  647. 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
  648. 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
  649. 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
  650. 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
  651. 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
  652. 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
  653. 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
  654. 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
  655. 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
  656. 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
  657. 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
  658. 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
  659. 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
  660. 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
  661. 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
  662. 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
  663. 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
  664. 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
  665. 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
  666. 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
  667. 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
  668. 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
  669. 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
  670. 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
  671. 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
  672. 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
  673. 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
  674. 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
  675. 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
  676. 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
  677. 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
  678. 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
  679. 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
  680. 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
  681. 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
  682. 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
  683. 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
  684. 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
  685. 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
  686. 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
  687. 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
  688. 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
  689. 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
  690. 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
  691. 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
  692. 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
  693. 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
  694. 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
  695. 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
  696. 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
  697. 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
  698. 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
  699. 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
  700. 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
  701. 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
  702. 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
  703. 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
  704. 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
  705. 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
  706. 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
  707. 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
  708. 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
  709. 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
  710. 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
  711. 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
  712. 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
  713. 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
  714. 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
  715. 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
  716. 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
  717. 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
  718. 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
  719. 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
  720. 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
  721. 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
  722. 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
  723. 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
  724. 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
  725. 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
  726. 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
  727. 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
  728. 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
  729. 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
  730. 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
  731. 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
  732. 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
  733. 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
  734. 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
  735. 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
  736. 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
  737. 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
  738. 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
  739. 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
  740. 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
  741. 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
  742. 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
  743. 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
  744. 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
  745. 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
  746. 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
  747. 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
  748. 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
  749. 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
  750. 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
  751. 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
  752. 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
  753. 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
  754. 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
  755. 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
  756. 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
  757. 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
  758. 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
  759. 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
  760. 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
  761. 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
  762. 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
  763. vllm/model_executor/layers/quantization/utils/fp8_utils.py +618 -0
  764. vllm/model_executor/layers/quantization/utils/gptq_utils.py +95 -0
  765. vllm/model_executor/layers/quantization/utils/int8_utils.py +485 -0
  766. vllm/model_executor/layers/quantization/utils/layer_utils.py +40 -0
  767. vllm/model_executor/layers/quantization/utils/machete_utils.py +33 -0
  768. vllm/model_executor/layers/quantization/utils/marlin_utils.py +476 -0
  769. vllm/model_executor/layers/quantization/utils/marlin_utils_fp4.py +283 -0
  770. vllm/model_executor/layers/quantization/utils/marlin_utils_fp8.py +325 -0
  771. vllm/model_executor/layers/quantization/utils/marlin_utils_test.py +165 -0
  772. vllm/model_executor/layers/quantization/utils/marlin_utils_test_24.py +464 -0
  773. vllm/model_executor/layers/quantization/utils/marlin_utils_test_qqq.py +126 -0
  774. vllm/model_executor/layers/quantization/utils/mxfp4_utils.py +45 -0
  775. vllm/model_executor/layers/quantization/utils/nvfp4_emulation_utils.py +104 -0
  776. vllm/model_executor/layers/quantization/utils/quant_utils.py +573 -0
  777. vllm/model_executor/layers/quantization/utils/w8a8_utils.py +405 -0
  778. vllm/model_executor/layers/rejection_sampler.py +406 -0
  779. vllm/model_executor/layers/resampler.py +270 -0
  780. vllm/model_executor/layers/rotary_embedding.py +1862 -0
  781. vllm/model_executor/layers/sampler.py +1204 -0
  782. vllm/model_executor/layers/spec_decode_base_sampler.py +259 -0
  783. vllm/model_executor/layers/typical_acceptance_sampler.py +166 -0
  784. vllm/model_executor/layers/utils.py +95 -0
  785. vllm/model_executor/layers/vocab_parallel_embedding.py +487 -0
  786. vllm/model_executor/model_loader/__init__.py +76 -0
  787. vllm/model_executor/model_loader/base_loader.py +43 -0
  788. vllm/model_executor/model_loader/bitsandbytes_loader.py +570 -0
  789. vllm/model_executor/model_loader/default_loader.py +282 -0
  790. vllm/model_executor/model_loader/dummy_loader.py +27 -0
  791. vllm/model_executor/model_loader/gguf_loader.py +120 -0
  792. vllm/model_executor/model_loader/neuron.py +476 -0
  793. vllm/model_executor/model_loader/neuronx_distributed.py +685 -0
  794. vllm/model_executor/model_loader/runai_streamer_loader.py +109 -0
  795. vllm/model_executor/model_loader/sharded_state_loader.py +201 -0
  796. vllm/model_executor/model_loader/tensorizer.py +600 -0
  797. vllm/model_executor/model_loader/tensorizer_loader.py +123 -0
  798. vllm/model_executor/model_loader/tpu.py +112 -0
  799. vllm/model_executor/model_loader/utils.py +302 -0
  800. vllm/model_executor/model_loader/weight_utils.py +782 -0
  801. vllm/model_executor/models/__init__.py +28 -0
  802. vllm/model_executor/models/adapters.py +248 -0
  803. vllm/model_executor/models/aimv2.py +246 -0
  804. vllm/model_executor/models/arctic.py +559 -0
  805. vllm/model_executor/models/aria.py +657 -0
  806. vllm/model_executor/models/aya_vision.py +466 -0
  807. vllm/model_executor/models/baichuan.py +474 -0
  808. vllm/model_executor/models/bamba.py +543 -0
  809. vllm/model_executor/models/bart.py +938 -0
  810. vllm/model_executor/models/bert.py +523 -0
  811. vllm/model_executor/models/bert_with_rope.py +769 -0
  812. vllm/model_executor/models/blip.py +339 -0
  813. vllm/model_executor/models/blip2.py +718 -0
  814. vllm/model_executor/models/bloom.py +373 -0
  815. vllm/model_executor/models/chameleon.py +1136 -0
  816. vllm/model_executor/models/chatglm.py +478 -0
  817. vllm/model_executor/models/clip.py +407 -0
  818. vllm/model_executor/models/commandr.py +472 -0
  819. vllm/model_executor/models/constant_size_cache.py +137 -0
  820. vllm/model_executor/models/dbrx.py +472 -0
  821. vllm/model_executor/models/deepseek.py +486 -0
  822. vllm/model_executor/models/deepseek_mtp.py +269 -0
  823. vllm/model_executor/models/deepseek_v2.py +843 -0
  824. vllm/model_executor/models/deepseek_vl2.py +648 -0
  825. vllm/model_executor/models/eagle.py +260 -0
  826. vllm/model_executor/models/exaone.py +551 -0
  827. vllm/model_executor/models/fairseq2_llama.py +154 -0
  828. vllm/model_executor/models/falcon.py +510 -0
  829. vllm/model_executor/models/falcon_h1.py +685 -0
  830. vllm/model_executor/models/florence2.py +1103 -0
  831. vllm/model_executor/models/fuyu.py +389 -0
  832. vllm/model_executor/models/gemma.py +425 -0
  833. vllm/model_executor/models/gemma2.py +425 -0
  834. vllm/model_executor/models/gemma3.py +533 -0
  835. vllm/model_executor/models/gemma3_mm.py +709 -0
  836. vllm/model_executor/models/glm.py +23 -0
  837. vllm/model_executor/models/glm4.py +305 -0
  838. vllm/model_executor/models/glm4v.py +648 -0
  839. vllm/model_executor/models/gpt2.py +328 -0
  840. vllm/model_executor/models/gpt_bigcode.py +335 -0
  841. vllm/model_executor/models/gpt_j.py +339 -0
  842. vllm/model_executor/models/gpt_neox.py +332 -0
  843. vllm/model_executor/models/granite.py +493 -0
  844. vllm/model_executor/models/granite_speech.py +779 -0
  845. vllm/model_executor/models/granitemoe.py +437 -0
  846. vllm/model_executor/models/granitemoehybrid.py +586 -0
  847. vllm/model_executor/models/granitemoeshared.py +341 -0
  848. vllm/model_executor/models/gritlm.py +224 -0
  849. vllm/model_executor/models/grok1.py +546 -0
  850. vllm/model_executor/models/h2ovl.py +546 -0
  851. vllm/model_executor/models/idefics2_vision_model.py +389 -0
  852. vllm/model_executor/models/idefics3.py +776 -0
  853. vllm/model_executor/models/interfaces.py +572 -0
  854. vllm/model_executor/models/interfaces_base.py +164 -0
  855. vllm/model_executor/models/intern_vit.py +480 -0
  856. vllm/model_executor/models/internlm2.py +455 -0
  857. vllm/model_executor/models/internlm2_ve.py +147 -0
  858. vllm/model_executor/models/internvl.py +1418 -0
  859. vllm/model_executor/models/jais.py +373 -0
  860. vllm/model_executor/models/jamba.py +592 -0
  861. vllm/model_executor/models/kimi_vl.py +577 -0
  862. vllm/model_executor/models/llama.py +644 -0
  863. vllm/model_executor/models/llama4.py +532 -0
  864. vllm/model_executor/models/llama_eagle.py +165 -0
  865. vllm/model_executor/models/llama_eagle3.py +263 -0
  866. vllm/model_executor/models/llava.py +866 -0
  867. vllm/model_executor/models/llava_next.py +586 -0
  868. vllm/model_executor/models/llava_next_video.py +471 -0
  869. vllm/model_executor/models/llava_onevision.py +956 -0
  870. vllm/model_executor/models/mamba.py +273 -0
  871. vllm/model_executor/models/mamba2.py +308 -0
  872. vllm/model_executor/models/mamba_cache.py +76 -0
  873. vllm/model_executor/models/medusa.py +219 -0
  874. vllm/model_executor/models/mimo.py +192 -0
  875. vllm/model_executor/models/mimo_mtp.py +285 -0
  876. vllm/model_executor/models/minicpm.py +592 -0
  877. vllm/model_executor/models/minicpm3.py +230 -0
  878. vllm/model_executor/models/minicpm_eagle.py +391 -0
  879. vllm/model_executor/models/minicpmo.py +759 -0
  880. vllm/model_executor/models/minicpmv.py +1287 -0
  881. vllm/model_executor/models/minimax_cache.py +36 -0
  882. vllm/model_executor/models/minimax_text_01.py +1301 -0
  883. vllm/model_executor/models/minimax_vl_01.py +364 -0
  884. vllm/model_executor/models/mistral3.py +604 -0
  885. vllm/model_executor/models/mixtral.py +488 -0
  886. vllm/model_executor/models/mixtral_quant.py +453 -0
  887. vllm/model_executor/models/mllama.py +1624 -0
  888. vllm/model_executor/models/mllama4.py +938 -0
  889. vllm/model_executor/models/mlp_speculator.py +206 -0
  890. vllm/model_executor/models/modernbert.py +331 -0
  891. vllm/model_executor/models/module_mapping.py +72 -0
  892. vllm/model_executor/models/molmo.py +1568 -0
  893. vllm/model_executor/models/moonvit.py +630 -0
  894. vllm/model_executor/models/mpt.py +331 -0
  895. vllm/model_executor/models/nemotron.py +508 -0
  896. vllm/model_executor/models/nemotron_h.py +573 -0
  897. vllm/model_executor/models/nemotron_nas.py +484 -0
  898. vllm/model_executor/models/nvlm_d.py +216 -0
  899. vllm/model_executor/models/olmo.py +389 -0
  900. vllm/model_executor/models/olmo2.py +414 -0
  901. vllm/model_executor/models/olmoe.py +468 -0
  902. vllm/model_executor/models/opt.py +412 -0
  903. vllm/model_executor/models/orion.py +349 -0
  904. vllm/model_executor/models/ovis.py +567 -0
  905. vllm/model_executor/models/paligemma.py +398 -0
  906. vllm/model_executor/models/persimmon.py +344 -0
  907. vllm/model_executor/models/phi.py +356 -0
  908. vllm/model_executor/models/phi3.py +19 -0
  909. vllm/model_executor/models/phi3_small.py +465 -0
  910. vllm/model_executor/models/phi3v.py +723 -0
  911. vllm/model_executor/models/phi4mm.py +1246 -0
  912. vllm/model_executor/models/phi4mm_audio.py +1233 -0
  913. vllm/model_executor/models/phi4mm_utils.py +1884 -0
  914. vllm/model_executor/models/phimoe.py +665 -0
  915. vllm/model_executor/models/pixtral.py +1316 -0
  916. vllm/model_executor/models/plamo2.py +738 -0
  917. vllm/model_executor/models/prithvi_geospatial_mae.py +232 -0
  918. vllm/model_executor/models/qwen.py +362 -0
  919. vllm/model_executor/models/qwen2.py +497 -0
  920. vllm/model_executor/models/qwen2_5_omni_thinker.py +904 -0
  921. vllm/model_executor/models/qwen2_5_vl.py +1166 -0
  922. vllm/model_executor/models/qwen2_audio.py +410 -0
  923. vllm/model_executor/models/qwen2_moe.py +540 -0
  924. vllm/model_executor/models/qwen2_rm.py +132 -0
  925. vllm/model_executor/models/qwen2_vl.py +1405 -0
  926. vllm/model_executor/models/qwen3.py +321 -0
  927. vllm/model_executor/models/qwen3_moe.py +535 -0
  928. vllm/model_executor/models/qwen_vl.py +785 -0
  929. vllm/model_executor/models/registry.py +622 -0
  930. vllm/model_executor/models/roberta.py +276 -0
  931. vllm/model_executor/models/siglip.py +524 -0
  932. vllm/model_executor/models/skyworkr1v.py +951 -0
  933. vllm/model_executor/models/smolvlm.py +52 -0
  934. vllm/model_executor/models/solar.py +506 -0
  935. vllm/model_executor/models/stablelm.py +343 -0
  936. vllm/model_executor/models/starcoder2.py +356 -0
  937. vllm/model_executor/models/tarsier.py +643 -0
  938. vllm/model_executor/models/telechat2.py +140 -0
  939. vllm/model_executor/models/teleflm.py +79 -0
  940. vllm/model_executor/models/transformers.py +508 -0
  941. vllm/model_executor/models/ultravox.py +656 -0
  942. vllm/model_executor/models/utils.py +731 -0
  943. vllm/model_executor/models/vision.py +147 -0
  944. vllm/model_executor/models/whisper.py +747 -0
  945. vllm/model_executor/models/zamba2.py +1009 -0
  946. vllm/model_executor/parameter.py +459 -0
  947. vllm/model_executor/pooling_metadata.py +72 -0
  948. vllm/model_executor/sampling_metadata.py +597 -0
  949. vllm/model_executor/utils.py +77 -0
  950. vllm/multimodal/__init__.py +33 -0
  951. vllm/multimodal/audio.py +106 -0
  952. vllm/multimodal/base.py +219 -0
  953. vllm/multimodal/hasher.py +118 -0
  954. vllm/multimodal/image.py +97 -0
  955. vllm/multimodal/inputs.py +876 -0
  956. vllm/multimodal/parse.py +461 -0
  957. vllm/multimodal/processing.py +1895 -0
  958. vllm/multimodal/profiling.py +258 -0
  959. vllm/multimodal/registry.py +331 -0
  960. vllm/multimodal/utils.py +436 -0
  961. vllm/multimodal/video.py +198 -0
  962. vllm/outputs.py +512 -0
  963. vllm/platforms/__init__.py +291 -0
  964. vllm/platforms/cpu.py +266 -0
  965. vllm/platforms/cuda.py +526 -0
  966. vllm/platforms/hpu.py +106 -0
  967. vllm/platforms/interface.py +538 -0
  968. vllm/platforms/neuron.py +150 -0
  969. vllm/platforms/rocm.py +435 -0
  970. vllm/platforms/tpu.py +216 -0
  971. vllm/platforms/xpu.py +156 -0
  972. vllm/plugins/__init__.py +94 -0
  973. vllm/plugins/lora_resolvers/README.md +15 -0
  974. vllm/plugins/lora_resolvers/__init__.py +0 -0
  975. vllm/plugins/lora_resolvers/filesystem_resolver.py +50 -0
  976. vllm/pooling_params.py +54 -0
  977. vllm/profiler/__init__.py +0 -0
  978. vllm/profiler/layerwise_profile.py +375 -0
  979. vllm/profiler/utils.py +148 -0
  980. vllm/prompt_adapter/__init__.py +0 -0
  981. vllm/prompt_adapter/layers.py +83 -0
  982. vllm/prompt_adapter/models.py +358 -0
  983. vllm/prompt_adapter/request.py +37 -0
  984. vllm/prompt_adapter/utils.py +98 -0
  985. vllm/prompt_adapter/worker_manager.py +179 -0
  986. vllm/py.typed +2 -0
  987. vllm/reasoning/__init__.py +15 -0
  988. vllm/reasoning/abs_reasoning_parsers.py +192 -0
  989. vllm/reasoning/deepseek_r1_reasoning_parser.py +173 -0
  990. vllm/reasoning/granite_reasoning_parser.py +363 -0
  991. vllm/reasoning/qwen3_reasoning_parser.py +151 -0
  992. vllm/sampling_params.py +602 -0
  993. vllm/scalar_type.py +347 -0
  994. vllm/scripts.py +15 -0
  995. vllm/sequence.py +1568 -0
  996. vllm/spec_decode/__init__.py +0 -0
  997. vllm/spec_decode/batch_expansion.py +506 -0
  998. vllm/spec_decode/draft_model_runner.py +349 -0
  999. vllm/spec_decode/interfaces.py +99 -0
  1000. vllm/spec_decode/medusa_worker.py +138 -0
  1001. vllm/spec_decode/metrics.py +213 -0
  1002. vllm/spec_decode/mlp_speculator_worker.py +94 -0
  1003. vllm/spec_decode/mqa_scorer.py +160 -0
  1004. vllm/spec_decode/multi_step_worker.py +423 -0
  1005. vllm/spec_decode/ngram_worker.py +196 -0
  1006. vllm/spec_decode/proposer_worker_base.py +59 -0
  1007. vllm/spec_decode/smaller_tp_proposer_worker.py +196 -0
  1008. vllm/spec_decode/spec_decode_worker.py +1326 -0
  1009. vllm/spec_decode/target_model_runner.py +45 -0
  1010. vllm/spec_decode/top1_proposer.py +275 -0
  1011. vllm/spec_decode/util.py +277 -0
  1012. vllm/test_utils.py +130 -0
  1013. vllm/third_party/__init__.py +0 -0
  1014. vllm/third_party/pynvml.py +6140 -0
  1015. vllm/tracing.py +131 -0
  1016. vllm/transformers_utils/__init__.py +24 -0
  1017. vllm/transformers_utils/chat_templates/__init__.py +5 -0
  1018. vllm/transformers_utils/chat_templates/registry.py +60 -0
  1019. vllm/transformers_utils/chat_templates/template_basic.jinja +3 -0
  1020. vllm/transformers_utils/chat_templates/template_blip2.jinja +11 -0
  1021. vllm/transformers_utils/chat_templates/template_chatml.jinja +10 -0
  1022. vllm/transformers_utils/chat_templates/template_deepseek_vl2.jinja +23 -0
  1023. vllm/transformers_utils/chat_templates/template_fuyu.jinja +3 -0
  1024. vllm/transformers_utils/config.py +887 -0
  1025. vllm/transformers_utils/configs/__init__.py +61 -0
  1026. vllm/transformers_utils/configs/arctic.py +207 -0
  1027. vllm/transformers_utils/configs/chatglm.py +72 -0
  1028. vllm/transformers_utils/configs/cohere2.py +195 -0
  1029. vllm/transformers_utils/configs/dbrx.py +280 -0
  1030. vllm/transformers_utils/configs/deepseek_vl2.py +216 -0
  1031. vllm/transformers_utils/configs/eagle.py +85 -0
  1032. vllm/transformers_utils/configs/exaone.py +190 -0
  1033. vllm/transformers_utils/configs/falcon.py +90 -0
  1034. vllm/transformers_utils/configs/h2ovl.py +16 -0
  1035. vllm/transformers_utils/configs/internvl.py +54 -0
  1036. vllm/transformers_utils/configs/jais.py +238 -0
  1037. vllm/transformers_utils/configs/kimi_vl.py +37 -0
  1038. vllm/transformers_utils/configs/medusa.py +63 -0
  1039. vllm/transformers_utils/configs/minimax_text_01.py +70 -0
  1040. vllm/transformers_utils/configs/minimax_vl_01.py +71 -0
  1041. vllm/transformers_utils/configs/mllama.py +31 -0
  1042. vllm/transformers_utils/configs/mlp_speculator.py +68 -0
  1043. vllm/transformers_utils/configs/moonvit.py +33 -0
  1044. vllm/transformers_utils/configs/mpt.py +180 -0
  1045. vllm/transformers_utils/configs/nemotron.py +205 -0
  1046. vllm/transformers_utils/configs/nemotron_h.py +258 -0
  1047. vllm/transformers_utils/configs/nvlm_d.py +15 -0
  1048. vllm/transformers_utils/configs/ovis.py +184 -0
  1049. vllm/transformers_utils/configs/skyworkr1v.py +54 -0
  1050. vllm/transformers_utils/configs/solar.py +247 -0
  1051. vllm/transformers_utils/configs/telechat2.py +64 -0
  1052. vllm/transformers_utils/configs/ultravox.py +108 -0
  1053. vllm/transformers_utils/detokenizer.py +168 -0
  1054. vllm/transformers_utils/detokenizer_utils.py +189 -0
  1055. vllm/transformers_utils/processor.py +221 -0
  1056. vllm/transformers_utils/processors/__init__.py +8 -0
  1057. vllm/transformers_utils/processors/deepseek_vl2.py +363 -0
  1058. vllm/transformers_utils/processors/ovis.py +420 -0
  1059. vllm/transformers_utils/s3_utils.py +162 -0
  1060. vllm/transformers_utils/tokenizer.py +302 -0
  1061. vllm/transformers_utils/tokenizer_base.py +149 -0
  1062. vllm/transformers_utils/tokenizer_group.py +120 -0
  1063. vllm/transformers_utils/tokenizers/__init__.py +10 -0
  1064. vllm/transformers_utils/tokenizers/mistral.py +493 -0
  1065. vllm/transformers_utils/utils.py +99 -0
  1066. vllm/triton_utils/__init__.py +14 -0
  1067. vllm/triton_utils/importing.py +50 -0
  1068. vllm/usage/__init__.py +0 -0
  1069. vllm/usage/usage_lib.py +256 -0
  1070. vllm/utils.py +2910 -0
  1071. vllm/v1/__init__.py +0 -0
  1072. vllm/v1/attention/__init__.py +0 -0
  1073. vllm/v1/attention/backends/__init__.py +0 -0
  1074. vllm/v1/attention/backends/cpu_attn.py +163 -0
  1075. vllm/v1/attention/backends/flash_attn.py +869 -0
  1076. vllm/v1/attention/backends/flashinfer.py +651 -0
  1077. vllm/v1/attention/backends/flex_attention.py +477 -0
  1078. vllm/v1/attention/backends/mla/__init__.py +0 -0
  1079. vllm/v1/attention/backends/mla/common.py +931 -0
  1080. vllm/v1/attention/backends/mla/cutlass_mla.py +97 -0
  1081. vllm/v1/attention/backends/mla/flashmla.py +152 -0
  1082. vllm/v1/attention/backends/mla/rocm_aiter_mla.py +220 -0
  1083. vllm/v1/attention/backends/mla/triton_mla.py +120 -0
  1084. vllm/v1/attention/backends/pallas.py +240 -0
  1085. vllm/v1/attention/backends/triton_attn.py +285 -0
  1086. vllm/v1/attention/backends/utils.py +52 -0
  1087. vllm/v1/core/__init__.py +0 -0
  1088. vllm/v1/core/block_pool.py +349 -0
  1089. vllm/v1/core/encoder_cache_manager.py +150 -0
  1090. vllm/v1/core/kv_cache_coordinator.py +363 -0
  1091. vllm/v1/core/kv_cache_manager.py +392 -0
  1092. vllm/v1/core/kv_cache_utils.py +996 -0
  1093. vllm/v1/core/sched/__init__.py +0 -0
  1094. vllm/v1/core/sched/interface.py +150 -0
  1095. vllm/v1/core/sched/output.py +154 -0
  1096. vllm/v1/core/sched/scheduler.py +1044 -0
  1097. vllm/v1/core/sched/utils.py +23 -0
  1098. vllm/v1/core/single_type_kv_cache_manager.py +403 -0
  1099. vllm/v1/engine/__init__.py +173 -0
  1100. vllm/v1/engine/async_llm.py +558 -0
  1101. vllm/v1/engine/coordinator.py +253 -0
  1102. vllm/v1/engine/core.py +961 -0
  1103. vllm/v1/engine/core_client.py +1129 -0
  1104. vllm/v1/engine/detokenizer.py +261 -0
  1105. vllm/v1/engine/exceptions.py +17 -0
  1106. vllm/v1/engine/llm_engine.py +317 -0
  1107. vllm/v1/engine/logprobs.py +199 -0
  1108. vllm/v1/engine/mm_input_cache.py +91 -0
  1109. vllm/v1/engine/output_processor.py +428 -0
  1110. vllm/v1/engine/parallel_sampling.py +133 -0
  1111. vllm/v1/engine/processor.py +407 -0
  1112. vllm/v1/executor/__init__.py +0 -0
  1113. vllm/v1/executor/abstract.py +113 -0
  1114. vllm/v1/executor/multiproc_executor.py +537 -0
  1115. vllm/v1/executor/ray_distributed_executor.py +62 -0
  1116. vllm/v1/kv_cache_interface.py +194 -0
  1117. vllm/v1/metrics/__init__.py +0 -0
  1118. vllm/v1/metrics/loggers.py +523 -0
  1119. vllm/v1/metrics/prometheus.py +82 -0
  1120. vllm/v1/metrics/ray_wrappers.py +131 -0
  1121. vllm/v1/metrics/reader.py +246 -0
  1122. vllm/v1/metrics/stats.py +239 -0
  1123. vllm/v1/outputs.py +116 -0
  1124. vllm/v1/request.py +193 -0
  1125. vllm/v1/sample/__init__.py +0 -0
  1126. vllm/v1/sample/metadata.py +44 -0
  1127. vllm/v1/sample/ops/__init__.py +0 -0
  1128. vllm/v1/sample/ops/bad_words.py +39 -0
  1129. vllm/v1/sample/ops/penalties.py +59 -0
  1130. vllm/v1/sample/ops/topk_topp_sampler.py +293 -0
  1131. vllm/v1/sample/rejection_sampler.py +631 -0
  1132. vllm/v1/sample/sampler.py +286 -0
  1133. vllm/v1/sample/tpu/__init__.py +0 -0
  1134. vllm/v1/sample/tpu/metadata.py +124 -0
  1135. vllm/v1/sample/tpu/sampler.py +145 -0
  1136. vllm/v1/serial_utils.py +315 -0
  1137. vllm/v1/spec_decode/__init__.py +0 -0
  1138. vllm/v1/spec_decode/eagle.py +432 -0
  1139. vllm/v1/spec_decode/medusa.py +62 -0
  1140. vllm/v1/spec_decode/metadata.py +62 -0
  1141. vllm/v1/spec_decode/metrics.py +178 -0
  1142. vllm/v1/spec_decode/ngram_proposer.py +132 -0
  1143. vllm/v1/spec_decode/utils.py +46 -0
  1144. vllm/v1/structured_output/__init__.py +222 -0
  1145. vllm/v1/structured_output/backend_guidance.py +245 -0
  1146. vllm/v1/structured_output/backend_types.py +134 -0
  1147. vllm/v1/structured_output/backend_xgrammar.py +318 -0
  1148. vllm/v1/structured_output/request.py +86 -0
  1149. vllm/v1/structured_output/utils.py +175 -0
  1150. vllm/v1/utils.py +743 -0
  1151. vllm/v1/worker/__init__.py +0 -0
  1152. vllm/v1/worker/block_table.py +142 -0
  1153. vllm/v1/worker/cpu_model_runner.py +86 -0
  1154. vllm/v1/worker/cpu_worker.py +152 -0
  1155. vllm/v1/worker/gpu_input_batch.py +681 -0
  1156. vllm/v1/worker/gpu_model_runner.py +2320 -0
  1157. vllm/v1/worker/gpu_worker.py +393 -0
  1158. vllm/v1/worker/lora_model_runner_mixin.py +173 -0
  1159. vllm/v1/worker/tpu_model_runner.py +1673 -0
  1160. vllm/v1/worker/tpu_worker.py +299 -0
  1161. vllm/v1/worker/utils.py +111 -0
  1162. vllm/v1/worker/worker_base.py +65 -0
  1163. vllm/version.py +41 -0
  1164. vllm/vllm_flash_attn/.gitkeep +0 -0
  1165. vllm/worker/__init__.py +0 -0
  1166. vllm/worker/cache_engine.py +145 -0
  1167. vllm/worker/cpu_enc_dec_model_runner.py +326 -0
  1168. vllm/worker/cpu_model_runner.py +671 -0
  1169. vllm/worker/cpu_pooling_model_runner.py +125 -0
  1170. vllm/worker/cpu_worker.py +450 -0
  1171. vllm/worker/enc_dec_model_runner.py +555 -0
  1172. vllm/worker/hpu_model_runner.py +2320 -0
  1173. vllm/worker/hpu_worker.py +484 -0
  1174. vllm/worker/model_runner.py +2178 -0
  1175. vllm/worker/model_runner_base.py +282 -0
  1176. vllm/worker/multi_step_hpu_worker.py +123 -0
  1177. vllm/worker/multi_step_model_runner.py +911 -0
  1178. vllm/worker/multi_step_neuron_model_runner.py +84 -0
  1179. vllm/worker/multi_step_neuronx_distributed_model_runner.py +63 -0
  1180. vllm/worker/multi_step_tpu_worker.py +108 -0
  1181. vllm/worker/multi_step_worker.py +197 -0
  1182. vllm/worker/neuron_model_runner.py +460 -0
  1183. vllm/worker/neuron_worker.py +193 -0
  1184. vllm/worker/neuronx_distributed_model_runner.py +294 -0
  1185. vllm/worker/pooling_model_runner.py +211 -0
  1186. vllm/worker/tpu_model_runner.py +909 -0
  1187. vllm/worker/tpu_worker.py +337 -0
  1188. vllm/worker/utils.py +53 -0
  1189. vllm/worker/worker.py +577 -0
  1190. vllm/worker/worker_base.py +646 -0
  1191. vllm/worker/xpu_model_runner.py +606 -0
  1192. vllm/worker/xpu_worker.py +186 -0
  1193. vllm_cpu_amxbf16-0.9.1.dist-info/METADATA +305 -0
  1194. vllm_cpu_amxbf16-0.9.1.dist-info/RECORD +1197 -0
  1195. vllm_cpu_amxbf16-0.9.1.dist-info/WHEEL +5 -0
  1196. vllm_cpu_amxbf16-0.9.1.dist-info/entry_points.txt +5 -0
  1197. vllm_cpu_amxbf16-0.9.1.dist-info/top_level.txt +1 -0
@@ -0,0 +1,2097 @@
1
+ # SPDX-License-Identifier: Apache-2.0
2
+ # SPDX-FileCopyrightText: Copyright contributors to the vLLM project
3
+
4
+ import copy
5
+ import time
6
+ from collections import Counter as collectionsCounter
7
+ from collections import deque
8
+ from contextlib import contextmanager
9
+ from dataclasses import dataclass
10
+ from functools import partial
11
+ from typing import (TYPE_CHECKING, Any, Callable, ClassVar, Deque, Dict,
12
+ Iterable, List, Literal, Mapping, NamedTuple, Optional)
13
+ from typing import Sequence as GenericSequence
14
+ from typing import Set, Type, Union, cast
15
+
16
+ import torch
17
+ from typing_extensions import TypeVar
18
+
19
+ import vllm.envs as envs
20
+ from vllm.config import (DecodingConfig, LoRAConfig, ModelConfig,
21
+ ObservabilityConfig, ParallelConfig, SchedulerConfig,
22
+ VllmConfig)
23
+ from vllm.core.scheduler import ScheduledSequenceGroup, SchedulerOutputs
24
+ from vllm.engine.arg_utils import EngineArgs
25
+ from vllm.engine.metrics_types import StatLoggerBase, Stats
26
+ from vllm.engine.output_processor.interfaces import (
27
+ SequenceGroupOutputProcessor)
28
+ from vllm.engine.output_processor.stop_checker import StopChecker
29
+ from vllm.engine.output_processor.util import create_output_by_sequence_group
30
+ from vllm.entrypoints.openai.logits_processors import (
31
+ get_logits_processors as get_openai_logits_processors)
32
+ from vllm.executor.executor_base import ExecutorBase
33
+ from vllm.inputs import ProcessorInputs, PromptType, SingletonInputs
34
+ from vllm.inputs.parse import split_enc_dec_inputs
35
+ from vllm.inputs.preprocess import InputPreprocessor
36
+ from vllm.logger import init_logger
37
+ from vllm.logits_process import get_bad_words_logits_processors
38
+ from vllm.lora.request import LoRARequest
39
+ from vllm.model_executor.guided_decoding import (
40
+ get_local_guided_decoding_logits_processor)
41
+ from vllm.model_executor.layers.sampler import SamplerOutput
42
+ from vllm.multimodal import MULTIMODAL_REGISTRY, MultiModalRegistry
43
+ from vllm.multimodal.processing import EncDecMultiModalProcessor
44
+ from vllm.outputs import (PoolingRequestOutput, RequestOutput,
45
+ RequestOutputFactory)
46
+ from vllm.pooling_params import PoolingParams
47
+ from vllm.prompt_adapter.request import PromptAdapterRequest
48
+ from vllm.sampling_params import RequestOutputKind, SamplingParams
49
+ from vllm.sequence import (ExecuteModelRequest, ParallelSampleSequenceGroup,
50
+ PoolingSequenceGroupOutput, Sequence, SequenceGroup,
51
+ SequenceGroupBase, SequenceGroupMetadata,
52
+ SequenceGroupOutput, SequenceStatus)
53
+ from vllm.tracing import (SpanAttributes, SpanKind, extract_trace_context,
54
+ init_tracer)
55
+ from vllm.transformers_utils.detokenizer import Detokenizer
56
+ from vllm.transformers_utils.tokenizer import AnyTokenizer
57
+ from vllm.transformers_utils.tokenizer_group import (
58
+ TokenizerGroup, init_tokenizer_from_configs)
59
+ from vllm.usage.usage_lib import (UsageContext, is_usage_stats_enabled,
60
+ usage_message)
61
+ from vllm.utils import Counter, Device, resolve_obj_by_qualname, weak_bind
62
+ from vllm.version import __version__ as VLLM_VERSION
63
+ from vllm.worker.model_runner_base import InputProcessingError
64
+
65
+ logger = init_logger(__name__)
66
+ _LOCAL_LOGGING_INTERVAL_SEC = 5
67
+
68
+ _O = TypeVar("_O", RequestOutput, PoolingRequestOutput)
69
+ _R = TypeVar("_R", default=Any)
70
+
71
+
72
+ @dataclass
73
+ class SchedulerOutputState:
74
+ """Caches the scheduler outputs for a virtual engine. Used for Multi-Step"""
75
+ seq_group_metadata_list: Optional[List[SequenceGroupMetadata]] = None
76
+ scheduler_outputs: Optional[SchedulerOutputs] = None
77
+ allow_async_output_proc: bool = False
78
+ last_output: Optional[SamplerOutput] = None
79
+
80
+
81
+ class OutputData(NamedTuple):
82
+ outputs: List[SamplerOutput]
83
+ seq_group_metadata_list: List[SequenceGroupMetadata]
84
+ scheduler_outputs: SchedulerOutputs
85
+ is_async: bool
86
+ is_last_step: bool
87
+ # Indicates if this output is from the first step of the
88
+ # multi-step. When multi-step is disabled, this is always
89
+ # set to True.
90
+ # is_first_step_output is invalid when `outputs` has
91
+ # outputs from multiple steps.
92
+ is_first_step_output: Optional[bool]
93
+ skip: List[int]
94
+
95
+
96
+ class SchedulerContext:
97
+
98
+ def __init__(self, multi_step_stream_outputs: bool = False):
99
+ self.output_queue: Deque[OutputData] = deque()
100
+ self.request_outputs: List[Union[RequestOutput,
101
+ PoolingRequestOutput]] = []
102
+ self.seq_group_metadata_list: Optional[
103
+ List[SequenceGroupMetadata]] = None
104
+ self.scheduler_outputs: Optional[SchedulerOutputs] = None
105
+
106
+ self.multi_step_stream_outputs: bool = multi_step_stream_outputs
107
+
108
+ def append_output(self, outputs: List[SamplerOutput],
109
+ seq_group_metadata_list: List[SequenceGroupMetadata],
110
+ scheduler_outputs: SchedulerOutputs, is_async: bool,
111
+ is_last_step: bool,
112
+ is_first_step_output: Optional[bool]):
113
+ self.output_queue.append(
114
+ OutputData(outputs=outputs,
115
+ seq_group_metadata_list=seq_group_metadata_list,
116
+ scheduler_outputs=scheduler_outputs,
117
+ is_async=is_async,
118
+ is_last_step=is_last_step,
119
+ is_first_step_output=is_first_step_output,
120
+ skip=[]))
121
+
122
+
123
+ class LLMEngine:
124
+ """An LLM engine that receives requests and generates texts.
125
+
126
+ This is the main class for the vLLM engine. It receives requests
127
+ from clients and generates texts from the LLM. It includes a tokenizer, a
128
+ language model (possibly distributed across multiple GPUs), and GPU memory
129
+ space allocated for intermediate states (aka KV cache). This class utilizes
130
+ iteration-level scheduling and efficient memory management to maximize the
131
+ serving throughput.
132
+
133
+ The [`LLM`][vllm.LLM] class wraps this class for offline batched inference
134
+ and the [`AsyncLLMEngine`][vllm.engine.async_llm_engine.AsyncLLMEngine]
135
+ class wraps this class for online serving.
136
+
137
+ The config arguments are derived from [`EngineArgs`][vllm.EngineArgs].
138
+
139
+ Args:
140
+ vllm_config: The configuration for initializing and running vLLM.
141
+ executor_class: The model executor class for managing distributed
142
+ execution.
143
+ log_stats: Whether to log statistics.
144
+ usage_context: Specified entry point, used for usage info collection.
145
+ """
146
+
147
+ DO_VALIDATE_OUTPUT: ClassVar[bool] = False
148
+ """A flag to toggle whether to validate the type of request output."""
149
+
150
+ @classmethod
151
+ @contextmanager
152
+ def enable_output_validation(cls):
153
+ cls.DO_VALIDATE_OUTPUT = True
154
+
155
+ yield
156
+
157
+ cls.DO_VALIDATE_OUTPUT = False
158
+
159
+ @classmethod
160
+ def validate_output(
161
+ cls,
162
+ output: object,
163
+ output_type: Type[_O],
164
+ ) -> _O:
165
+ do_validate = cls.DO_VALIDATE_OUTPUT
166
+
167
+ if ((TYPE_CHECKING or do_validate)
168
+ and not isinstance(output, output_type)):
169
+ raise TypeError(f"Expected output of type {output_type}, "
170
+ f"but found type {type(output)}")
171
+
172
+ return cast(_O, output)
173
+
174
+ @classmethod
175
+ def validate_outputs(
176
+ cls,
177
+ outputs: GenericSequence[object],
178
+ output_type: Type[_O],
179
+ ) -> List[_O]:
180
+ do_validate = cls.DO_VALIDATE_OUTPUT
181
+
182
+ outputs_: List[_O]
183
+ if TYPE_CHECKING or do_validate:
184
+ outputs_ = []
185
+ for output in outputs:
186
+ if not isinstance(output, output_type):
187
+ raise TypeError(f"Expected output of type {output_type}, "
188
+ f"but found type {type(output)}")
189
+
190
+ outputs_.append(output)
191
+ else:
192
+ outputs_ = outputs
193
+
194
+ return outputs_
195
+
196
+ tokenizer: Optional[TokenizerGroup]
197
+
198
+ def __init__(
199
+ self,
200
+ vllm_config: VllmConfig,
201
+ executor_class: Type[ExecutorBase],
202
+ log_stats: bool,
203
+ usage_context: UsageContext = UsageContext.ENGINE_CONTEXT,
204
+ stat_loggers: Optional[Dict[str, StatLoggerBase]] = None,
205
+ mm_registry: MultiModalRegistry = MULTIMODAL_REGISTRY,
206
+ use_cached_outputs: bool = False,
207
+ ) -> None:
208
+ if envs.VLLM_USE_V1:
209
+ raise ValueError(
210
+ "Using V0 LLMEngine, but envs.VLLM_USE_V1=True. "
211
+ "This should not happen. As a workaround, try using "
212
+ "LLMEngine.from_vllm_config(...) or explicitly set "
213
+ "VLLM_USE_V1=0 or 1 and report this issue on Github.")
214
+
215
+ self.vllm_config = vllm_config
216
+ self.model_config = vllm_config.model_config
217
+ self.cache_config = vllm_config.cache_config
218
+ self.lora_config = vllm_config.lora_config
219
+ self.parallel_config = vllm_config.parallel_config
220
+ self.scheduler_config = vllm_config.scheduler_config
221
+ self.device_config = vllm_config.device_config
222
+ self.speculative_config = vllm_config.speculative_config # noqa
223
+ self.load_config = vllm_config.load_config
224
+ self.decoding_config = vllm_config.decoding_config or DecodingConfig( # noqa
225
+ )
226
+ self.prompt_adapter_config = vllm_config.prompt_adapter_config # noqa
227
+ self.observability_config = vllm_config.observability_config or ObservabilityConfig( # noqa
228
+ )
229
+
230
+ logger.info(
231
+ "Initializing a V0 LLM engine (v%s) with config: %s, "
232
+ "use_cached_outputs=%s, ",
233
+ VLLM_VERSION,
234
+ vllm_config,
235
+ use_cached_outputs,
236
+ )
237
+
238
+ self.log_stats = log_stats
239
+ self.use_cached_outputs = use_cached_outputs
240
+
241
+ if not self.model_config.skip_tokenizer_init:
242
+ self.tokenizer = self._init_tokenizer()
243
+ self.detokenizer = Detokenizer(self.tokenizer)
244
+ tokenizer_group = self.get_tokenizer_group()
245
+ else:
246
+ self.tokenizer = None
247
+ self.detokenizer = None
248
+ tokenizer_group = None
249
+
250
+ # Ensure that the function doesn't contain a reference to self,
251
+ # to avoid engine GC issues
252
+ def get_tokenizer_for_seq(sequence: Sequence) -> AnyTokenizer:
253
+ assert tokenizer_group, ("tokenizer_group cannot be None, "
254
+ "make sure skip_tokenizer_init is False")
255
+ return tokenizer_group.get_lora_tokenizer(sequence.lora_request)
256
+
257
+ self.seq_counter = Counter()
258
+ self.generation_config_fields = (
259
+ self.model_config.try_get_generation_config())
260
+
261
+ self.input_preprocessor = InputPreprocessor(self.model_config,
262
+ self.tokenizer,
263
+ mm_registry)
264
+
265
+ self.model_executor = executor_class(vllm_config=vllm_config)
266
+
267
+ if self.model_config.runner_type != "pooling":
268
+ self._initialize_kv_caches()
269
+
270
+ # If usage stat is enabled, collect relevant info.
271
+ if is_usage_stats_enabled():
272
+ from vllm.model_executor.model_loader import (
273
+ get_architecture_class_name)
274
+ usage_message.report_usage(
275
+ get_architecture_class_name(self.model_config),
276
+ usage_context,
277
+ extra_kvs={
278
+ # Common configuration
279
+ "dtype":
280
+ str(self.model_config.dtype),
281
+ "tensor_parallel_size":
282
+ self.parallel_config.tensor_parallel_size,
283
+ "block_size":
284
+ self.cache_config.block_size,
285
+ "gpu_memory_utilization":
286
+ self.cache_config.gpu_memory_utilization,
287
+
288
+ # Quantization
289
+ "quantization":
290
+ self.model_config.quantization,
291
+ "kv_cache_dtype":
292
+ str(self.cache_config.cache_dtype),
293
+
294
+ # Feature flags
295
+ "enable_lora":
296
+ bool(self.lora_config),
297
+ "enable_prompt_adapter":
298
+ bool(self.prompt_adapter_config),
299
+ "enable_prefix_caching":
300
+ self.cache_config.enable_prefix_caching,
301
+ "enforce_eager":
302
+ self.model_config.enforce_eager,
303
+ "disable_custom_all_reduce":
304
+ self.parallel_config.disable_custom_all_reduce,
305
+ })
306
+
307
+ self.cached_scheduler_outputs = [
308
+ SchedulerOutputState()
309
+ for _ in range(self.parallel_config.pipeline_parallel_size)
310
+ ]
311
+
312
+ self.scheduler_contexts = [
313
+ SchedulerContext(multi_step_stream_outputs=self.scheduler_config.
314
+ multi_step_stream_outputs)
315
+ for _ in range(self.parallel_config.pipeline_parallel_size)
316
+ ]
317
+
318
+ if self.model_config.use_async_output_proc:
319
+ process_model_outputs = weak_bind(self._process_model_outputs)
320
+
321
+ self.async_callbacks = [
322
+ partial(process_model_outputs,
323
+ ctx=self.scheduler_contexts[v_id])
324
+ for v_id in range(self.parallel_config.pipeline_parallel_size)
325
+ ]
326
+ else:
327
+ self.async_callbacks = []
328
+
329
+ # Currently used by AsyncLLMEngine to ensure quick append
330
+ # of request outputs to asyncio queues
331
+ self.process_request_outputs_callback: Optional[Callable] = None
332
+
333
+ # Create the scheduler.
334
+ # NOTE: the cache_config here have been updated with the numbers of
335
+ # GPU and CPU blocks, which are profiled in the distributed executor.
336
+ if isinstance(self.vllm_config.scheduler_config.scheduler_cls, str):
337
+ Scheduler = resolve_obj_by_qualname(
338
+ self.vllm_config.scheduler_config.scheduler_cls)
339
+ else:
340
+ Scheduler = self.vllm_config.scheduler_config.scheduler_cls
341
+ self.scheduler = [
342
+ Scheduler(
343
+ self.scheduler_config, self.cache_config, self.lora_config,
344
+ self.parallel_config.pipeline_parallel_size,
345
+ self.async_callbacks[v_id]
346
+ if self.model_config.use_async_output_proc else None)
347
+ for v_id in range(self.parallel_config.pipeline_parallel_size)
348
+ ]
349
+
350
+ # Metric Logging.
351
+ if self.log_stats:
352
+ if stat_loggers is not None:
353
+ self.stat_loggers = stat_loggers
354
+ else:
355
+ # Lazy import for prometheus multiprocessing.
356
+ # We need to set PROMETHEUS_MULTIPROC_DIR environment variable
357
+ # before prometheus_client is imported.
358
+ # See https://prometheus.github.io/client_python/multiprocess/
359
+ from vllm.engine.metrics import (LoggingStatLogger,
360
+ PrometheusStatLogger)
361
+
362
+ self.stat_loggers = {
363
+ "logging":
364
+ LoggingStatLogger(
365
+ local_interval=_LOCAL_LOGGING_INTERVAL_SEC,
366
+ vllm_config=vllm_config),
367
+ "prometheus":
368
+ PrometheusStatLogger(
369
+ local_interval=_LOCAL_LOGGING_INTERVAL_SEC,
370
+ labels=dict(
371
+ model_name=self.model_config.served_model_name),
372
+ vllm_config=vllm_config),
373
+ }
374
+ self.stat_loggers["prometheus"].info("cache_config",
375
+ self.cache_config)
376
+
377
+ self.tracer = None
378
+ if self.observability_config.otlp_traces_endpoint:
379
+ self.tracer = init_tracer(
380
+ "vllm.llm_engine",
381
+ self.observability_config.otlp_traces_endpoint)
382
+
383
+ # Create sequence output processor, e.g. for beam search or
384
+ # speculative decoding.
385
+ self.output_processor = (
386
+ SequenceGroupOutputProcessor.create_output_processor(
387
+ self.scheduler_config,
388
+ self.detokenizer,
389
+ self.scheduler,
390
+ self.seq_counter,
391
+ get_tokenizer_for_seq,
392
+ stop_checker=StopChecker(self.scheduler_config.max_model_len,
393
+ get_tokenizer_for_seq),
394
+ ))
395
+
396
+ self.seq_id_to_seq_group: Dict[str, SequenceGroupBase] = {}
397
+
398
+ # Flag to set when an input fails to process and the engine should run
399
+ # the next step without re-scheduling.
400
+ self._skip_scheduling_next_step = False
401
+
402
+ # Don't keep the dummy data in memory
403
+ self.reset_mm_cache()
404
+
405
+ def _initialize_kv_caches(self) -> None:
406
+ """Initialize the KV cache in the worker(s).
407
+
408
+ The workers will determine the number of blocks in both the GPU cache
409
+ and the swap CPU cache.
410
+ """
411
+ start = time.time()
412
+ num_gpu_blocks, num_cpu_blocks = (
413
+ self.model_executor.determine_num_available_blocks())
414
+
415
+ if self.cache_config.num_gpu_blocks_override is not None:
416
+ num_gpu_blocks_override = self.cache_config.num_gpu_blocks_override
417
+ logger.info(
418
+ "Overriding num_gpu_blocks=%d with "
419
+ "num_gpu_blocks_override=%d", num_gpu_blocks,
420
+ num_gpu_blocks_override)
421
+ num_gpu_blocks = num_gpu_blocks_override
422
+
423
+ self.cache_config.num_gpu_blocks = num_gpu_blocks
424
+ self.cache_config.num_cpu_blocks = num_cpu_blocks
425
+
426
+ self.model_executor.initialize_cache(num_gpu_blocks, num_cpu_blocks)
427
+ elapsed = time.time() - start
428
+ logger.info(("init engine (profile, create kv cache, "
429
+ "warmup model) took %.2f seconds"), elapsed)
430
+
431
+ @classmethod
432
+ def _get_executor_cls(cls,
433
+ engine_config: VllmConfig) -> Type[ExecutorBase]:
434
+ # distributed_executor_backend must be set in VllmConfig.__post_init__
435
+ distributed_executor_backend = (
436
+ engine_config.parallel_config.distributed_executor_backend)
437
+ # Initialize the cluster and specify the executor class.
438
+ if isinstance(distributed_executor_backend, type):
439
+ if not issubclass(distributed_executor_backend, ExecutorBase):
440
+ raise TypeError(
441
+ "distributed_executor_backend must be a subclass of "
442
+ f"ExecutorBase. Got {distributed_executor_backend}.")
443
+ executor_class = distributed_executor_backend
444
+ elif distributed_executor_backend == "ray":
445
+ from vllm.executor.ray_distributed_executor import (
446
+ RayDistributedExecutor)
447
+ executor_class = RayDistributedExecutor
448
+ elif distributed_executor_backend == "mp":
449
+ from vllm.executor.mp_distributed_executor import (
450
+ MultiprocessingDistributedExecutor)
451
+ assert not envs.VLLM_USE_RAY_SPMD_WORKER, (
452
+ "multiprocessing distributed executor backend does not "
453
+ "support VLLM_USE_RAY_SPMD_WORKER=1")
454
+ executor_class = MultiprocessingDistributedExecutor
455
+ elif distributed_executor_backend == "uni":
456
+ # JAX-style, single-process, multi-device executor.
457
+ from vllm.executor.uniproc_executor import UniProcExecutor
458
+ executor_class = UniProcExecutor
459
+ elif distributed_executor_backend == "external_launcher":
460
+ # executor with external launcher
461
+ from vllm.executor.uniproc_executor import ( # noqa
462
+ ExecutorWithExternalLauncher)
463
+ executor_class = ExecutorWithExternalLauncher
464
+ else:
465
+ raise ValueError("unrecognized distributed_executor_backend: "
466
+ f"{distributed_executor_backend}")
467
+ return executor_class
468
+
469
+ @classmethod
470
+ def from_vllm_config(
471
+ cls,
472
+ vllm_config: VllmConfig,
473
+ usage_context: UsageContext = UsageContext.ENGINE_CONTEXT,
474
+ stat_loggers: Optional[Dict[str, StatLoggerBase]] = None,
475
+ disable_log_stats: bool = False,
476
+ ) -> "LLMEngine":
477
+ return cls(
478
+ vllm_config=vllm_config,
479
+ executor_class=cls._get_executor_cls(vllm_config),
480
+ log_stats=(not disable_log_stats),
481
+ usage_context=usage_context,
482
+ stat_loggers=stat_loggers,
483
+ )
484
+
485
+ @classmethod
486
+ def from_engine_args(
487
+ cls,
488
+ engine_args: EngineArgs,
489
+ usage_context: UsageContext = UsageContext.ENGINE_CONTEXT,
490
+ stat_loggers: Optional[Dict[str, StatLoggerBase]] = None,
491
+ ) -> "LLMEngine":
492
+ """Creates an LLM engine from the engine arguments."""
493
+ # Create the engine configs.
494
+ vllm_config = engine_args.create_engine_config(usage_context)
495
+
496
+ engine_cls = cls
497
+ if envs.VLLM_USE_V1:
498
+ from vllm.v1.engine.llm_engine import LLMEngine as V1LLMEngine
499
+ engine_cls = V1LLMEngine
500
+
501
+ return engine_cls.from_vllm_config(
502
+ vllm_config=vllm_config,
503
+ usage_context=usage_context,
504
+ stat_loggers=stat_loggers,
505
+ disable_log_stats=engine_args.disable_log_stats,
506
+ )
507
+
508
+ def __reduce__(self):
509
+ # This is to ensure that the LLMEngine is not referenced in
510
+ # the closure used to initialize Ray worker actors
511
+ raise RuntimeError("LLMEngine should not be pickled!")
512
+
513
+ def __del__(self):
514
+ # Shutdown model executor when engine is garbage collected
515
+ # Use getattr since __init__ can fail before the field is set
516
+ if model_executor := getattr(self, "model_executor", None):
517
+ model_executor.shutdown()
518
+
519
+ def get_tokenizer_group(self) -> TokenizerGroup:
520
+ if self.tokenizer is None:
521
+ raise ValueError("Unable to get tokenizer because "
522
+ "skip_tokenizer_init is True")
523
+
524
+ return self.tokenizer
525
+
526
+ def get_tokenizer(
527
+ self,
528
+ lora_request: Optional[LoRARequest] = None,
529
+ ) -> AnyTokenizer:
530
+ return self.get_tokenizer_group().get_lora_tokenizer(lora_request)
531
+
532
+ def _init_tokenizer(self) -> TokenizerGroup:
533
+ return init_tokenizer_from_configs(
534
+ model_config=self.model_config,
535
+ scheduler_config=self.scheduler_config,
536
+ lora_config=self.lora_config)
537
+
538
+ def _verify_args(self) -> None:
539
+ self.model_config.verify_with_parallel_config(self.parallel_config)
540
+ self.cache_config.verify_with_parallel_config(self.parallel_config)
541
+ if self.lora_config:
542
+ self.lora_config.verify_with_model_config(self.model_config)
543
+ self.lora_config.verify_with_scheduler_config(
544
+ self.scheduler_config)
545
+ if self.prompt_adapter_config:
546
+ self.prompt_adapter_config.verify_with_model_config(
547
+ self.model_config)
548
+
549
+ def _add_processed_request(
550
+ self,
551
+ request_id: str,
552
+ processed_inputs: ProcessorInputs,
553
+ params: Union[SamplingParams, PoolingParams],
554
+ arrival_time: float,
555
+ lora_request: Optional[LoRARequest],
556
+ prompt_adapter_request: Optional[PromptAdapterRequest],
557
+ trace_headers: Optional[Mapping[str, str]] = None,
558
+ priority: int = 0,
559
+ ) -> Optional[SequenceGroup]:
560
+ """Add a processed request to the engine's request pool.
561
+ return the created sequence group.
562
+ """
563
+ if isinstance(params, SamplingParams) and params.n > 1:
564
+ ParallelSampleSequenceGroup.add_request(
565
+ request_id,
566
+ self,
567
+ params,
568
+ processed_inputs=processed_inputs,
569
+ arrival_time=arrival_time,
570
+ lora_request=lora_request,
571
+ trace_headers=trace_headers,
572
+ prompt_adapter_request=prompt_adapter_request,
573
+ priority=priority,
574
+ )
575
+ return None
576
+
577
+ self._validate_model_inputs(processed_inputs, lora_request)
578
+ # Create the sequences.
579
+ block_size = self.cache_config.block_size
580
+ seq_id = next(self.seq_counter)
581
+ eos_token_id = self.input_preprocessor.get_eos_token_id(lora_request)
582
+
583
+ encoder_inputs, decoder_inputs = split_enc_dec_inputs(processed_inputs)
584
+
585
+ seq = Sequence(seq_id, decoder_inputs, block_size, eos_token_id,
586
+ lora_request, prompt_adapter_request)
587
+
588
+ encoder_seq = (None if encoder_inputs is None else Sequence(
589
+ seq_id, encoder_inputs, block_size, eos_token_id, lora_request,
590
+ prompt_adapter_request))
591
+
592
+ # Create a SequenceGroup based on SamplingParams or PoolingParams
593
+ if isinstance(params, SamplingParams):
594
+ seq_group = self._create_sequence_group_with_sampling(
595
+ request_id,
596
+ seq,
597
+ params,
598
+ arrival_time=arrival_time,
599
+ lora_request=lora_request,
600
+ trace_headers=trace_headers,
601
+ prompt_adapter_request=prompt_adapter_request,
602
+ encoder_seq=encoder_seq,
603
+ priority=priority)
604
+ elif isinstance(params, PoolingParams):
605
+ seq_group = self._create_sequence_group_with_pooling(
606
+ request_id,
607
+ seq,
608
+ params,
609
+ arrival_time=arrival_time,
610
+ lora_request=lora_request,
611
+ prompt_adapter_request=prompt_adapter_request,
612
+ encoder_seq=encoder_seq,
613
+ priority=priority)
614
+ else:
615
+ raise ValueError(
616
+ "Either SamplingParams or PoolingParams must be provided.")
617
+
618
+ # Add the sequence group to the scheduler with least unfinished seqs.
619
+ costs = [
620
+ scheduler.get_num_unfinished_seq_groups()
621
+ for scheduler in self.scheduler
622
+ ]
623
+ min_cost_scheduler = self.scheduler[costs.index(min(costs))]
624
+ min_cost_scheduler.add_seq_group(seq_group)
625
+
626
+ return seq_group
627
+
628
+ def stop_remote_worker_execution_loop(self) -> None:
629
+ self.model_executor.stop_remote_worker_execution_loop()
630
+
631
+ def add_request(
632
+ self,
633
+ request_id: str,
634
+ prompt: PromptType,
635
+ params: Union[SamplingParams, PoolingParams],
636
+ arrival_time: Optional[float] = None,
637
+ lora_request: Optional[LoRARequest] = None,
638
+ tokenization_kwargs: Optional[dict[str, Any]] = None,
639
+ trace_headers: Optional[Mapping[str, str]] = None,
640
+ prompt_adapter_request: Optional[PromptAdapterRequest] = None,
641
+ priority: int = 0,
642
+ ) -> None:
643
+ """Add a request to the engine's request pool.
644
+
645
+ The request is added to the request pool and will be processed by the
646
+ scheduler as `engine.step()` is called. The exact scheduling policy is
647
+ determined by the scheduler.
648
+
649
+ Args:
650
+ request_id: The unique ID of the request.
651
+ prompt: The prompt to the LLM. See
652
+ [PromptType][vllm.inputs.PromptType]
653
+ for more details about the format of each input.
654
+ params: Parameters for sampling or pooling.
655
+ [SamplingParams][vllm.SamplingParams] for text generation.
656
+ [PoolingParams][vllm.PoolingParams] for pooling.
657
+ arrival_time: The arrival time of the request. If None, we use
658
+ the current monotonic time.
659
+ lora_request: The LoRA request to add.
660
+ trace_headers: OpenTelemetry trace headers.
661
+ prompt_adapter_request: The prompt adapter request to add.
662
+ priority: The priority of the request.
663
+ Only applicable with priority scheduling.
664
+
665
+ Details:
666
+ - Set arrival_time to the current time if it is None.
667
+ - Set prompt_token_ids to the encoded prompt if it is None.
668
+ - Create `n` number of [Sequence][vllm.Sequence] objects.
669
+ - Create a [SequenceGroup][vllm.SequenceGroup] object
670
+ from the list of [Sequence][vllm.Sequence].
671
+ - Add the [SequenceGroup][vllm.SequenceGroup] object to the
672
+ scheduler.
673
+
674
+ Example:
675
+ >>> # initialize engine
676
+ >>> engine = LLMEngine.from_engine_args(engine_args)
677
+ >>> # set request arguments
678
+ >>> example_prompt = "Who is the president of the United States?"
679
+ >>> sampling_params = SamplingParams(temperature=0.0)
680
+ >>> request_id = 0
681
+ >>>
682
+ >>> # add the request to the engine
683
+ >>> engine.add_request(
684
+ >>> str(request_id),
685
+ >>> example_prompt,
686
+ >>> SamplingParams(temperature=0.0))
687
+ >>> # continue the request processing
688
+ >>> ...
689
+ """
690
+ if lora_request is not None and not self.lora_config:
691
+ raise ValueError(f"Got lora_request {lora_request} but LoRA is "
692
+ "not enabled!")
693
+
694
+ if priority != 0 and not self.scheduler_config.policy == "priority":
695
+ raise ValueError(f"Got priority {priority} but "
696
+ "Priority scheduling is not enabled.")
697
+
698
+ if isinstance(params, SamplingParams) \
699
+ and (params.guided_decoding or params.logits_processors) \
700
+ and self.scheduler_config.num_scheduler_steps > 1:
701
+ raise ValueError(
702
+ "Guided decoding and logits processors are not supported "
703
+ "in multi-step decoding")
704
+
705
+ if arrival_time is None:
706
+ arrival_time = time.time()
707
+
708
+ if (isinstance(prompt, dict)
709
+ and prompt.get("prompt_embeds", None) is not None
710
+ and not prompt.get("prompt_token_ids", None)):
711
+ seq_len = prompt["prompt_embeds"].shape[0]
712
+ prompt["prompt_token_ids"] = [0] * seq_len
713
+
714
+ processed_inputs = self.input_preprocessor.preprocess(
715
+ prompt,
716
+ tokenization_kwargs=tokenization_kwargs,
717
+ lora_request=lora_request,
718
+ prompt_adapter_request=prompt_adapter_request,
719
+ )
720
+
721
+ self._add_processed_request(
722
+ request_id=request_id,
723
+ processed_inputs=processed_inputs,
724
+ params=params,
725
+ arrival_time=arrival_time,
726
+ lora_request=lora_request,
727
+ prompt_adapter_request=prompt_adapter_request,
728
+ trace_headers=trace_headers,
729
+ priority=priority,
730
+ )
731
+
732
+ def _create_sequence_group_with_sampling(
733
+ self,
734
+ request_id: str,
735
+ seq: Sequence,
736
+ sampling_params: SamplingParams,
737
+ arrival_time: float,
738
+ lora_request: Optional[LoRARequest],
739
+ trace_headers: Optional[Mapping[str, str]] = None,
740
+ prompt_adapter_request: Optional[PromptAdapterRequest] = None,
741
+ encoder_seq: Optional[Sequence] = None,
742
+ priority: int = 0,
743
+ ) -> SequenceGroup:
744
+ """Creates a SequenceGroup with SamplingParams."""
745
+ max_logprobs = self.get_model_config().max_logprobs
746
+ if (sampling_params.logprobs
747
+ and sampling_params.logprobs > max_logprobs) or (
748
+ sampling_params.prompt_logprobs
749
+ and sampling_params.prompt_logprobs > max_logprobs):
750
+ raise ValueError(f"Cannot request more than "
751
+ f"{max_logprobs} logprobs.")
752
+
753
+ sampling_params = self._build_logits_processors(
754
+ sampling_params, lora_request)
755
+
756
+ # Defensive copy of SamplingParams, which are used by the sampler,
757
+ # this doesn't deep-copy LogitsProcessor objects
758
+ sampling_params = sampling_params.clone()
759
+
760
+ sampling_params.update_from_generation_config(
761
+ self.generation_config_fields, seq.eos_token_id)
762
+
763
+ # Create the sequence group.
764
+ draft_size = 1
765
+ if self.vllm_config.speculative_config is not None:
766
+ draft_size = \
767
+ self.vllm_config.speculative_config.num_speculative_tokens + 1
768
+ seq_group = SequenceGroup(
769
+ request_id=request_id,
770
+ seqs=[seq],
771
+ arrival_time=arrival_time,
772
+ sampling_params=sampling_params,
773
+ lora_request=lora_request,
774
+ trace_headers=trace_headers,
775
+ prompt_adapter_request=prompt_adapter_request,
776
+ encoder_seq=encoder_seq,
777
+ priority=priority,
778
+ draft_size=draft_size)
779
+
780
+ return seq_group
781
+
782
+ def _create_sequence_group_with_pooling(
783
+ self,
784
+ request_id: str,
785
+ seq: Sequence,
786
+ pooling_params: PoolingParams,
787
+ arrival_time: float,
788
+ lora_request: Optional[LoRARequest],
789
+ prompt_adapter_request: Optional[PromptAdapterRequest],
790
+ encoder_seq: Optional[Sequence] = None,
791
+ priority: int = 0,
792
+ ) -> SequenceGroup:
793
+ """Creates a SequenceGroup with PoolingParams."""
794
+ # Defensive copy of PoolingParams, which are used by the pooler
795
+ pooling_params = pooling_params.clone()
796
+ # Create the sequence group.
797
+ seq_group = SequenceGroup(
798
+ request_id=request_id,
799
+ seqs=[seq],
800
+ arrival_time=arrival_time,
801
+ lora_request=lora_request,
802
+ pooling_params=pooling_params,
803
+ prompt_adapter_request=prompt_adapter_request,
804
+ encoder_seq=encoder_seq,
805
+ priority=priority)
806
+ return seq_group
807
+
808
+ def abort_request(self, request_id: Union[str, Iterable[str]]) -> None:
809
+ """Aborts a request(s) with the given ID.
810
+
811
+ Args:
812
+ request_id: The ID(s) of the request to abort.
813
+
814
+ Details:
815
+ - Refer to [vllm.core.scheduler.Scheduler.abort_seq_group][].
816
+
817
+ Example:
818
+ >>> # initialize engine and add a request with request_id
819
+ >>> request_id = str(0)
820
+ >>> # abort the request
821
+ >>> engine.abort_request(request_id)
822
+ """
823
+ for scheduler in self.scheduler:
824
+ scheduler.abort_seq_group(
825
+ request_id, seq_id_to_seq_group=self.seq_id_to_seq_group)
826
+
827
+ def get_vllm_config(self) -> VllmConfig:
828
+ """Gets the vllm configuration."""
829
+ return self.vllm_config
830
+
831
+ def get_model_config(self) -> ModelConfig:
832
+ """Gets the model configuration."""
833
+ return self.model_config
834
+
835
+ def get_parallel_config(self) -> ParallelConfig:
836
+ """Gets the parallel configuration."""
837
+ return self.parallel_config
838
+
839
+ def get_decoding_config(self) -> DecodingConfig:
840
+ """Gets the decoding configuration."""
841
+ return self.decoding_config
842
+
843
+ def get_scheduler_config(self) -> SchedulerConfig:
844
+ """Gets the scheduler configuration."""
845
+ return self.scheduler_config
846
+
847
+ def get_lora_config(self) -> LoRAConfig:
848
+ """Gets the LoRA configuration."""
849
+ return self.lora_config
850
+
851
+ def get_num_unfinished_requests(self) -> int:
852
+ """Gets the number of unfinished requests."""
853
+ return sum(scheduler.get_num_unfinished_seq_groups()
854
+ for scheduler in self.scheduler)
855
+
856
+ def has_unfinished_requests(self) -> bool:
857
+ """Returns True if there are unfinished requests."""
858
+ return any(scheduler.has_unfinished_seqs()
859
+ for scheduler in self.scheduler)
860
+
861
+ def has_unfinished_requests_for_virtual_engine(
862
+ self, virtual_engine: int) -> bool:
863
+ """
864
+ Returns True if there are unfinished requests for the virtual engine.
865
+ """
866
+ return self.scheduler[virtual_engine].has_unfinished_seqs()
867
+
868
+ def reset_mm_cache(self) -> bool:
869
+ """Reset the multi-modal cache."""
870
+ return self.input_preprocessor.mm_registry.reset_processor_cache()
871
+
872
+ def reset_prefix_cache(self, device: Optional[Device] = None) -> bool:
873
+ """Reset prefix cache for all devices."""
874
+
875
+ success = True
876
+ for scheduler in self.scheduler:
877
+ success = success and scheduler.reset_prefix_cache(device)
878
+ return success
879
+
880
+ @staticmethod
881
+ def _process_sequence_group_outputs(
882
+ seq_group: SequenceGroup,
883
+ outputs: List[PoolingSequenceGroupOutput],
884
+ ) -> None:
885
+ seq_group.pooled_data = outputs[0].data
886
+
887
+ for seq in seq_group.get_seqs():
888
+ seq.status = SequenceStatus.FINISHED_STOPPED
889
+
890
+ return
891
+
892
+ def _update_num_computed_tokens_for_multi_step_prefill(
893
+ self, seq_group: SequenceGroup,
894
+ seq_group_meta: SequenceGroupMetadata,
895
+ is_first_step_output: Optional[bool]):
896
+ """
897
+ This function updates num_computed_tokens for prompt sequences
898
+ when Multi-Step is enabled.
899
+
900
+ seq_group: SequenceGroup to update the num_computed_tokens for.
901
+ seq_group_meta: Metadata of the given SequenceGroup.
902
+ is_first_step_output: Optional[bool] -
903
+ When available, is_first_step_output indicates if the appended
904
+ output token is the output of the first-step in multi-step.
905
+ A value of None indicates that outputs from all steps in
906
+ in multi-step are submitted in a single burst.
907
+ """
908
+
909
+ assert self.scheduler_config.is_multi_step
910
+
911
+ if not seq_group_meta.is_prompt:
912
+ # num_computed_token updates for multi-step decodes happen after
913
+ # the tokens are appended to the sequence.
914
+ return
915
+
916
+ do_update: bool = False
917
+ if self.scheduler_config.chunked_prefill_enabled:
918
+ # In multi-step + chunked-prefill case, the prompt sequences
919
+ # that are scheduled are fully processed in the first step.
920
+ do_update = is_first_step_output is None or is_first_step_output
921
+ else:
922
+ # Normal multi-step decoding case. In this case prompt-sequences
923
+ # are actually single-stepped. Always update in this case.
924
+ assert seq_group.state.num_steps == 1
925
+ do_update = True
926
+
927
+ if do_update:
928
+ seq_group.update_num_computed_tokens(
929
+ seq_group_meta.token_chunk_size)
930
+
931
+ def _process_model_outputs(self,
932
+ ctx: SchedulerContext,
933
+ request_id: Optional[str] = None) -> None:
934
+ """Apply the model output to the sequences in the scheduled seq groups
935
+ and return responses.
936
+
937
+ ctx: The virtual engine context to work on
938
+ request_id: If provided, then only this request is going to be processed
939
+ """
940
+
941
+ now = time.time()
942
+
943
+ if len(ctx.output_queue) == 0:
944
+ return None
945
+
946
+ # Get pending async postprocessor
947
+ if request_id:
948
+ # When we process only one request, no pop is required
949
+ # (since later we will process all of the rest)
950
+ (outputs, seq_group_metadata_list, scheduler_outputs, is_async,
951
+ is_last_step, is_first_step_output, skip) = ctx.output_queue[0]
952
+ else:
953
+ (outputs, seq_group_metadata_list, scheduler_outputs, is_async,
954
+ is_last_step, is_first_step_output,
955
+ skip) = ctx.output_queue.popleft()
956
+
957
+ # Sanity check
958
+ assert len(seq_group_metadata_list) == len(
959
+ scheduler_outputs.scheduled_seq_groups)
960
+
961
+ has_multiple_outputs: bool = len(outputs) > 1
962
+ outputs_by_sequence_group: List[List[SequenceGroupOutput]]
963
+ if has_multiple_outputs:
964
+ assert self.scheduler_config.is_multi_step or \
965
+ self.speculative_config
966
+ # Organize outputs by [step][sequence group] instead of
967
+ # [sequence group][step].
968
+ if self.scheduler_config.is_multi_step:
969
+ outputs_by_sequence_group = create_output_by_sequence_group(
970
+ outputs, len(seq_group_metadata_list))
971
+ elif self.speculative_config:
972
+ # Decodes are multi-steps while prefills are not, outputting at
973
+ # most 1 token. Separate them so that we can trigger chunk
974
+ # processing without having to pad or copy over prompts K times
975
+ # to match decodes structure (costly with prompt_logprobs).
976
+ num_prefills = sum(sg.is_prompt
977
+ for sg in seq_group_metadata_list)
978
+ prefills, decodes = outputs[:num_prefills], outputs[
979
+ num_prefills:]
980
+ outputs_by_sequence_group = create_output_by_sequence_group(
981
+ decodes,
982
+ num_seq_groups=len(seq_group_metadata_list) - num_prefills)
983
+ outputs_by_sequence_group = [p.outputs for p in prefills
984
+ ] + outputs_by_sequence_group
985
+ # We have outputs for multiple steps submitted in a single burst,
986
+ # so invalidate is_first_step_output.
987
+ is_first_step_output = None
988
+ else:
989
+ outputs_by_sequence_group = outputs
990
+
991
+ # Determine the requests we need to operate on
992
+ if request_id:
993
+ indices = []
994
+ for i, seq_group_meta in enumerate(seq_group_metadata_list):
995
+ if seq_group_meta.request_id == request_id:
996
+ assert i not in skip # Cannot be called twice
997
+ indices.append(i)
998
+ break
999
+
1000
+ # If the request_id was not found, then it means that
1001
+ # this is a new request that has no pending async
1002
+ # postprocessor
1003
+ if not indices:
1004
+ return
1005
+ else:
1006
+ indices = range(len(seq_group_metadata_list)) # type: ignore
1007
+
1008
+ finished_before: List[int] = []
1009
+ finished_now: List[int] = []
1010
+ for i in indices:
1011
+ if i in skip:
1012
+ continue
1013
+
1014
+ seq_group_meta = seq_group_metadata_list[i]
1015
+ scheduled_seq_group = scheduler_outputs.scheduled_seq_groups[i]
1016
+
1017
+ seq_group: SequenceGroup = scheduled_seq_group.seq_group
1018
+
1019
+ if seq_group.is_finished():
1020
+ finished_before.append(i)
1021
+ continue
1022
+
1023
+ output: List[SequenceGroupOutput]
1024
+ if has_multiple_outputs:
1025
+ output = outputs_by_sequence_group[i]
1026
+ else:
1027
+ output = [outputs_by_sequence_group[0][i]]
1028
+
1029
+ if not is_async:
1030
+ if self.scheduler_config.is_multi_step:
1031
+ # Updates happen only if the sequence is prefill
1032
+ self._update_num_computed_tokens_for_multi_step_prefill(
1033
+ seq_group, seq_group_meta, is_first_step_output)
1034
+ else:
1035
+ seq_group.update_num_computed_tokens(
1036
+ seq_group_meta.token_chunk_size or 0)
1037
+
1038
+ if outputs:
1039
+ for o in outputs:
1040
+ if (isinstance(o, SamplerOutput)
1041
+ and seq_group.metrics is not None):
1042
+ if seq_group.metrics.model_forward_time is not None:
1043
+ seq_group.metrics.model_forward_time += (
1044
+ o.model_forward_time or 0)
1045
+ else:
1046
+ seq_group.metrics.model_forward_time = (
1047
+ o.model_forward_time)
1048
+ if seq_group.metrics.model_execute_time is not None:
1049
+ seq_group.metrics.model_execute_time += (
1050
+ o.model_execute_time or 0)
1051
+ else:
1052
+ seq_group.metrics.model_execute_time = (
1053
+ o.model_execute_time)
1054
+
1055
+ if self.model_config.runner_type == "pooling":
1056
+ self._process_sequence_group_outputs(seq_group, output)
1057
+ else:
1058
+ self.output_processor.process_prompt_logprob(seq_group, output)
1059
+ if seq_group_meta.do_sample:
1060
+ self.output_processor.process_outputs(
1061
+ seq_group, output, is_async)
1062
+
1063
+ if seq_group.is_finished():
1064
+ finished_now.append(i)
1065
+
1066
+ # Generate outputs for the requests that finished this iteration
1067
+ for i in finished_now:
1068
+ scheduled_seq_group = scheduler_outputs.scheduled_seq_groups[i]
1069
+
1070
+ seq_group = scheduled_seq_group.seq_group
1071
+ seq_group.maybe_set_first_token_time(now)
1072
+ if not seq_group.is_prefill():
1073
+ seq_group.set_last_token_time(now)
1074
+ request_output = RequestOutputFactory.create(
1075
+ seq_group,
1076
+ self.seq_id_to_seq_group,
1077
+ use_cache=self.use_cached_outputs)
1078
+ if request_output:
1079
+ ctx.request_outputs.append(request_output)
1080
+
1081
+ # When we process a single request, we skip it for the next time,
1082
+ # and invoke the request output callback (if there was final output)
1083
+ if request_id:
1084
+ assert len(indices) == 1
1085
+ skip.append(indices[0])
1086
+
1087
+ if (finished_now
1088
+ and self.process_request_outputs_callback is not None):
1089
+ self.process_request_outputs_callback(ctx.request_outputs)
1090
+ ctx.request_outputs.clear()
1091
+ return
1092
+
1093
+ # Free currently finished requests
1094
+ if finished_now:
1095
+ for scheduler in self.scheduler:
1096
+ scheduler.free_finished_seq_groups()
1097
+
1098
+ # For multi-step without streaming, don't create outputs each iteration
1099
+ if not is_last_step and not ctx.multi_step_stream_outputs:
1100
+ # Immediately process request outputs here (if callback is given)
1101
+ if (finished_now
1102
+ and self.process_request_outputs_callback is not None):
1103
+ self.process_request_outputs_callback(ctx.request_outputs)
1104
+ ctx.request_outputs.clear()
1105
+ return
1106
+
1107
+ # Create the outputs
1108
+ for i in indices:
1109
+ if i in skip or i in finished_before or i in finished_now:
1110
+ continue # Avoids double processing
1111
+
1112
+ scheduled_seq_group = scheduler_outputs.scheduled_seq_groups[i]
1113
+
1114
+ seq_group = scheduled_seq_group.seq_group
1115
+ seq_group.maybe_set_first_token_time(now)
1116
+ if not seq_group.is_prefill():
1117
+ seq_group.set_last_token_time(now)
1118
+ request_output = RequestOutputFactory.create(
1119
+ seq_group,
1120
+ self.seq_id_to_seq_group,
1121
+ use_cache=self.use_cached_outputs)
1122
+ if request_output:
1123
+ ctx.request_outputs.append(request_output)
1124
+
1125
+ # For multi-step with streaming, create outputs each iteration
1126
+ if not is_last_step and ctx.multi_step_stream_outputs:
1127
+ # Immediately process request outputs here (if callback is given)
1128
+ if self.process_request_outputs_callback is not None:
1129
+ self.process_request_outputs_callback(ctx.request_outputs)
1130
+ ctx.request_outputs.clear()
1131
+ return
1132
+
1133
+ for seq_group in scheduler_outputs.ignored_seq_groups:
1134
+ params = seq_group.sampling_params
1135
+ if params is not None and params.output_kind == (
1136
+ RequestOutputKind.DELTA) and not seq_group.is_finished():
1137
+ continue
1138
+
1139
+ request_output = RequestOutputFactory.create(
1140
+ seq_group,
1141
+ self.seq_id_to_seq_group,
1142
+ use_cache=self.use_cached_outputs,
1143
+ )
1144
+ if request_output:
1145
+ ctx.request_outputs.append(request_output)
1146
+
1147
+ # Immediately process request outputs here (if callback is given)
1148
+ if (ctx.request_outputs
1149
+ and self.process_request_outputs_callback is not None):
1150
+ self.process_request_outputs_callback(ctx.request_outputs)
1151
+ ctx.request_outputs.clear()
1152
+
1153
+ # For async case, we need to record the stats here.
1154
+ # For non-async case, the stats are done in the
1155
+ # LLMEngine/AsyncLLMEngine directly
1156
+ if is_async:
1157
+ # Log stats.
1158
+ self.do_log_stats(scheduler_outputs, outputs, finished_before,
1159
+ skip)
1160
+
1161
+ # Tracing
1162
+ self.do_tracing(scheduler_outputs, finished_before)
1163
+
1164
+ return None
1165
+
1166
+ def _advance_to_next_step(
1167
+ self, output: SamplerOutput,
1168
+ seq_group_metadata_list: List[SequenceGroupMetadata],
1169
+ scheduled_seq_groups: List[ScheduledSequenceGroup]) -> None:
1170
+ """Given model output from a single run, append the tokens to the
1171
+ sequences. This is normally done inside output processor, but it is
1172
+ required if the worker is to perform async forward pass to next step.
1173
+ """
1174
+ for seq_group_metadata, sequence_group_outputs, scheduled_seq_group in \
1175
+ zip(seq_group_metadata_list, output, scheduled_seq_groups):
1176
+ seq_group = scheduled_seq_group.seq_group
1177
+
1178
+ if seq_group.is_finished():
1179
+ continue
1180
+
1181
+ if self.scheduler_config.is_multi_step:
1182
+ # Updates happen only if the sequence is prefill
1183
+ self._update_num_computed_tokens_for_multi_step_prefill(
1184
+ seq_group, seq_group_metadata,
1185
+ seq_group.state.num_steps == 1)
1186
+ else:
1187
+ token_chunk_size = (seq_group_metadata.token_chunk_size
1188
+ if seq_group_metadata.token_chunk_size
1189
+ is not None else 0)
1190
+ seq_group.update_num_computed_tokens(token_chunk_size)
1191
+
1192
+ if seq_group_metadata.do_sample:
1193
+ assert len(sequence_group_outputs.samples) == 1, (
1194
+ "Async output processor expects a single sample"
1195
+ " (i.e sampling_params.n == 1)")
1196
+ sample = sequence_group_outputs.samples[0]
1197
+
1198
+ assert len(seq_group.seqs) == 1
1199
+ seq = seq_group.seqs[0]
1200
+
1201
+ if self.scheduler_config.is_multi_step:
1202
+ is_prefill_append = seq.data.get_num_uncomputed_tokens(
1203
+ ) == 0
1204
+ seq.append_token_id(sample.output_token, sample.logprobs,
1205
+ sample.output_embed)
1206
+ if not is_prefill_append:
1207
+ seq_group.update_num_computed_tokens(1)
1208
+ else:
1209
+ seq.append_token_id(sample.output_token, sample.logprobs,
1210
+ sample.output_embed)
1211
+
1212
+ def step(self) -> List[Union[RequestOutput, PoolingRequestOutput]]:
1213
+ """Performs one decoding iteration and returns newly generated results.
1214
+
1215
+ <figure markdown="span">
1216
+ ![Overview of the step function](https://i.imgur.com/sv2HssD.png)
1217
+ <figcaption>Overview of the step function</figcaption>
1218
+ </figure>
1219
+
1220
+ Details:
1221
+ - Step 1: Schedules the sequences to be executed in the next
1222
+ iteration and the token blocks to be swapped in/out/copy.
1223
+
1224
+ - Depending on the scheduling policy,
1225
+ sequences may be `preempted/reordered`.
1226
+ - A Sequence Group (SG) refer to a group of sequences
1227
+ that are generated from the same prompt.
1228
+
1229
+ - Step 2: Calls the distributed executor to execute the model.
1230
+ - Step 3: Processes the model output. This mainly includes:
1231
+
1232
+ - Decodes the relevant outputs.
1233
+ - Updates the scheduled sequence groups with model outputs
1234
+ based on its `sampling parameters` (`use_beam_search` or not).
1235
+ - Frees the finished sequence groups.
1236
+
1237
+ - Finally, it creates and returns the newly generated results.
1238
+
1239
+ Example:
1240
+ ```
1241
+ # Please see the example/ folder for more detailed examples.
1242
+
1243
+ # initialize engine and request arguments
1244
+ engine = LLMEngine.from_engine_args(engine_args)
1245
+ example_inputs = [(0, "What is LLM?",
1246
+ SamplingParams(temperature=0.0))]
1247
+
1248
+ # Start the engine with an event loop
1249
+ while True:
1250
+ if example_inputs:
1251
+ req_id, prompt, sampling_params = example_inputs.pop(0)
1252
+ engine.add_request(str(req_id),prompt,sampling_params)
1253
+
1254
+ # continue the request processing
1255
+ request_outputs = engine.step()
1256
+ for request_output in request_outputs:
1257
+ if request_output.finished:
1258
+ # return or show the request output
1259
+
1260
+ if not (engine.has_unfinished_requests() or example_inputs):
1261
+ break
1262
+ ```
1263
+ """
1264
+ if self.parallel_config.pipeline_parallel_size > 1:
1265
+ raise NotImplementedError(
1266
+ "Pipeline parallelism is only supported through AsyncLLMEngine "
1267
+ "as performance will be severely degraded otherwise.")
1268
+
1269
+ # For llm_engine, there is no pipeline parallel support, so the engine
1270
+ # used is always 0.
1271
+ virtual_engine = 0
1272
+
1273
+ # These are cached outputs from previous iterations. None if on first
1274
+ # iteration
1275
+ cached_outputs = self.cached_scheduler_outputs[virtual_engine]
1276
+ seq_group_metadata_list = cached_outputs.seq_group_metadata_list
1277
+ scheduler_outputs = cached_outputs.scheduler_outputs
1278
+ allow_async_output_proc = cached_outputs.allow_async_output_proc
1279
+
1280
+ ctx = self.scheduler_contexts[virtual_engine]
1281
+
1282
+ # Clear outputs for each new scheduler iteration
1283
+ ctx.request_outputs.clear()
1284
+
1285
+ # Skip the scheduler if there are any remaining steps in the seq groups.
1286
+ # This ensures that the scheduler is only called again when the current
1287
+ # batch has completed.
1288
+ # The scheduler is also skipped if a single request caused the last
1289
+ # engine step to fail, and the previous schedule needs to be rerun.
1290
+ if not self._has_remaining_steps(
1291
+ seq_group_metadata_list
1292
+ ) and not self._skip_scheduling_next_step:
1293
+ # Schedule iteration
1294
+ (seq_group_metadata_list, scheduler_outputs,
1295
+ allow_async_output_proc
1296
+ ) = self.scheduler[virtual_engine].schedule()
1297
+
1298
+ ctx.seq_group_metadata_list = seq_group_metadata_list
1299
+ ctx.scheduler_outputs = scheduler_outputs
1300
+
1301
+ finished_requests_ids = self.scheduler[
1302
+ virtual_engine].get_and_reset_finished_requests_ids()
1303
+ # When n>1, elements in self.seq_id_to_seq_group should be deleted
1304
+ # here, otherwise memory leaks.
1305
+ for finished_request_id in finished_requests_ids:
1306
+ if finished_request_id in self.seq_id_to_seq_group:
1307
+ del self.seq_id_to_seq_group[finished_request_id]
1308
+
1309
+ # Maybe switch from async mode to sync mode
1310
+ if not allow_async_output_proc and len(ctx.output_queue) > 0:
1311
+ self._process_model_outputs(ctx=ctx)
1312
+
1313
+ if (self.scheduler_config.is_multi_step
1314
+ and scheduler_outputs.num_lookahead_slots > 0):
1315
+ # cache the scheduler outputs for the next iteration if we have
1316
+ # lookahead slots
1317
+ self._cache_scheduler_outputs_for_multi_step(
1318
+ virtual_engine, seq_group_metadata_list, scheduler_outputs,
1319
+ allow_async_output_proc)
1320
+ else:
1321
+ finished_requests_ids = list()
1322
+
1323
+ assert seq_group_metadata_list is not None
1324
+ assert scheduler_outputs is not None
1325
+
1326
+ if not scheduler_outputs.is_empty():
1327
+
1328
+ # Check if we have a cached last_output from the previous iteration.
1329
+ # For supporting PP this is probably the best way to pass the
1330
+ # sampled_token_ids, as a separate broadcast over all the PP stages
1331
+ # will cause one virtual engine's microbatch to block the pipeline.
1332
+ last_sampled_token_ids = \
1333
+ self._get_last_sampled_token_ids(virtual_engine)
1334
+
1335
+ execute_model_req = ExecuteModelRequest(
1336
+ seq_group_metadata_list=seq_group_metadata_list,
1337
+ blocks_to_swap_in=scheduler_outputs.blocks_to_swap_in,
1338
+ blocks_to_swap_out=scheduler_outputs.blocks_to_swap_out,
1339
+ blocks_to_copy=scheduler_outputs.blocks_to_copy,
1340
+ num_lookahead_slots=scheduler_outputs.num_lookahead_slots,
1341
+ running_queue_size=scheduler_outputs.running_queue_size,
1342
+ finished_requests_ids=finished_requests_ids,
1343
+ # We use ExecuteModelRequest to pass the last sampled_token_ids
1344
+ # to each of the non-last PP stages for in-place prepare_input.
1345
+ last_sampled_token_ids=last_sampled_token_ids)
1346
+
1347
+ if allow_async_output_proc:
1348
+ execute_model_req.async_callback = self.async_callbacks[
1349
+ virtual_engine]
1350
+
1351
+ try:
1352
+ outputs = self.model_executor.execute_model(
1353
+ execute_model_req=execute_model_req)
1354
+ self._skip_scheduling_next_step = False
1355
+ except InputProcessingError as e:
1356
+ # The input for this request cannot be processed, so we must
1357
+ # abort it. If there are remaining requests in the batch that
1358
+ # have been scheduled, they will be retried on the next step.
1359
+ invalid_request_id = e.request_id
1360
+ self._abort_and_cache_schedule(
1361
+ request_id=invalid_request_id,
1362
+ virtual_engine=virtual_engine,
1363
+ seq_group_metadata_list=seq_group_metadata_list,
1364
+ scheduler_outputs=scheduler_outputs,
1365
+ allow_async_output_proc=allow_async_output_proc)
1366
+ # Raise so the caller is notified that this request failed
1367
+ raise
1368
+
1369
+ # We need to do this here so that last step's sampled_token_ids can
1370
+ # be passed to the next iteration for PP.
1371
+ if self.scheduler_config.is_multi_step:
1372
+ self._update_cached_scheduler_output(virtual_engine, outputs)
1373
+ else:
1374
+ # Nothing scheduled => If there is pending async postprocessor,
1375
+ # then finish it here.
1376
+ if len(ctx.output_queue) > 0:
1377
+ self._process_model_outputs(ctx=ctx)
1378
+ # No outputs in this case
1379
+ outputs = []
1380
+
1381
+ # Finish the current step for all the sequence groups.
1382
+ if self.scheduler_config.is_multi_step:
1383
+ for seq_group in seq_group_metadata_list:
1384
+ seq_group.finish_step()
1385
+
1386
+ if not self._has_remaining_steps(seq_group_metadata_list):
1387
+ # clear the cache if we have finished all the steps.
1388
+ if self.scheduler_config.is_multi_step:
1389
+ self.cached_scheduler_outputs[0] = SchedulerOutputState()
1390
+
1391
+ # is_first_step_output is True only when the num_steps of all
1392
+ # the sequences are 1. When the num_steps > 1,
1393
+ # multi_step_model_runner does the first-step output append.
1394
+ is_first_step_output: bool = False if not seq_group_metadata_list \
1395
+ else seq_group_metadata_list[0].state.num_steps == 1
1396
+
1397
+ # Add results to the output_queue
1398
+ ctx.append_output(outputs=outputs,
1399
+ seq_group_metadata_list=seq_group_metadata_list,
1400
+ scheduler_outputs=scheduler_outputs,
1401
+ is_async=allow_async_output_proc,
1402
+ is_last_step=True,
1403
+ is_first_step_output=is_first_step_output)
1404
+
1405
+ if outputs and allow_async_output_proc:
1406
+ assert len(outputs) == 1, (
1407
+ "Async postprocessor expects only a single output set")
1408
+
1409
+ self._advance_to_next_step(
1410
+ outputs[0], seq_group_metadata_list,
1411
+ scheduler_outputs.scheduled_seq_groups)
1412
+
1413
+ # Check if need to run the usual non-async path
1414
+ if not allow_async_output_proc:
1415
+ self._process_model_outputs(ctx=ctx)
1416
+
1417
+ # Log stats.
1418
+ self.do_log_stats(scheduler_outputs, outputs)
1419
+
1420
+ # Tracing
1421
+ self.do_tracing(scheduler_outputs)
1422
+ else:
1423
+ # Multi-step case
1424
+ return ctx.request_outputs
1425
+
1426
+ if not self.has_unfinished_requests():
1427
+ # Drain async postprocessor (if exists)
1428
+ if len(ctx.output_queue) > 0:
1429
+ self._process_model_outputs(ctx=ctx)
1430
+ assert len(ctx.output_queue) == 0
1431
+
1432
+ # Stop the execute model loop in parallel workers until there are
1433
+ # more requests to process. This avoids waiting indefinitely in
1434
+ # torch.distributed ops which may otherwise timeout, and unblocks
1435
+ # the RPC thread in the workers so that they can process any other
1436
+ # queued control plane messages, such as add/remove lora adapters.
1437
+ logger.debug("Stopping remote worker execution loop.")
1438
+ self.model_executor.stop_remote_worker_execution_loop()
1439
+
1440
+ return ctx.request_outputs
1441
+
1442
+ def _abort_and_cache_schedule(
1443
+ self, request_id: str, virtual_engine: int,
1444
+ seq_group_metadata_list: List[SequenceGroupMetadata],
1445
+ scheduler_outputs: SchedulerOutputs,
1446
+ allow_async_output_proc: bool) -> None:
1447
+ """Aborts a single request, and caches the scheduler outputs minus that
1448
+ request. This allows the next step to continue processing the remaining
1449
+ requests without having to re-run the scheduler."""
1450
+
1451
+ # Abort the request and remove its sequence group from the current
1452
+ # schedule
1453
+ self.abort_request(request_id)
1454
+ for i, metadata in enumerate(seq_group_metadata_list):
1455
+ if metadata.request_id == request_id:
1456
+ del seq_group_metadata_list[i]
1457
+ break
1458
+ for i, group in enumerate(scheduler_outputs.scheduled_seq_groups):
1459
+ if group.seq_group.request_id == request_id:
1460
+ del scheduler_outputs.scheduled_seq_groups[i]
1461
+ break
1462
+
1463
+ # If there are still other sequence groups left in the schedule, cache
1464
+ # them and flag the engine to reuse the schedule.
1465
+ if len(seq_group_metadata_list) > 0:
1466
+ self._skip_scheduling_next_step = True
1467
+ # Reuse multi-step caching logic
1468
+ self._cache_scheduler_outputs_for_multi_step(
1469
+ virtual_engine=virtual_engine,
1470
+ scheduler_outputs=scheduler_outputs,
1471
+ seq_group_metadata_list=seq_group_metadata_list,
1472
+ allow_async_output_proc=allow_async_output_proc)
1473
+
1474
+ def _has_remaining_steps(
1475
+ self, seq_group_metadata_list: Optional[List[SequenceGroupMetadata]]
1476
+ ) -> bool:
1477
+ if (not self.scheduler_config.is_multi_step
1478
+ or not seq_group_metadata_list):
1479
+ return False
1480
+
1481
+ # TODO(will) this is a sanity check for nowto make sure that all the
1482
+ # seqs are on the same steps. Eventually we will want to do some sort of
1483
+ # dynamic scheduling when doing multi-step decoding.
1484
+ ref_remaining_steps = seq_group_metadata_list[0].state.remaining_steps
1485
+ if any([
1486
+ seq_group.state.remaining_steps != ref_remaining_steps
1487
+ for seq_group in seq_group_metadata_list[1:]
1488
+ ]):
1489
+ raise AssertionError("All running sequence groups should "
1490
+ "have the same remaining steps.")
1491
+
1492
+ return ref_remaining_steps > 0
1493
+
1494
+ def _cache_scheduler_outputs_for_multi_step(
1495
+ self, virtual_engine: int,
1496
+ seq_group_metadata_list: Optional[List[SequenceGroupMetadata]],
1497
+ scheduler_outputs: SchedulerOutputs,
1498
+ allow_async_output_proc: bool) -> None:
1499
+ co = self.cached_scheduler_outputs[virtual_engine]
1500
+
1501
+ co.seq_group_metadata_list = seq_group_metadata_list
1502
+ co.scheduler_outputs = scheduler_outputs
1503
+ co.allow_async_output_proc = allow_async_output_proc
1504
+ co.last_output = None
1505
+
1506
+ def _update_cached_scheduler_output(
1507
+ self, virtual_engine: int,
1508
+ output: List[Optional[SamplerOutput]]) -> None:
1509
+ if (self.parallel_config.pipeline_parallel_size > 1 and len(output) > 0
1510
+ and output[0] is not None):
1511
+ last_output = output[-1]
1512
+ assert last_output is not None
1513
+ assert last_output.sampled_token_ids_cpu is not None
1514
+ assert last_output.sampled_token_ids is None
1515
+ assert last_output.sampled_token_probs is None
1516
+ self.cached_scheduler_outputs[
1517
+ virtual_engine].last_output = last_output
1518
+
1519
+ def _get_last_sampled_token_ids(
1520
+ self, virtual_engine: int) -> Optional[torch.Tensor]:
1521
+ cached_last_output = self.cached_scheduler_outputs[
1522
+ virtual_engine].last_output
1523
+ if (self.scheduler_config.is_multi_step
1524
+ and self.parallel_config.pipeline_parallel_size > 1
1525
+ and cached_last_output is not None
1526
+ and cached_last_output.sampled_token_ids_cpu is not None):
1527
+ return cached_last_output.sampled_token_ids_cpu
1528
+ return None
1529
+
1530
+ def add_logger(self, logger_name: str, logger: StatLoggerBase) -> None:
1531
+ if not self.log_stats:
1532
+ raise RuntimeError(
1533
+ "Stat logging is disabled. Set `disable_log_stats=False` "
1534
+ "argument to enable.")
1535
+ if logger_name in self.stat_loggers:
1536
+ raise KeyError(f"Logger with name {logger_name} already exists.")
1537
+ self.stat_loggers[logger_name] = logger
1538
+
1539
+ def remove_logger(self, logger_name: str) -> None:
1540
+ if not self.log_stats:
1541
+ raise RuntimeError(
1542
+ "Stat logging is disabled. Set `disable_log_stats=False` "
1543
+ "argument to enable.")
1544
+ if logger_name not in self.stat_loggers:
1545
+ raise KeyError(f"Logger with name {logger_name} does not exist.")
1546
+ del self.stat_loggers[logger_name]
1547
+
1548
+ def do_log_stats(self,
1549
+ scheduler_outputs: Optional[SchedulerOutputs] = None,
1550
+ model_output: Optional[List[SamplerOutput]] = None,
1551
+ finished_before: Optional[List[int]] = None,
1552
+ skip: Optional[List[int]] = None) -> None:
1553
+ """Forced log when no requests active."""
1554
+ if self.log_stats:
1555
+ stats = self._get_stats(scheduler_outputs, model_output,
1556
+ finished_before, skip)
1557
+ for logger in self.stat_loggers.values():
1558
+ logger.log(stats)
1559
+
1560
+ def _get_stats(self,
1561
+ scheduler_outputs: Optional[SchedulerOutputs],
1562
+ model_output: Optional[List[SamplerOutput]] = None,
1563
+ finished_before: Optional[List[int]] = None,
1564
+ skip: Optional[List[int]] = None) -> Stats:
1565
+ """Get Stats to be Logged to Prometheus.
1566
+
1567
+ Args:
1568
+ scheduler_outputs: Optional, used to populate metrics related to
1569
+ the scheduled batch,
1570
+ model_output: Optional, used to emit speculative decoding metrics
1571
+ which are created by the workers.
1572
+ finished_before: Optional, indices of sequences that were finished
1573
+ before. These sequences will be ignored.
1574
+ skip: Optional, indices of sequences that were preempted. These
1575
+ sequences will be ignored.
1576
+ """
1577
+ now = time.time()
1578
+
1579
+ # System State
1580
+ # Scheduler State
1581
+ num_running_sys = sum(
1582
+ len(scheduler.running) for scheduler in self.scheduler)
1583
+ num_swapped_sys = sum(
1584
+ len(scheduler.swapped) for scheduler in self.scheduler)
1585
+ num_waiting_sys = sum(
1586
+ len(scheduler.waiting) for scheduler in self.scheduler)
1587
+
1588
+ # KV Cache Usage in %
1589
+ num_total_gpu = self.cache_config.num_gpu_blocks
1590
+ gpu_cache_usage_sys = 0.
1591
+ if num_total_gpu: # Guard against both None and 0
1592
+ num_free_gpu = sum(
1593
+ scheduler.block_manager.get_num_free_gpu_blocks()
1594
+ for scheduler in self.scheduler)
1595
+ gpu_cache_usage_sys = 1.0 - (num_free_gpu / num_total_gpu)
1596
+
1597
+ num_total_cpu = self.cache_config.num_cpu_blocks
1598
+ cpu_cache_usage_sys = 0.
1599
+ if num_total_cpu: # Guard against both None and 0
1600
+ num_free_cpu = sum(
1601
+ scheduler.block_manager.get_num_free_cpu_blocks()
1602
+ for scheduler in self.scheduler)
1603
+ cpu_cache_usage_sys = 1.0 - (num_free_cpu / num_total_cpu)
1604
+
1605
+ # Prefix Cache Hit Rate. Note that we always use
1606
+ # the cache hit rate of the first virtual engine.
1607
+ cpu_prefix_cache_hit_rate = self.scheduler[
1608
+ 0].get_prefix_cache_hit_rate(Device.CPU)
1609
+ gpu_prefix_cache_hit_rate = self.scheduler[
1610
+ 0].get_prefix_cache_hit_rate(Device.GPU)
1611
+
1612
+ # Exchange the uasge and cache hit stats between gpu and cpu when
1613
+ # running on cpu because the cpu_worker.py intentionally reports the
1614
+ # number of cpu blocks as gpu blocks in favor of cache management.
1615
+ if self.device_config.device_type == "cpu":
1616
+ num_total_gpu, num_total_cpu = num_total_cpu, num_total_gpu
1617
+ gpu_cache_usage_sys, cpu_cache_usage_sys = (
1618
+ cpu_cache_usage_sys,
1619
+ gpu_cache_usage_sys,
1620
+ )
1621
+ gpu_prefix_cache_hit_rate, cpu_prefix_cache_hit_rate = (
1622
+ cpu_prefix_cache_hit_rate,
1623
+ gpu_prefix_cache_hit_rate,
1624
+ )
1625
+
1626
+ # Iteration stats
1627
+ num_prompt_tokens_iter = 0
1628
+ num_generation_tokens_iter = 0
1629
+ num_tokens_iter = 0
1630
+ time_to_first_tokens_iter: List[float] = []
1631
+ time_per_output_tokens_iter: List[float] = []
1632
+ num_preemption_iter = (0 if scheduler_outputs is None else
1633
+ scheduler_outputs.preempted)
1634
+
1635
+ # Request stats
1636
+ # Latency
1637
+ time_e2e_requests: List[float] = []
1638
+ time_queue_requests: List[float] = []
1639
+ time_inference_requests: List[float] = []
1640
+ time_prefill_requests: List[float] = []
1641
+ time_decode_requests: List[float] = []
1642
+ # Metadata
1643
+ num_prompt_tokens_requests: List[int] = []
1644
+ num_generation_tokens_requests: List[int] = []
1645
+ n_requests: List[int] = []
1646
+ max_num_generation_tokens_requests: List[int] = []
1647
+ max_tokens_requests: List[int] = []
1648
+ finished_reason_requests: List[str] = []
1649
+
1650
+ # LoRA requests
1651
+ running_lora_adapters = dict(
1652
+ collectionsCounter([
1653
+ running_request.lora_request.lora_name
1654
+ for scheduler in self.scheduler
1655
+ for running_request in scheduler.running
1656
+ if running_request.lora_request
1657
+ ]))
1658
+ waiting_lora_adapters = dict(
1659
+ collectionsCounter([
1660
+ waiting_request.lora_request.lora_name
1661
+ for scheduler in self.scheduler
1662
+ for waiting_request in scheduler.waiting
1663
+ if waiting_request.lora_request
1664
+ ]))
1665
+ max_lora_stat = "0"
1666
+ if self.lora_config:
1667
+ max_lora_stat = str(self.lora_config.max_loras)
1668
+
1669
+ # NOTE: This loop assumes prefill seq_groups are before
1670
+ # decode seq_groups in scheduled_seq_groups.
1671
+ if scheduler_outputs is not None:
1672
+ # For async postprocessor, already finished sequences need to be
1673
+ # not counted (to avoid double counting)
1674
+ actual_num_batched_tokens = scheduler_outputs.num_batched_tokens # type: ignore
1675
+
1676
+ num_generation_tokens_from_prefill_groups = 0
1677
+ # NOTE: if scheduler_outputs.num_prefill_groups > 0 and
1678
+ # the len of scheduler_outputs.scheduled_seq_groups is !=
1679
+ # scheduler_outputs.num_prefill_groups, this means that
1680
+ # chunked prefills have been detected.
1681
+
1682
+ for idx, scheduled_seq_group in enumerate(
1683
+ scheduler_outputs.scheduled_seq_groups):
1684
+ # Skip double logging when using async output proc
1685
+ if finished_before and idx in finished_before:
1686
+ actual_num_batched_tokens -= 1
1687
+ continue
1688
+
1689
+ # Currently, skip == preempted sequences, so we need to skip
1690
+ # their log stats
1691
+ if skip and idx in skip:
1692
+ continue
1693
+
1694
+ group_was_prefill = idx < scheduler_outputs.num_prefill_groups
1695
+ seq_group = scheduled_seq_group.seq_group
1696
+
1697
+ # NOTE: a seq_group that completed all of its prefill tokens
1698
+ # in the last iteration will have seq_group.is_prefill() = False
1699
+ # with group_was_prefill = True
1700
+ if group_was_prefill:
1701
+ # Number of prompt tokens.
1702
+ num_prompt_tokens_iter += (
1703
+ scheduled_seq_group.token_chunk_size)
1704
+
1705
+ # If the seq_group just finished the prefill state
1706
+ # get TTFT.
1707
+ if not seq_group.is_prefill():
1708
+ latency = seq_group.get_last_token_latency()
1709
+ time_to_first_tokens_iter.append(latency)
1710
+
1711
+ # One generation token per finished prefill.
1712
+ num_generation_tokens_from_prefill_groups += (
1713
+ seq_group.num_seqs())
1714
+ else:
1715
+ # TPOTs.
1716
+ latency = seq_group.get_last_token_latency()
1717
+ time_per_output_tokens_iter.append(latency)
1718
+ if seq_group.state.current_step == 0:
1719
+ # For async_output_proc, the do_log_stats()
1720
+ # is called following init_multi_step(), which
1721
+ # sets the current_step to zero.
1722
+ actual_num_batched_tokens +=\
1723
+ seq_group.state.num_steps - 1
1724
+ else:
1725
+ actual_num_batched_tokens +=\
1726
+ seq_group.state.current_step - 1
1727
+
1728
+ # Because of chunked prefill, we can have a single sequence
1729
+ # group that does multiple prompt_runs. To prevent logging
1730
+ # the same metadata more than once per request, we standardize
1731
+ # on logging request level information for finished requests,
1732
+ # which can only happen once.
1733
+ if seq_group.is_finished():
1734
+ # Latency timings
1735
+ time_e2e_requests.append(now -
1736
+ seq_group.metrics.arrival_time)
1737
+ if (seq_group.metrics.first_scheduled_time is not None and
1738
+ seq_group.metrics.first_token_time is not None):
1739
+ time_queue_requests.append(
1740
+ seq_group.metrics.first_scheduled_time -
1741
+ seq_group.metrics.arrival_time)
1742
+ time_prefill_requests.append(
1743
+ seq_group.metrics.first_token_time -
1744
+ seq_group.metrics.first_scheduled_time)
1745
+ time_decode_requests.append(
1746
+ now - seq_group.metrics.first_token_time)
1747
+ time_inference_requests.append(
1748
+ now - seq_group.metrics.first_scheduled_time)
1749
+ # Metadata
1750
+ num_prompt_tokens_requests.append(
1751
+ len(seq_group.prompt_token_ids))
1752
+ num_generation_tokens_requests.extend([
1753
+ seq.get_output_len()
1754
+ for seq in seq_group.get_finished_seqs()
1755
+ ])
1756
+ max_num_generation_tokens_requests.append(
1757
+ max(seq.get_output_len()
1758
+ for seq in seq_group.get_seqs()))
1759
+ if seq_group.sampling_params is not None:
1760
+ n_requests.append(seq_group.sampling_params.n)
1761
+ max_tokens_requests.append(
1762
+ seq_group.sampling_params.max_tokens)
1763
+ finished_reason_requests.extend([
1764
+ SequenceStatus.get_finished_reason(seq.status)
1765
+ for seq in seq_group.get_finished_seqs()
1766
+ ])
1767
+
1768
+ # Number of generation tokens.
1769
+ # num_batched_tokens equals the number of prompt_tokens plus the
1770
+ # number of decode_tokens in a single iteration. So,
1771
+ # num_generation_tokens = num_batched_tokens - num_prompt_tokens
1772
+ # + num_generation_tokens_from_prefill_groups (since we generate
1773
+ # one token on prefills on iters where the prefill finishes).
1774
+ num_generation_tokens_iter = (
1775
+ actual_num_batched_tokens - num_prompt_tokens_iter +
1776
+ num_generation_tokens_from_prefill_groups)
1777
+ num_tokens_iter = (num_generation_tokens_iter +
1778
+ num_prompt_tokens_iter)
1779
+ # Spec decode, if enabled, emits specialized metrics from the worker in
1780
+ # sampler output.
1781
+ if model_output and isinstance(model_output[0], SamplerOutput) and (
1782
+ model_output[0].spec_decode_worker_metrics is not None):
1783
+ spec_decode_metrics = model_output[0].spec_decode_worker_metrics
1784
+ else:
1785
+ spec_decode_metrics = None
1786
+
1787
+ return Stats(
1788
+ now=now,
1789
+ # System stats
1790
+ # Scheduler State
1791
+ num_running_sys=num_running_sys,
1792
+ num_swapped_sys=num_swapped_sys,
1793
+ num_waiting_sys=num_waiting_sys,
1794
+ # KV Cache Usage in %
1795
+ gpu_cache_usage_sys=gpu_cache_usage_sys,
1796
+ cpu_cache_usage_sys=cpu_cache_usage_sys,
1797
+ # Prefix Cache Hit Rate
1798
+ cpu_prefix_cache_hit_rate=cpu_prefix_cache_hit_rate,
1799
+ gpu_prefix_cache_hit_rate=gpu_prefix_cache_hit_rate,
1800
+
1801
+ # Iteration stats
1802
+ num_prompt_tokens_iter=num_prompt_tokens_iter,
1803
+ num_generation_tokens_iter=num_generation_tokens_iter,
1804
+ num_tokens_iter=num_tokens_iter,
1805
+ time_to_first_tokens_iter=time_to_first_tokens_iter,
1806
+ time_per_output_tokens_iter=time_per_output_tokens_iter,
1807
+ spec_decode_metrics=spec_decode_metrics,
1808
+ num_preemption_iter=num_preemption_iter,
1809
+
1810
+ # Request stats
1811
+ # Latency
1812
+ time_e2e_requests=time_e2e_requests,
1813
+ time_queue_requests=time_queue_requests,
1814
+ time_inference_requests=time_inference_requests,
1815
+ time_prefill_requests=time_prefill_requests,
1816
+ time_decode_requests=time_decode_requests,
1817
+ # Metadata
1818
+ num_prompt_tokens_requests=num_prompt_tokens_requests,
1819
+ num_generation_tokens_requests=num_generation_tokens_requests,
1820
+ max_num_generation_tokens_requests=
1821
+ max_num_generation_tokens_requests,
1822
+ n_requests=n_requests,
1823
+ max_tokens_requests=max_tokens_requests,
1824
+ finished_reason_requests=finished_reason_requests,
1825
+ max_lora=str(max_lora_stat),
1826
+ waiting_lora_adapters=list(waiting_lora_adapters.keys()),
1827
+ running_lora_adapters=list(running_lora_adapters.keys()))
1828
+
1829
+ def add_lora(self, lora_request: LoRARequest) -> bool:
1830
+ return self.model_executor.add_lora(lora_request)
1831
+
1832
+ def remove_lora(self, lora_id: int) -> bool:
1833
+ return self.model_executor.remove_lora(lora_id)
1834
+
1835
+ def list_loras(self) -> Set[int]:
1836
+ return self.model_executor.list_loras()
1837
+
1838
+ def pin_lora(self, lora_id: int) -> bool:
1839
+ return self.model_executor.pin_lora(lora_id)
1840
+
1841
+ def add_prompt_adapter(
1842
+ self, prompt_adapter_request: PromptAdapterRequest) -> bool:
1843
+ return self.model_executor.add_prompt_adapter(prompt_adapter_request)
1844
+
1845
+ def remove_prompt_adapter(self, prompt_adapter_id: int) -> bool:
1846
+ return self.model_executor.remove_prompt_adapter(prompt_adapter_id)
1847
+
1848
+ def list_prompt_adapters(self) -> List[int]:
1849
+ return self.model_executor.list_prompt_adapters()
1850
+
1851
+ def start_profile(self) -> None:
1852
+ self.model_executor.start_profile()
1853
+
1854
+ def stop_profile(self) -> None:
1855
+ self.model_executor.stop_profile()
1856
+
1857
+ def sleep(self, level: int = 1) -> None:
1858
+ assert self.vllm_config.model_config.enable_sleep_mode, (
1859
+ "Sleep mode is not enabled in the model config")
1860
+ self.model_executor.sleep(level=level)
1861
+
1862
+ def wake_up(self, tags: Optional[list[str]] = None) -> None:
1863
+ assert self.vllm_config.model_config.enable_sleep_mode, (
1864
+ "Sleep mode is not enabled in the model config")
1865
+ self.model_executor.wake_up(tags)
1866
+
1867
+ def is_sleeping(self) -> bool:
1868
+ return self.model_executor.is_sleeping
1869
+
1870
+ def check_health(self) -> None:
1871
+ self.model_executor.check_health()
1872
+
1873
+ def is_tracing_enabled(self) -> bool:
1874
+ return self.tracer is not None
1875
+
1876
+ def do_tracing(self,
1877
+ scheduler_outputs: SchedulerOutputs,
1878
+ finished_before: Optional[List[int]] = None) -> None:
1879
+ if self.tracer is None:
1880
+ return
1881
+
1882
+ for idx, scheduled_seq_group in enumerate(
1883
+ scheduler_outputs.scheduled_seq_groups):
1884
+ # Skip double tracing when using async output proc
1885
+ if finished_before and idx in finished_before:
1886
+ continue
1887
+
1888
+ seq_group = scheduled_seq_group.seq_group
1889
+ if seq_group.is_finished():
1890
+ self.create_trace_span(seq_group)
1891
+
1892
+ def create_trace_span(self, seq_group: SequenceGroup) -> None:
1893
+ if self.tracer is None or seq_group.sampling_params is None:
1894
+ return
1895
+ arrival_time_nano_seconds = int(seq_group.metrics.arrival_time * 1e9)
1896
+
1897
+ trace_context = extract_trace_context(seq_group.trace_headers)
1898
+
1899
+ with self.tracer.start_as_current_span(
1900
+ "llm_request",
1901
+ kind=SpanKind.SERVER,
1902
+ context=trace_context,
1903
+ start_time=arrival_time_nano_seconds) as seq_span:
1904
+ metrics = seq_group.metrics
1905
+ ttft = metrics.first_token_time - metrics.arrival_time
1906
+ e2e_time = metrics.finished_time - metrics.arrival_time
1907
+ seq_span.set_attribute(SpanAttributes.GEN_AI_RESPONSE_MODEL,
1908
+ self.model_config.model)
1909
+ seq_span.set_attribute(SpanAttributes.GEN_AI_REQUEST_ID,
1910
+ seq_group.request_id)
1911
+ seq_span.set_attribute(SpanAttributes.GEN_AI_REQUEST_TEMPERATURE,
1912
+ seq_group.sampling_params.temperature)
1913
+ seq_span.set_attribute(SpanAttributes.GEN_AI_REQUEST_TOP_P,
1914
+ seq_group.sampling_params.top_p)
1915
+ seq_span.set_attribute(SpanAttributes.GEN_AI_REQUEST_MAX_TOKENS,
1916
+ seq_group.sampling_params.max_tokens)
1917
+ seq_span.set_attribute(SpanAttributes.GEN_AI_REQUEST_N,
1918
+ seq_group.sampling_params.n)
1919
+ seq_span.set_attribute(SpanAttributes.GEN_AI_USAGE_NUM_SEQUENCES,
1920
+ seq_group.num_seqs())
1921
+ seq_span.set_attribute(SpanAttributes.GEN_AI_USAGE_PROMPT_TOKENS,
1922
+ len(seq_group.prompt_token_ids))
1923
+ seq_span.set_attribute(
1924
+ SpanAttributes.GEN_AI_USAGE_COMPLETION_TOKENS,
1925
+ sum([
1926
+ seq.get_output_len()
1927
+ for seq in seq_group.get_finished_seqs()
1928
+ ]))
1929
+ seq_span.set_attribute(SpanAttributes.GEN_AI_LATENCY_TIME_IN_QUEUE,
1930
+ metrics.time_in_queue)
1931
+ seq_span.set_attribute(
1932
+ SpanAttributes.GEN_AI_LATENCY_TIME_TO_FIRST_TOKEN, ttft)
1933
+ seq_span.set_attribute(SpanAttributes.GEN_AI_LATENCY_E2E, e2e_time)
1934
+ if metrics.scheduler_time is not None:
1935
+ seq_span.set_attribute(
1936
+ SpanAttributes.GEN_AI_LATENCY_TIME_IN_SCHEDULER,
1937
+ metrics.scheduler_time)
1938
+ if metrics.model_forward_time is not None:
1939
+ seq_span.set_attribute(
1940
+ SpanAttributes.GEN_AI_LATENCY_TIME_IN_MODEL_FORWARD,
1941
+ metrics.model_forward_time / 1000.0)
1942
+ if metrics.model_execute_time is not None:
1943
+ seq_span.set_attribute(
1944
+ SpanAttributes.GEN_AI_LATENCY_TIME_IN_MODEL_EXECUTE,
1945
+ metrics.model_execute_time)
1946
+
1947
+ def _validate_model_inputs(self, inputs: ProcessorInputs,
1948
+ lora_request: Optional[LoRARequest]):
1949
+ encoder_inputs, decoder_inputs = split_enc_dec_inputs(inputs)
1950
+
1951
+ if encoder_inputs is not None:
1952
+ self._validate_model_input(encoder_inputs,
1953
+ lora_request,
1954
+ prompt_type="encoder")
1955
+
1956
+ self._validate_model_input(decoder_inputs,
1957
+ lora_request,
1958
+ prompt_type="decoder")
1959
+
1960
+ def _validate_model_input(
1961
+ self,
1962
+ prompt_inputs: SingletonInputs,
1963
+ lora_request: Optional[LoRARequest],
1964
+ *,
1965
+ prompt_type: Literal["encoder", "decoder"],
1966
+ ):
1967
+ model_config = self.model_config
1968
+ tokenizer = (None if self.tokenizer is None else
1969
+ self.tokenizer.get_lora_tokenizer(lora_request))
1970
+
1971
+ prompt_ids = prompt_inputs.get("prompt_token_ids", [])
1972
+ if not prompt_ids:
1973
+ if prompt_type == "encoder" and model_config.is_multimodal_model:
1974
+ pass # Mllama may have empty encoder inputs for text-only data
1975
+ elif prompt_inputs["type"] == "embeds":
1976
+ pass
1977
+ else:
1978
+ raise ValueError(f"The {prompt_type} prompt cannot be empty")
1979
+
1980
+ if tokenizer is not None:
1981
+ max_input_id = max(prompt_ids, default=0)
1982
+ if max_input_id > tokenizer.max_token_id:
1983
+ raise ValueError(
1984
+ f"Token id {max_input_id} is out of vocabulary")
1985
+
1986
+ max_prompt_len = self.model_config.max_model_len
1987
+ if len(prompt_ids) > max_prompt_len:
1988
+ if prompt_type == "encoder" and model_config.is_multimodal_model:
1989
+ mm_registry = self.input_preprocessor.mm_registry
1990
+ mm_processor = mm_registry.create_processor(
1991
+ model_config,
1992
+ tokenizer=tokenizer or object(), # Dummy if no tokenizer
1993
+ )
1994
+ assert isinstance(mm_processor, EncDecMultiModalProcessor)
1995
+
1996
+ if mm_processor.pad_dummy_encoder_prompt:
1997
+ return # Skip encoder length check for Whisper
1998
+
1999
+ if model_config.is_multimodal_model:
2000
+ suggestion = (
2001
+ "Make sure that `max_model_len` is no smaller than the "
2002
+ "number of text tokens plus multimodal tokens. For image "
2003
+ "inputs, the number of image tokens depends on the number "
2004
+ "of images, and possibly their aspect ratios as well.")
2005
+ else:
2006
+ suggestion = (
2007
+ "Make sure that `max_model_len` is no smaller than the "
2008
+ "number of text tokens.")
2009
+
2010
+ raise ValueError(
2011
+ f"The {prompt_type} prompt (length {len(prompt_ids)}) is "
2012
+ f"longer than the maximum model length of {max_prompt_len}. "
2013
+ f"{suggestion}")
2014
+
2015
+ # TODO: Find out how many placeholder tokens are there so we can
2016
+ # check that chunked prefill does not truncate them
2017
+ # max_batch_len = self.scheduler_config.max_num_batched_tokens
2018
+
2019
+ def _build_logits_processors(
2020
+ self, sampling_params: SamplingParams,
2021
+ lora_request: Optional[LoRARequest]) -> SamplingParams:
2022
+ """Constructs logits processors based on the guided_decoding,
2023
+ logits_bias, and allowed_token_ids fields in sampling_params. Deletes
2024
+ those fields and adds the constructed logits processors to the
2025
+ logits_processors field. Returns the modified sampling params."""
2026
+
2027
+ logits_processors = []
2028
+
2029
+ if sampling_params.guided_decoding is not None:
2030
+ # Defensively copy sampling params since guided decoding logits
2031
+ # processors can have different state for each request
2032
+ sampling_params = copy.copy(sampling_params)
2033
+ guided_decoding = sampling_params.guided_decoding
2034
+
2035
+ logger.debug(
2036
+ "Building guided decoding logits processor in "
2037
+ "LLMEngine. Params: %s", guided_decoding)
2038
+
2039
+ tokenizer = self.get_tokenizer(lora_request=lora_request)
2040
+ guided_decoding.backend = guided_decoding.backend or \
2041
+ self.decoding_config.backend
2042
+
2043
+ if self.decoding_config.reasoning_backend:
2044
+ logger.debug("Building with reasoning backend %s",
2045
+ self.decoding_config.reasoning_backend)
2046
+
2047
+ processor = get_local_guided_decoding_logits_processor(
2048
+ guided_params=guided_decoding,
2049
+ tokenizer=tokenizer,
2050
+ model_config=self.model_config,
2051
+ reasoning_backend=self.decoding_config.reasoning_backend,
2052
+ )
2053
+ if processor:
2054
+ logits_processors.append(processor)
2055
+
2056
+ # Unset so this doesn't get passed down to the model
2057
+ sampling_params.guided_decoding = None
2058
+
2059
+ if (sampling_params.logit_bias or sampling_params.allowed_token_ids):
2060
+ tokenizer = self.get_tokenizer(lora_request=lora_request)
2061
+
2062
+ processors = get_openai_logits_processors(
2063
+ logit_bias=sampling_params.logit_bias,
2064
+ allowed_token_ids=sampling_params.allowed_token_ids,
2065
+ tokenizer=tokenizer)
2066
+ logits_processors.extend(processors)
2067
+
2068
+ # Unset so these don't get passed down to the model
2069
+ sampling_params.logit_bias = None
2070
+ sampling_params.allowed_token_ids = None
2071
+
2072
+ if len(sampling_params.bad_words) > 0:
2073
+ tokenizer = self.get_tokenizer(lora_request)
2074
+ processors = get_bad_words_logits_processors(
2075
+ bad_words=sampling_params.bad_words, tokenizer=tokenizer)
2076
+ logits_processors.extend(processors)
2077
+
2078
+ if logits_processors:
2079
+ if sampling_params.logits_processors is None:
2080
+ sampling_params.logits_processors = logits_processors
2081
+ else:
2082
+ sampling_params.logits_processors.extend(logits_processors)
2083
+
2084
+ return sampling_params
2085
+
2086
+ def collective_rpc(self,
2087
+ method: Union[str, Callable[..., _R]],
2088
+ timeout: Optional[float] = None,
2089
+ args: tuple = (),
2090
+ kwargs: Optional[dict[str, Any]] = None) -> list[_R]:
2091
+ return self.model_executor.collective_rpc(method, timeout, args,
2092
+ kwargs)
2093
+
2094
+
2095
+ if envs.is_set("VLLM_USE_V1") and envs.VLLM_USE_V1:
2096
+ from vllm.v1.engine.llm_engine import LLMEngine as V1LLMEngine
2097
+ LLMEngine = V1LLMEngine # type: ignore