vllm-cpu-amxbf16 0.9.1__cp312-cp312-manylinux_2_17_x86_64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- vllm/_C.abi3.so +0 -0
- vllm/__init__.py +53 -0
- vllm/_custom_ops.py +1828 -0
- vllm/_ipex_ops.py +244 -0
- vllm/_version.py +34 -0
- vllm/adapter_commons/__init__.py +0 -0
- vllm/adapter_commons/layers.py +16 -0
- vllm/adapter_commons/models.py +106 -0
- vllm/adapter_commons/request.py +26 -0
- vllm/adapter_commons/utils.py +93 -0
- vllm/adapter_commons/worker_manager.py +39 -0
- vllm/assets/__init__.py +0 -0
- vllm/assets/audio.py +45 -0
- vllm/assets/base.py +41 -0
- vllm/assets/image.py +34 -0
- vllm/assets/video.py +115 -0
- vllm/attention/__init__.py +20 -0
- vllm/attention/backends/__init__.py +0 -0
- vllm/attention/backends/abstract.py +308 -0
- vllm/attention/backends/blocksparse_attn.py +461 -0
- vllm/attention/backends/cpu_mla.py +307 -0
- vllm/attention/backends/dual_chunk_flash_attn.py +1498 -0
- vllm/attention/backends/flash_attn.py +1003 -0
- vllm/attention/backends/flashinfer.py +1104 -0
- vllm/attention/backends/flashmla.py +244 -0
- vllm/attention/backends/hpu_attn.py +313 -0
- vllm/attention/backends/ipex_attn.py +398 -0
- vllm/attention/backends/mla/__init__.py +0 -0
- vllm/attention/backends/mla/common.py +1385 -0
- vllm/attention/backends/pallas.py +351 -0
- vllm/attention/backends/placeholder_attn.py +400 -0
- vllm/attention/backends/rocm_aiter_mla.py +435 -0
- vllm/attention/backends/rocm_flash_attn.py +975 -0
- vllm/attention/backends/torch_sdpa.py +703 -0
- vllm/attention/backends/triton_mla.py +115 -0
- vllm/attention/backends/utils.py +610 -0
- vllm/attention/backends/xformers.py +802 -0
- vllm/attention/layer.py +468 -0
- vllm/attention/ops/__init__.py +0 -0
- vllm/attention/ops/blocksparse_attention/__init__.py +0 -0
- vllm/attention/ops/blocksparse_attention/blocksparse_attention_kernel.py +433 -0
- vllm/attention/ops/blocksparse_attention/interface.py +239 -0
- vllm/attention/ops/blocksparse_attention/utils.py +246 -0
- vllm/attention/ops/chunked_prefill_paged_decode.py +368 -0
- vllm/attention/ops/flashmla.py +116 -0
- vllm/attention/ops/hpu_paged_attn.py +88 -0
- vllm/attention/ops/ipex_attn.py +195 -0
- vllm/attention/ops/merge_attn_states.py +43 -0
- vllm/attention/ops/nki_flash_attn.py +906 -0
- vllm/attention/ops/paged_attn.py +256 -0
- vllm/attention/ops/prefix_prefill.py +902 -0
- vllm/attention/ops/rocm_aiter_mla.py +100 -0
- vllm/attention/ops/rocm_aiter_paged_attn.py +102 -0
- vllm/attention/ops/triton_decode_attention.py +674 -0
- vllm/attention/ops/triton_flash_attention.py +979 -0
- vllm/attention/ops/triton_merge_attn_states.py +97 -0
- vllm/attention/ops/triton_unified_attention.py +334 -0
- vllm/attention/selector.py +187 -0
- vllm/attention/utils/fa_utils.py +55 -0
- vllm/beam_search.py +87 -0
- vllm/benchmarks/__init__.py +0 -0
- vllm/benchmarks/datasets.py +1185 -0
- vllm/benchmarks/endpoint_request_func.py +381 -0
- vllm/benchmarks/latency.py +168 -0
- vllm/benchmarks/serve.py +1135 -0
- vllm/benchmarks/throughput.py +609 -0
- vllm/benchmarks/utils.py +70 -0
- vllm/collect_env.py +820 -0
- vllm/compilation/__init__.py +0 -0
- vllm/compilation/activation_quant_fusion.py +89 -0
- vllm/compilation/backends.py +563 -0
- vllm/compilation/base_piecewise_backend.py +72 -0
- vllm/compilation/collective_fusion.py +127 -0
- vllm/compilation/compiler_interface.py +544 -0
- vllm/compilation/counter.py +38 -0
- vllm/compilation/cuda_piecewise_backend.py +214 -0
- vllm/compilation/decorators.py +250 -0
- vllm/compilation/fix_functionalization.py +191 -0
- vllm/compilation/fusion.py +618 -0
- vllm/compilation/fx_utils.py +62 -0
- vllm/compilation/inductor_pass.py +115 -0
- vllm/compilation/monitor.py +39 -0
- vllm/compilation/multi_output_match.py +109 -0
- vllm/compilation/noop_elimination.py +137 -0
- vllm/compilation/pass_manager.py +78 -0
- vllm/compilation/sequence_parallelism.py +268 -0
- vllm/compilation/torch25_custom_graph_pass.py +42 -0
- vllm/compilation/vllm_inductor_pass.py +67 -0
- vllm/compilation/wrapper.py +135 -0
- vllm/config.py +4746 -0
- vllm/connections.py +174 -0
- vllm/core/__init__.py +0 -0
- vllm/core/block/__init__.py +0 -0
- vllm/core/block/block_table.py +399 -0
- vllm/core/block/common.py +371 -0
- vllm/core/block/cpu_gpu_block_allocator.py +441 -0
- vllm/core/block/interfaces.py +319 -0
- vllm/core/block/naive_block.py +466 -0
- vllm/core/block/prefix_caching_block.py +1135 -0
- vllm/core/block/utils.py +28 -0
- vllm/core/block_manager.py +521 -0
- vllm/core/evictor.py +157 -0
- vllm/core/interfaces.py +135 -0
- vllm/core/placeholder_block_space_manager.py +100 -0
- vllm/core/scheduler.py +2093 -0
- vllm/device_allocator/__init__.py +0 -0
- vllm/device_allocator/cumem.py +281 -0
- vllm/distributed/__init__.py +6 -0
- vllm/distributed/communication_op.py +41 -0
- vllm/distributed/device_communicators/__init__.py +0 -0
- vllm/distributed/device_communicators/all2all.py +264 -0
- vllm/distributed/device_communicators/base_device_communicator.py +260 -0
- vllm/distributed/device_communicators/cpu_communicator.py +145 -0
- vllm/distributed/device_communicators/cuda_communicator.py +176 -0
- vllm/distributed/device_communicators/cuda_wrapper.py +180 -0
- vllm/distributed/device_communicators/custom_all_reduce.py +304 -0
- vllm/distributed/device_communicators/custom_all_reduce_utils.py +259 -0
- vllm/distributed/device_communicators/hpu_communicator.py +46 -0
- vllm/distributed/device_communicators/neuron_communicator.py +20 -0
- vllm/distributed/device_communicators/pynccl.py +218 -0
- vllm/distributed/device_communicators/pynccl_wrapper.py +341 -0
- vllm/distributed/device_communicators/shm_broadcast.py +585 -0
- vllm/distributed/device_communicators/tpu_communicator.py +103 -0
- vllm/distributed/device_communicators/xpu_communicator.py +55 -0
- vllm/distributed/kv_events.py +356 -0
- vllm/distributed/kv_transfer/README.md +29 -0
- vllm/distributed/kv_transfer/__init__.py +12 -0
- vllm/distributed/kv_transfer/disagg_prefill_workflow.jpg +0 -0
- vllm/distributed/kv_transfer/kv_connector/__init__.py +0 -0
- vllm/distributed/kv_transfer/kv_connector/base.py +128 -0
- vllm/distributed/kv_transfer/kv_connector/factory.py +128 -0
- vllm/distributed/kv_transfer/kv_connector/lmcache_connector.py +99 -0
- vllm/distributed/kv_transfer/kv_connector/mooncake_store_connector.py +203 -0
- vllm/distributed/kv_transfer/kv_connector/simple_connector.py +329 -0
- vllm/distributed/kv_transfer/kv_connector/utils.py +108 -0
- vllm/distributed/kv_transfer/kv_connector/v1/__init__.py +6 -0
- vllm/distributed/kv_transfer/kv_connector/v1/base.py +283 -0
- vllm/distributed/kv_transfer/kv_connector/v1/lmcache_connector.py +134 -0
- vllm/distributed/kv_transfer/kv_connector/v1/multi_connector.py +201 -0
- vllm/distributed/kv_transfer/kv_connector/v1/nixl_connector.py +1030 -0
- vllm/distributed/kv_transfer/kv_connector/v1/shared_storage_connector.py +384 -0
- vllm/distributed/kv_transfer/kv_connector_agent.py +77 -0
- vllm/distributed/kv_transfer/kv_lookup_buffer/__init__.py +0 -0
- vllm/distributed/kv_transfer/kv_lookup_buffer/base.py +175 -0
- vllm/distributed/kv_transfer/kv_lookup_buffer/mooncake_store.py +161 -0
- vllm/distributed/kv_transfer/kv_lookup_buffer/simple_buffer.py +237 -0
- vllm/distributed/kv_transfer/kv_pipe/__init__.py +0 -0
- vllm/distributed/kv_transfer/kv_pipe/base.py +67 -0
- vllm/distributed/kv_transfer/kv_pipe/mooncake_pipe.py +280 -0
- vllm/distributed/kv_transfer/kv_pipe/pynccl_pipe.py +280 -0
- vllm/distributed/kv_transfer/kv_transfer_state.py +71 -0
- vllm/distributed/parallel_state.py +1296 -0
- vllm/distributed/tpu_distributed_utils.py +177 -0
- vllm/distributed/utils.py +536 -0
- vllm/engine/__init__.py +0 -0
- vllm/engine/arg_utils.py +1708 -0
- vllm/engine/async_llm_engine.py +1200 -0
- vllm/engine/async_timeout.py +173 -0
- vllm/engine/llm_engine.py +2097 -0
- vllm/engine/metrics.py +629 -0
- vllm/engine/metrics_types.py +94 -0
- vllm/engine/multiprocessing/__init__.py +148 -0
- vllm/engine/multiprocessing/client.py +681 -0
- vllm/engine/multiprocessing/engine.py +460 -0
- vllm/engine/output_processor/__init__.py +0 -0
- vllm/engine/output_processor/interfaces.py +75 -0
- vllm/engine/output_processor/multi_step.py +216 -0
- vllm/engine/output_processor/single_step.py +145 -0
- vllm/engine/output_processor/stop_checker.py +131 -0
- vllm/engine/output_processor/util.py +28 -0
- vllm/engine/protocol.py +317 -0
- vllm/entrypoints/__init__.py +0 -0
- vllm/entrypoints/api_server.py +178 -0
- vllm/entrypoints/chat_utils.py +1299 -0
- vllm/entrypoints/cli/__init__.py +0 -0
- vllm/entrypoints/cli/benchmark/__init__.py +0 -0
- vllm/entrypoints/cli/benchmark/base.py +39 -0
- vllm/entrypoints/cli/benchmark/latency.py +30 -0
- vllm/entrypoints/cli/benchmark/main.py +54 -0
- vllm/entrypoints/cli/benchmark/serve.py +30 -0
- vllm/entrypoints/cli/benchmark/throughput.py +30 -0
- vllm/entrypoints/cli/collect_env.py +35 -0
- vllm/entrypoints/cli/main.py +65 -0
- vllm/entrypoints/cli/openai.py +205 -0
- vllm/entrypoints/cli/run_batch.py +62 -0
- vllm/entrypoints/cli/serve.py +328 -0
- vllm/entrypoints/cli/types.py +25 -0
- vllm/entrypoints/launcher.py +147 -0
- vllm/entrypoints/llm.py +1544 -0
- vllm/entrypoints/logger.py +50 -0
- vllm/entrypoints/openai/__init__.py +0 -0
- vllm/entrypoints/openai/api_server.py +1387 -0
- vllm/entrypoints/openai/cli_args.py +315 -0
- vllm/entrypoints/openai/logits_processors.py +90 -0
- vllm/entrypoints/openai/protocol.py +1913 -0
- vllm/entrypoints/openai/run_batch.py +463 -0
- vllm/entrypoints/openai/serving_chat.py +1221 -0
- vllm/entrypoints/openai/serving_classification.py +160 -0
- vllm/entrypoints/openai/serving_completion.py +592 -0
- vllm/entrypoints/openai/serving_embedding.py +201 -0
- vllm/entrypoints/openai/serving_engine.py +986 -0
- vllm/entrypoints/openai/serving_models.py +315 -0
- vllm/entrypoints/openai/serving_pooling.py +232 -0
- vllm/entrypoints/openai/serving_score.py +433 -0
- vllm/entrypoints/openai/serving_tokenization.py +157 -0
- vllm/entrypoints/openai/serving_transcription.py +424 -0
- vllm/entrypoints/openai/tool_parsers/__init__.py +23 -0
- vllm/entrypoints/openai/tool_parsers/abstract_tool_parser.py +164 -0
- vllm/entrypoints/openai/tool_parsers/deepseekv3_tool_parser.py +370 -0
- vllm/entrypoints/openai/tool_parsers/granite_20b_fc_tool_parser.py +259 -0
- vllm/entrypoints/openai/tool_parsers/granite_tool_parser.py +237 -0
- vllm/entrypoints/openai/tool_parsers/hermes_tool_parser.py +371 -0
- vllm/entrypoints/openai/tool_parsers/internlm2_tool_parser.py +216 -0
- vllm/entrypoints/openai/tool_parsers/jamba_tool_parser.py +308 -0
- vllm/entrypoints/openai/tool_parsers/llama4_pythonic_tool_parser.py +316 -0
- vllm/entrypoints/openai/tool_parsers/llama_tool_parser.py +267 -0
- vllm/entrypoints/openai/tool_parsers/mistral_tool_parser.py +369 -0
- vllm/entrypoints/openai/tool_parsers/phi4mini_tool_parser.py +112 -0
- vllm/entrypoints/openai/tool_parsers/pythonic_tool_parser.py +308 -0
- vllm/entrypoints/openai/tool_parsers/utils.py +124 -0
- vllm/entrypoints/score_utils.py +50 -0
- vllm/entrypoints/ssl.py +75 -0
- vllm/entrypoints/utils.py +233 -0
- vllm/env_override.py +41 -0
- vllm/envs.py +944 -0
- vllm/executor/__init__.py +0 -0
- vllm/executor/executor_base.py +401 -0
- vllm/executor/mp_distributed_executor.py +244 -0
- vllm/executor/msgspec_utils.py +30 -0
- vllm/executor/multiproc_worker_utils.py +313 -0
- vllm/executor/ray_distributed_executor.py +701 -0
- vllm/executor/ray_utils.py +399 -0
- vllm/executor/uniproc_executor.py +139 -0
- vllm/forward_context.py +179 -0
- vllm/inputs/__init__.py +41 -0
- vllm/inputs/data.py +331 -0
- vllm/inputs/parse.py +151 -0
- vllm/inputs/preprocess.py +909 -0
- vllm/inputs/registry.py +237 -0
- vllm/jsontree.py +80 -0
- vllm/logger.py +212 -0
- vllm/logging_utils/__init__.py +8 -0
- vllm/logging_utils/dump_input.py +85 -0
- vllm/logging_utils/formatter.py +18 -0
- vllm/logits_process.py +119 -0
- vllm/lora/__init__.py +0 -0
- vllm/lora/fully_sharded_layers.py +355 -0
- vllm/lora/layers.py +1285 -0
- vllm/lora/lora.py +199 -0
- vllm/lora/models.py +818 -0
- vllm/lora/ops/__init__.py +0 -0
- vllm/lora/ops/torch_ops/__init__.py +16 -0
- vllm/lora/ops/torch_ops/lora_ops.py +119 -0
- vllm/lora/ops/triton_ops/__init__.py +12 -0
- vllm/lora/ops/triton_ops/kernel_utils.py +243 -0
- vllm/lora/ops/triton_ops/lora_expand_op.py +290 -0
- vllm/lora/ops/triton_ops/lora_kernel_metadata.py +148 -0
- vllm/lora/ops/triton_ops/lora_shrink_op.py +244 -0
- vllm/lora/ops/triton_ops/utils.py +120 -0
- vllm/lora/ops/xla_ops/__init__.py +7 -0
- vllm/lora/ops/xla_ops/lora_ops.py +145 -0
- vllm/lora/peft_helper.py +136 -0
- vllm/lora/punica_wrapper/__init__.py +10 -0
- vllm/lora/punica_wrapper/punica_base.py +485 -0
- vllm/lora/punica_wrapper/punica_cpu.py +349 -0
- vllm/lora/punica_wrapper/punica_gpu.py +290 -0
- vllm/lora/punica_wrapper/punica_hpu.py +145 -0
- vllm/lora/punica_wrapper/punica_selector.py +20 -0
- vllm/lora/punica_wrapper/punica_tpu.py +405 -0
- vllm/lora/punica_wrapper/utils.py +164 -0
- vllm/lora/request.py +99 -0
- vllm/lora/resolver.py +85 -0
- vllm/lora/utils.py +240 -0
- vllm/lora/worker_manager.py +259 -0
- vllm/model_executor/__init__.py +16 -0
- vllm/model_executor/custom_op.py +152 -0
- vllm/model_executor/guided_decoding/__init__.py +181 -0
- vllm/model_executor/guided_decoding/guidance_decoding.py +63 -0
- vllm/model_executor/guided_decoding/guidance_logits_processors.py +104 -0
- vllm/model_executor/guided_decoding/guided_fields.py +41 -0
- vllm/model_executor/guided_decoding/lm_format_enforcer_decoding.py +67 -0
- vllm/model_executor/guided_decoding/outlines_decoding.py +155 -0
- vllm/model_executor/guided_decoding/outlines_logits_processors.py +284 -0
- vllm/model_executor/guided_decoding/utils.py +242 -0
- vllm/model_executor/guided_decoding/xgrammar_decoding.py +426 -0
- vllm/model_executor/layers/__init__.py +0 -0
- vllm/model_executor/layers/activation.py +369 -0
- vllm/model_executor/layers/fused_moe/__init__.py +54 -0
- vllm/model_executor/layers/fused_moe/batched_deep_gemm_moe.py +125 -0
- vllm/model_executor/layers/fused_moe/batched_triton_or_deep_gemm_moe.py +117 -0
- vllm/model_executor/layers/fused_moe/configs/E=1,N=14336,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a16.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=1,N=14336,device_name=NVIDIA_A100-SXM4-80GB.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=1,N=1792,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a16.json +218 -0
- vllm/model_executor/layers/fused_moe/configs/E=1,N=1792,device_name=NVIDIA_A100-SXM4-80GB.json +218 -0
- vllm/model_executor/layers/fused_moe/configs/E=1,N=3072,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a16.json +218 -0
- vllm/model_executor/layers/fused_moe/configs/E=1,N=3072,device_name=NVIDIA_H100_80GB_HBM3,dtype=int8_w8a16.json +218 -0
- vllm/model_executor/layers/fused_moe/configs/E=1,N=3072,device_name=NVIDIA_H100_80GB_HBM3.json +218 -0
- vllm/model_executor/layers/fused_moe/configs/E=1,N=3584,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a16.json +218 -0
- vllm/model_executor/layers/fused_moe/configs/E=1,N=3584,device_name=NVIDIA_A100-SXM4-80GB.json +218 -0
- vllm/model_executor/layers/fused_moe/configs/E=1,N=7168,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a16.json +218 -0
- vllm/model_executor/layers/fused_moe/configs/E=1,N=7168,device_name=NVIDIA_A100-SXM4-80GB.json +218 -0
- vllm/model_executor/layers/fused_moe/configs/E=128,N=1024,device_name=AMD_Instinct_MI300X,dtype=fp8_w8a8.json +164 -0
- vllm/model_executor/layers/fused_moe/configs/E=128,N=1024,device_name=AMD_Instinct_MI300X.json +200 -0
- vllm/model_executor/layers/fused_moe/configs/E=128,N=192,device_name=NVIDIA_A100-SXM4-80GB.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=128,N=192,device_name=NVIDIA_H100_80GB_HBM3.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=128,N=192,device_name=NVIDIA_H20-3e.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=128,N=192,device_name=NVIDIA_H20.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=128,N=192,device_name=NVIDIA_H200.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=128,N=384,device_name=AMD_Instinct_MI300X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/fused_moe/configs/E=128,N=384,device_name=NVIDIA_H20,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=128,N=384,device_name=NVIDIA_H20-3e.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=128,N=384,device_name=NVIDIA_H20.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=128,N=384,device_name=NVIDIA_H200,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=128,N=384,device_name=NVIDIA_H200.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=128,N=512,device_name=NVIDIA_H100_80GB_HBM3.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=128,N=768,device_name=AMD_Instinct_MI300X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/fused_moe/configs/E=128,N=768,device_name=NVIDIA_H20,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=128,N=768,device_name=NVIDIA_H20.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=128,N=768,device_name=NVIDIA_H200,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=128,N=768,device_name=NVIDIA_H200.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=128,N=96,device_name=NVIDIA_H20.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=16,N=1024,device_name=AMD_Instinct_MI300X.json +200 -0
- vllm/model_executor/layers/fused_moe/configs/E=16,N=1024,device_name=NVIDIA_H100.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=16,N=1344,device_name=NVIDIA_A100-SXM4-40GB.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=16,N=1344,device_name=NVIDIA_A100-SXM4-80GB.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=16,N=1344,device_name=NVIDIA_H100_80GB_HBM3.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=16,N=14336,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a16.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=16,N=14336,device_name=NVIDIA_A100-SXM4-80GB.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=16,N=1792,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a16.json +218 -0
- vllm/model_executor/layers/fused_moe/configs/E=16,N=1792,device_name=NVIDIA_A100-SXM4-80GB.json +218 -0
- vllm/model_executor/layers/fused_moe/configs/E=16,N=2688,device_name=NVIDIA_A100-SXM4-80GB.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=16,N=2688,device_name=NVIDIA_H100_80GB_HBM3.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=16,N=3072,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a16.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=16,N=3072,device_name=NVIDIA_H100_80GB_HBM3,dtype=int8_w8a16.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=16,N=3200,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8.json +130 -0
- vllm/model_executor/layers/fused_moe/configs/E=16,N=3584,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a16.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=16,N=3584,device_name=NVIDIA_A100-SXM4-80GB.json +218 -0
- vllm/model_executor/layers/fused_moe/configs/E=16,N=6400,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8.json +130 -0
- vllm/model_executor/layers/fused_moe/configs/E=16,N=7168,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a16.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=16,N=7168,device_name=NVIDIA_A100-SXM4-80GB.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=16,N=7168,device_name=NVIDIA_H100_80GB_HBM3,dtype=int8_w8a16.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=16,N=800,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8.json +130 -0
- vllm/model_executor/layers/fused_moe/configs/E=160,N=192,device_name=NVIDIA_A800-SXM4-80GB.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=256,N=1024,device_name=AMD_Instinct_MI325X,block_shape=[128,128].json +200 -0
- vllm/model_executor/layers/fused_moe/configs/E=256,N=1024,device_name=AMD_Instinct_MI325_OAM,dtype=fp8_w8a8,block_shape=[128,128].json +200 -0
- vllm/model_executor/layers/fused_moe/configs/E=256,N=128,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=256,N=128,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a8.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=256,N=128,device_name=NVIDIA_A800-SXM4-80GB,dtype=int8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=256,N=128,device_name=NVIDIA_A800-SXM4-80GB,dtype=int8_w8a8.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=256,N=128,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=256,N=128,device_name=NVIDIA_H20,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=256,N=128,device_name=NVIDIA_L20Y,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=256,N=256,device_name=AMD_Instinct_MI300X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/fused_moe/configs/E=256,N=256,device_name=AMD_Instinct_MI325X,dtype=fp8_w8a8,block_shape=[128,128].json +200 -0
- vllm/model_executor/layers/fused_moe/configs/E=256,N=256,device_name=AMD_Instinct_MI325_OAM,dtype=fp8_w8a8,block_shape=[128,128].json +200 -0
- vllm/model_executor/layers/fused_moe/configs/E=256,N=256,device_name=NVIDIA_B200,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=256,N=256,device_name=NVIDIA_H20,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=256,N=256,device_name=NVIDIA_H20,dtype=int8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=256,N=256,device_name=NVIDIA_H20-3e,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=256,N=256,device_name=NVIDIA_H200,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=256,N=256,device_name=NVIDIA_L20,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=256,N=512,device_name=AMD_Instinct_MI325_OAM,dtype=fp8_w8a8,block_shape=[128,128].json +200 -0
- vllm/model_executor/layers/fused_moe/configs/E=256,N=64,device_name=NVIDIA_A800-SXM4-80GB.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=60,N=1408,device_name=AMD_Instinct_MI300X.json +200 -0
- vllm/model_executor/layers/fused_moe/configs/E=60,N=176,device_name=AMD_Instinct_MI300X.json +200 -0
- vllm/model_executor/layers/fused_moe/configs/E=60,N=352,device_name=AMD_Instinct_MI300X.json +200 -0
- vllm/model_executor/layers/fused_moe/configs/E=60,N=704,device_name=AMD_Instinct_MI300X.json +200 -0
- vllm/model_executor/layers/fused_moe/configs/E=64,N=1280,device_name=NVIDIA_A100-SXM4-80GB.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=64,N=1280,device_name=NVIDIA_A800-SXM4-80GB.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=64,N=1280,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=64,N=1280,device_name=NVIDIA_H100_80GB_HBM3.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=64,N=1280,device_name=NVIDIA_H200,dtype=fp8_w8a8.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=64,N=1280,device_name=NVIDIA_H200.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=64,N=2560,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=64,N=2560,device_name=NVIDIA_H200,dtype=fp8_w8a8.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=64,N=2560,device_name=NVIDIA_H200.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=64,N=320,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=64,N=320,device_name=NVIDIA_H100_80GB_HBM3.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=64,N=320,device_name=NVIDIA_H200,dtype=fp8_w8a8.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=64,N=320,device_name=NVIDIA_H200.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=64,N=640,device_name=NVIDIA_A100-SXM4-80GB.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=64,N=640,device_name=NVIDIA_A800-SXM4-80GB.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=64,N=640,device_name=NVIDIA_GeForce_RTX_4090,dtype=fp8_w8a8.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=64,N=640,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=64,N=640,device_name=NVIDIA_H100_80GB_HBM3.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=64,N=640,device_name=NVIDIA_H200,dtype=fp8_w8a8.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=64,N=640,device_name=NVIDIA_H200.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=64,N=896,device_name=NVIDIA_H20.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=14336,device_name=AMD_Instinct_MI300X,dtype=fp8_w8a8.json +164 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=14336,device_name=AMD_Instinct_MI300X.json +200 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=14336,device_name=AMD_Instinct_MI325X,dtype=fp8_w8a8.json +164 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=14336,device_name=AMD_Instinct_MI325X.json +200 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=14336,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8.json +138 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=14336,device_name=NVIDIA_H200,dtype=fp8_w8a8.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=14336,device_name=NVIDIA_H200.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=16384,device_name=AMD_Instinct_MI300X,dtype=fp8_w8a8.json +164 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=16384,device_name=AMD_Instinct_MI300X.json +200 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=16384,device_name=AMD_Instinct_MI325X,dtype=fp8_w8a8.json +164 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=16384,device_name=AMD_Instinct_MI325X.json +200 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=1792,device_name=AMD_Instinct_MI300X,dtype=fp8_w8a8.json +164 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=1792,device_name=AMD_Instinct_MI300X.json +200 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=1792,device_name=AMD_Instinct_MI325X,dtype=fp8_w8a8.json +164 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=1792,device_name=AMD_Instinct_MI325X.json +200 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=1792,device_name=NVIDIA_A100-SXM4-40GB.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=1792,device_name=NVIDIA_A100-SXM4-80GB.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=1792,device_name=NVIDIA_H100_80GB_HBM3.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=1792,device_name=NVIDIA_H200,dtype=fp8_w8a8.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=1792,device_name=NVIDIA_H200.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=2048,device_name=AMD_Instinct_MI300X,dtype=fp8_w8a8.json +164 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=2048,device_name=AMD_Instinct_MI300X.json +200 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=2048,device_name=AMD_Instinct_MI325X,dtype=fp8_w8a8.json +164 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=2048,device_name=AMD_Instinct_MI325X.json +200 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=2048,device_name=NVIDIA_A100-SXM4-80GB.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=2048,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=2048,device_name=NVIDIA_H100_80GB_HBM3.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=2048,device_name=NVIDIA_H200,dtype=fp8_w8a8.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=2048,device_name=NVIDIA_H200.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=3584,device_name=AMD_Instinct_MI300X,dtype=fp8_w8a8.json +164 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=3584,device_name=AMD_Instinct_MI300X.json +200 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=3584,device_name=AMD_Instinct_MI325X,dtype=fp8_w8a8.json +164 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=3584,device_name=AMD_Instinct_MI325X.json +200 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=3584,device_name=NVIDIA_A100-SXM4-40GB.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=3584,device_name=NVIDIA_A100-SXM4-80GB.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=3584,device_name=NVIDIA_GeForce_RTX_4090,dtype=fp8_w8a8.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=3584,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=3584,device_name=NVIDIA_H100_80GB_HBM3.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=3584,device_name=NVIDIA_H200,dtype=fp8_w8a8.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=3584,device_name=NVIDIA_H200.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=3584,device_name=NVIDIA_L40S.json +173 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=4096,device_name=AMD_Instinct_MI300X,dtype=fp8_w8a8.json +164 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=4096,device_name=AMD_Instinct_MI300X.json +200 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=4096,device_name=AMD_Instinct_MI325X,dtype=fp8_w8a8.json +164 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=4096,device_name=AMD_Instinct_MI325X.json +200 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=4096,device_name=NVIDIA_A100-SXM4-80GB.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=4096,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=4096,device_name=NVIDIA_H100_80GB_HBM3.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=4096,device_name=NVIDIA_H200,dtype=fp8_w8a8.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=4096,device_name=NVIDIA_H200.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=7168,device_name=AMD_Instinct_MI300X,dtype=fp8_w8a8.json +164 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=7168,device_name=AMD_Instinct_MI300X.json +200 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=7168,device_name=AMD_Instinct_MI325X,dtype=fp8_w8a8.json +164 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=7168,device_name=AMD_Instinct_MI325X.json +200 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=7168,device_name=NVIDIA_A100-SXM4-80GB.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=7168,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=7168,device_name=NVIDIA_H100_80GB_HBM3.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=7168,device_name=NVIDIA_H200,dtype=fp8_w8a8.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=7168,device_name=NVIDIA_H200.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=8192,device_name=AMD_Instinct_MI300X,dtype=fp8_w8a8.json +164 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=8192,device_name=AMD_Instinct_MI300X.json +200 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=8192,device_name=AMD_Instinct_MI325X,dtype=fp8_w8a8.json +164 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=8192,device_name=AMD_Instinct_MI325X.json +200 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=8192,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=8192,device_name=NVIDIA_H200,dtype=fp8_w8a8.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/README +12 -0
- vllm/model_executor/layers/fused_moe/cutlass_moe.py +461 -0
- vllm/model_executor/layers/fused_moe/deep_gemm_moe.py +240 -0
- vllm/model_executor/layers/fused_moe/deepep_ht_prepare_finalize.py +240 -0
- vllm/model_executor/layers/fused_moe/deepep_ll_prepare_finalize.py +186 -0
- vllm/model_executor/layers/fused_moe/fused_batched_moe.py +775 -0
- vllm/model_executor/layers/fused_moe/fused_marlin_moe.py +232 -0
- vllm/model_executor/layers/fused_moe/fused_moe.py +1724 -0
- vllm/model_executor/layers/fused_moe/layer.py +1535 -0
- vllm/model_executor/layers/fused_moe/modular_kernel.py +446 -0
- vllm/model_executor/layers/fused_moe/moe_align_block_size.py +243 -0
- vllm/model_executor/layers/fused_moe/moe_pallas.py +80 -0
- vllm/model_executor/layers/fused_moe/moe_permute_unpermute.py +190 -0
- vllm/model_executor/layers/fused_moe/moe_torch_iterative.py +60 -0
- vllm/model_executor/layers/fused_moe/pplx_prepare_finalize.py +159 -0
- vllm/model_executor/layers/fused_moe/prepare_finalize.py +69 -0
- vllm/model_executor/layers/fused_moe/rocm_aiter_fused_moe.py +421 -0
- vllm/model_executor/layers/fused_moe/triton_deep_gemm_moe.py +117 -0
- vllm/model_executor/layers/fused_moe/utils.py +98 -0
- vllm/model_executor/layers/layernorm.py +288 -0
- vllm/model_executor/layers/lightning_attn.py +652 -0
- vllm/model_executor/layers/linear.py +1524 -0
- vllm/model_executor/layers/logits_processor.py +197 -0
- vllm/model_executor/layers/mamba/__init__.py +0 -0
- vllm/model_executor/layers/mamba/mamba2_metadata.py +125 -0
- vllm/model_executor/layers/mamba/mamba_mixer.py +245 -0
- vllm/model_executor/layers/mamba/mamba_mixer2.py +616 -0
- vllm/model_executor/layers/mamba/ops/__init__.py +0 -0
- vllm/model_executor/layers/mamba/ops/causal_conv1d.py +105 -0
- vllm/model_executor/layers/mamba/ops/mamba_ssm.py +414 -0
- vllm/model_executor/layers/mamba/ops/ssd_bmm.py +262 -0
- vllm/model_executor/layers/mamba/ops/ssd_chunk_scan.py +589 -0
- vllm/model_executor/layers/mamba/ops/ssd_chunk_state.py +751 -0
- vllm/model_executor/layers/mamba/ops/ssd_combined.py +232 -0
- vllm/model_executor/layers/mamba/ops/ssd_state_passing.py +206 -0
- vllm/model_executor/layers/pooler.py +350 -0
- vllm/model_executor/layers/quantization/__init__.py +157 -0
- vllm/model_executor/layers/quantization/aqlm.py +376 -0
- vllm/model_executor/layers/quantization/auto_round.py +310 -0
- vllm/model_executor/layers/quantization/awq.py +194 -0
- vllm/model_executor/layers/quantization/awq_marlin.py +519 -0
- vllm/model_executor/layers/quantization/awq_triton.py +320 -0
- vllm/model_executor/layers/quantization/base_config.py +151 -0
- vllm/model_executor/layers/quantization/bitblas.py +461 -0
- vllm/model_executor/layers/quantization/bitsandbytes.py +396 -0
- vllm/model_executor/layers/quantization/compressed_tensors/__init__.py +0 -0
- vllm/model_executor/layers/quantization/compressed_tensors/compressed_tensors.py +668 -0
- vllm/model_executor/layers/quantization/compressed_tensors/compressed_tensors_moe.py +1260 -0
- vllm/model_executor/layers/quantization/compressed_tensors/schemes/__init__.py +24 -0
- vllm/model_executor/layers/quantization/compressed_tensors/schemes/compressed_tensors_24.py +358 -0
- vllm/model_executor/layers/quantization/compressed_tensors/schemes/compressed_tensors_scheme.py +55 -0
- vllm/model_executor/layers/quantization/compressed_tensors/schemes/compressed_tensors_w4a16_24.py +160 -0
- vllm/model_executor/layers/quantization/compressed_tensors/schemes/compressed_tensors_w4a16_nvfp4.py +93 -0
- vllm/model_executor/layers/quantization/compressed_tensors/schemes/compressed_tensors_w4a4_nvfp4.py +178 -0
- vllm/model_executor/layers/quantization/compressed_tensors/schemes/compressed_tensors_w8a16_fp8.py +121 -0
- vllm/model_executor/layers/quantization/compressed_tensors/schemes/compressed_tensors_w8a8_fp8.py +150 -0
- vllm/model_executor/layers/quantization/compressed_tensors/schemes/compressed_tensors_w8a8_int8.py +111 -0
- vllm/model_executor/layers/quantization/compressed_tensors/schemes/compressed_tensors_wNa16.py +201 -0
- vllm/model_executor/layers/quantization/compressed_tensors/triton_scaled_mm.py +206 -0
- vllm/model_executor/layers/quantization/compressed_tensors/utils.py +216 -0
- vllm/model_executor/layers/quantization/deepspeedfp.py +195 -0
- vllm/model_executor/layers/quantization/experts_int8.py +196 -0
- vllm/model_executor/layers/quantization/fbgemm_fp8.py +172 -0
- vllm/model_executor/layers/quantization/fp8.py +906 -0
- vllm/model_executor/layers/quantization/gguf.py +565 -0
- vllm/model_executor/layers/quantization/gptq.py +278 -0
- vllm/model_executor/layers/quantization/gptq_bitblas.py +445 -0
- vllm/model_executor/layers/quantization/gptq_marlin.py +648 -0
- vllm/model_executor/layers/quantization/gptq_marlin_24.py +297 -0
- vllm/model_executor/layers/quantization/hqq_marlin.py +332 -0
- vllm/model_executor/layers/quantization/ipex_quant.py +250 -0
- vllm/model_executor/layers/quantization/kernels/__init__.py +0 -0
- vllm/model_executor/layers/quantization/kernels/mixed_precision/MPLinearKernel.py +90 -0
- vllm/model_executor/layers/quantization/kernels/mixed_precision/__init__.py +83 -0
- vllm/model_executor/layers/quantization/kernels/mixed_precision/allspark.py +116 -0
- vllm/model_executor/layers/quantization/kernels/mixed_precision/bitblas.py +300 -0
- vllm/model_executor/layers/quantization/kernels/mixed_precision/exllama.py +143 -0
- vllm/model_executor/layers/quantization/kernels/mixed_precision/machete.py +120 -0
- vllm/model_executor/layers/quantization/kernels/mixed_precision/marlin.py +131 -0
- vllm/model_executor/layers/quantization/kernels/scaled_mm/ScaledMMLinearKernel.py +67 -0
- vllm/model_executor/layers/quantization/kernels/scaled_mm/__init__.py +87 -0
- vllm/model_executor/layers/quantization/kernels/scaled_mm/aiter.py +120 -0
- vllm/model_executor/layers/quantization/kernels/scaled_mm/cutlass.py +137 -0
- vllm/model_executor/layers/quantization/kernels/scaled_mm/triton.py +41 -0
- vllm/model_executor/layers/quantization/kernels/scaled_mm/xla.py +105 -0
- vllm/model_executor/layers/quantization/kv_cache.py +139 -0
- vllm/model_executor/layers/quantization/marlin.py +261 -0
- vllm/model_executor/layers/quantization/modelopt.py +737 -0
- vllm/model_executor/layers/quantization/moe_wna16.py +449 -0
- vllm/model_executor/layers/quantization/neuron_quant.py +76 -0
- vllm/model_executor/layers/quantization/ptpc_fp8.py +127 -0
- vllm/model_executor/layers/quantization/qqq.py +275 -0
- vllm/model_executor/layers/quantization/quark/__init__.py +0 -0
- vllm/model_executor/layers/quantization/quark/quark.py +441 -0
- vllm/model_executor/layers/quantization/quark/quark_moe.py +237 -0
- vllm/model_executor/layers/quantization/quark/schemes/__init__.py +9 -0
- vllm/model_executor/layers/quantization/quark/schemes/quark_scheme.py +55 -0
- vllm/model_executor/layers/quantization/quark/schemes/quark_w4a4_mxfp4.py +126 -0
- vllm/model_executor/layers/quantization/quark/schemes/quark_w8a8_fp8.py +146 -0
- vllm/model_executor/layers/quantization/quark/schemes/quark_w8a8_int8.py +122 -0
- vllm/model_executor/layers/quantization/quark/utils.py +105 -0
- vllm/model_executor/layers/quantization/schema.py +86 -0
- vllm/model_executor/layers/quantization/torchao.py +161 -0
- vllm/model_executor/layers/quantization/tpu_int8.py +121 -0
- vllm/model_executor/layers/quantization/utils/__init__.py +6 -0
- vllm/model_executor/layers/quantization/utils/allspark_utils.py +52 -0
- vllm/model_executor/layers/quantization/utils/bitblas_utils.py +208 -0
- vllm/model_executor/layers/quantization/utils/configs/N=1536,K=1536,device_name=AMD_Instinct_MI300X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=1536,K=1536,device_name=AMD_Instinct_MI325X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=1536,K=1536,device_name=AMD_Instinct_MI325_OAM,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=1536,K=1536,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=1536,K=1536,device_name=NVIDIA_A800-SXM4-80GB,dtype=int8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=1536,K=1536,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=1536,K=1536,device_name=NVIDIA_H20,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=1536,K=1536,device_name=NVIDIA_L20Y,dtype=fp8_w8a8,block_shape=[128,128].json +26 -0
- vllm/model_executor/layers/quantization/utils/configs/N=1536,K=7168,device_name=AMD_Instinct_MI300X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=1536,K=7168,device_name=AMD_Instinct_MI325X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=1536,K=7168,device_name=AMD_Instinct_MI325_OAM,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=1536,K=7168,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=1536,K=7168,device_name=NVIDIA_A800-SXM4-80GB,dtype=int8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=1536,K=7168,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=1536,K=7168,device_name=NVIDIA_H20,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=1536,K=7168,device_name=NVIDIA_H200,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=1536,K=7168,device_name=NVIDIA_L20,dtype=fp8_w8a8,block_shape=[128,128].json +26 -0
- vllm/model_executor/layers/quantization/utils/configs/N=1536,K=7168,device_name=NVIDIA_L20Y,dtype=fp8_w8a8,block_shape=[128,128].json +26 -0
- vllm/model_executor/layers/quantization/utils/configs/N=2048,K=512,device_name=AMD_Instinct_MI300X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=2048,K=512,device_name=AMD_Instinct_MI325X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=2048,K=512,device_name=AMD_Instinct_MI325_OAM,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=2048,K=512,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=2048,K=512,device_name=NVIDIA_A800-SXM4-80GB,dtype=int8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=2048,K=512,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=2048,K=512,device_name=NVIDIA_H20,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=2048,K=512,device_name=NVIDIA_H200,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=2048,K=512,device_name=NVIDIA_L20Y,dtype=fp8_w8a8,block_shape=[128,128].json +26 -0
- vllm/model_executor/layers/quantization/utils/configs/N=2304,K=7168,device_name=AMD_Instinct_MI300X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=2304,K=7168,device_name=AMD_Instinct_MI325X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=2304,K=7168,device_name=AMD_Instinct_MI325_OAM,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=2304,K=7168,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=2304,K=7168,device_name=NVIDIA_A800-SXM4-80GB,dtype=int8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=2304,K=7168,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=2304,K=7168,device_name=NVIDIA_H20,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=2304,K=7168,device_name=NVIDIA_H200,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=2304,K=7168,device_name=NVIDIA_L20Y,dtype=fp8_w8a8,block_shape=[128,128].json +26 -0
- vllm/model_executor/layers/quantization/utils/configs/N=24576,K=7168,device_name=AMD_Instinct_MI300X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=24576,K=7168,device_name=AMD_Instinct_MI325X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=24576,K=7168,device_name=AMD_Instinct_MI325_OAM,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=24576,K=7168,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=24576,K=7168,device_name=NVIDIA_A800-SXM4-80GB,dtype=int8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=24576,K=7168,device_name=NVIDIA_B200,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=24576,K=7168,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=24576,K=7168,device_name=NVIDIA_H20,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=24576,K=7168,device_name=NVIDIA_H20,dtype=int8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=24576,K=7168,device_name=NVIDIA_H200,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=24576,K=7168,device_name=NVIDIA_L20,dtype=fp8_w8a8,block_shape=[128,128].json +26 -0
- vllm/model_executor/layers/quantization/utils/configs/N=24576,K=7168,device_name=NVIDIA_L20Y,dtype=fp8_w8a8,block_shape=[128,128].json +26 -0
- vllm/model_executor/layers/quantization/utils/configs/N=256,K=7168,device_name=AMD_Instinct_MI300X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=256,K=7168,device_name=AMD_Instinct_MI325X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=256,K=7168,device_name=AMD_Instinct_MI325_OAM,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=256,K=7168,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=256,K=7168,device_name=NVIDIA_A800-SXM4-80GB,dtype=int8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=256,K=7168,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=256,K=7168,device_name=NVIDIA_H20,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=256,K=7168,device_name=NVIDIA_L20Y,dtype=fp8_w8a8,block_shape=[128,128].json +26 -0
- vllm/model_executor/layers/quantization/utils/configs/N=3072,K=1536,device_name=AMD_Instinct_MI300X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=3072,K=1536,device_name=AMD_Instinct_MI325X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=3072,K=1536,device_name=AMD_Instinct_MI325_OAM,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=3072,K=1536,device_name=NVIDIA_B200,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=3072,K=1536,device_name=NVIDIA_H20,dtype=int8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=3072,K=1536,device_name=NVIDIA_H200,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=3072,K=1536,device_name=NVIDIA_L20,dtype=fp8_w8a8,block_shape=[128,128].json +26 -0
- vllm/model_executor/layers/quantization/utils/configs/N=3072,K=7168,device_name=AMD_Instinct_MI300X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=3072,K=7168,device_name=AMD_Instinct_MI325X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=3072,K=7168,device_name=AMD_Instinct_MI325_OAM,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=3072,K=7168,device_name=NVIDIA_B200,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=3072,K=7168,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=3072,K=7168,device_name=NVIDIA_H20,dtype=int8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=3072,K=7168,device_name=NVIDIA_H200,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=3072,K=7168,device_name=NVIDIA_L20,dtype=fp8_w8a8,block_shape=[128,128].json +26 -0
- vllm/model_executor/layers/quantization/utils/configs/N=32768,K=512,device_name=AMD_Instinct_MI300X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=32768,K=512,device_name=AMD_Instinct_MI325X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=32768,K=512,device_name=AMD_Instinct_MI325_OAM,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=32768,K=512,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=32768,K=512,device_name=NVIDIA_A800-SXM4-80GB,dtype=int8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=32768,K=512,device_name=NVIDIA_B200,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=32768,K=512,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=32768,K=512,device_name=NVIDIA_H20,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=32768,K=512,device_name=NVIDIA_H20,dtype=int8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=32768,K=512,device_name=NVIDIA_H200,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=32768,K=512,device_name=NVIDIA_L20,dtype=fp8_w8a8,block_shape=[128,128].json +26 -0
- vllm/model_executor/layers/quantization/utils/configs/N=32768,K=512,device_name=NVIDIA_L20Y,dtype=fp8_w8a8,block_shape=[128,128].json +26 -0
- vllm/model_executor/layers/quantization/utils/configs/N=36864,K=7168,device_name=AMD_Instinct_MI300X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=36864,K=7168,device_name=AMD_Instinct_MI325X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=36864,K=7168,device_name=AMD_Instinct_MI325_OAM,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=36864,K=7168,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=36864,K=7168,device_name=NVIDIA_H200,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=4096,K=512,device_name=AMD_Instinct_MI300X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=4096,K=512,device_name=AMD_Instinct_MI325X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=4096,K=512,device_name=AMD_Instinct_MI325_OAM,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=4096,K=512,device_name=NVIDIA_B200,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=4096,K=512,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=4096,K=512,device_name=NVIDIA_H20,dtype=int8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=4096,K=512,device_name=NVIDIA_H200,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=4096,K=512,device_name=NVIDIA_L20,dtype=fp8_w8a8,block_shape=[128,128].json +26 -0
- vllm/model_executor/layers/quantization/utils/configs/N=4608,K=7168,device_name=AMD_Instinct_MI300X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=4608,K=7168,device_name=AMD_Instinct_MI325X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=4608,K=7168,device_name=AMD_Instinct_MI325_OAM,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=4608,K=7168,device_name=NVIDIA_B200,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=4608,K=7168,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=4608,K=7168,device_name=NVIDIA_H20,dtype=int8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=4608,K=7168,device_name=NVIDIA_H200,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=4608,K=7168,device_name=NVIDIA_L20,dtype=fp8_w8a8,block_shape=[128,128].json +26 -0
- vllm/model_executor/layers/quantization/utils/configs/N=512,K=7168,device_name=AMD_Instinct_MI300X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=512,K=7168,device_name=AMD_Instinct_MI325X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=512,K=7168,device_name=AMD_Instinct_MI325_OAM,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=512,K=7168,device_name=NVIDIA_B200,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=512,K=7168,device_name=NVIDIA_H20,dtype=int8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=512,K=7168,device_name=NVIDIA_H200,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=512,K=7168,device_name=NVIDIA_L20,dtype=fp8_w8a8,block_shape=[128,128].json +26 -0
- vllm/model_executor/layers/quantization/utils/configs/N=576,K=7168,device_name=AMD_Instinct_MI300X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=576,K=7168,device_name=AMD_Instinct_MI325X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=576,K=7168,device_name=AMD_Instinct_MI325_OAM,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=576,K=7168,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=576,K=7168,device_name=NVIDIA_A800-SXM4-80GB,dtype=int8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=576,K=7168,device_name=NVIDIA_B200,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=576,K=7168,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=576,K=7168,device_name=NVIDIA_H20,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=576,K=7168,device_name=NVIDIA_H20,dtype=int8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=576,K=7168,device_name=NVIDIA_H200,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=576,K=7168,device_name=NVIDIA_L20,dtype=fp8_w8a8,block_shape=[128,128].json +18 -0
- vllm/model_executor/layers/quantization/utils/configs/N=576,K=7168,device_name=NVIDIA_L20Y,dtype=fp8_w8a8,block_shape=[128,128].json +26 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=1024,device_name=AMD_Instinct_MI300X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=1024,device_name=AMD_Instinct_MI325X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=1024,device_name=AMD_Instinct_MI325_OAM,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=1024,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=1024,device_name=NVIDIA_A800-SXM4-80GB,dtype=int8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=1024,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=1024,device_name=NVIDIA_H20,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=1024,device_name=NVIDIA_H200,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=1024,device_name=NVIDIA_L20Y,dtype=fp8_w8a8,block_shape=[128,128].json +26 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=1152,device_name=AMD_Instinct_MI300X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=1152,device_name=AMD_Instinct_MI325X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=1152,device_name=AMD_Instinct_MI325_OAM,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=1152,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=1152,device_name=NVIDIA_A800-SXM4-80GB,dtype=int8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=1152,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=1152,device_name=NVIDIA_H20,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=1152,device_name=NVIDIA_H200,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=1152,device_name=NVIDIA_L20Y,dtype=fp8_w8a8,block_shape=[128,128].json +26 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=128,device_name=AMD_Instinct_MI300X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=128,device_name=AMD_Instinct_MI325X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=128,device_name=AMD_Instinct_MI325_OAM,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=128,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=128,device_name=NVIDIA_A800-SXM4-80GB,dtype=int8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=128,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=128,device_name=NVIDIA_H20,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=128,device_name=NVIDIA_L20Y,dtype=fp8_w8a8,block_shape=[128,128].json +26 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=16384,device_name=AMD_Instinct_MI300X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=16384,device_name=AMD_Instinct_MI325X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=16384,device_name=AMD_Instinct_MI325_OAM,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=16384,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=16384,device_name=NVIDIA_A800-SXM4-80GB,dtype=int8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=16384,device_name=NVIDIA_B200,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=16384,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=16384,device_name=NVIDIA_H20,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=16384,device_name=NVIDIA_H20,dtype=int8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=16384,device_name=NVIDIA_H200,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=16384,device_name=NVIDIA_L20,dtype=fp8_w8a8,block_shape=[128,128].json +26 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=16384,device_name=NVIDIA_L20Y,dtype=fp8_w8a8,block_shape=[128,128].json +26 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=18432,device_name=AMD_Instinct_MI300X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=18432,device_name=AMD_Instinct_MI325X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=18432,device_name=AMD_Instinct_MI325_OAM,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=18432,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=18432,device_name=NVIDIA_A800-SXM4-80GB,dtype=int8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=18432,device_name=NVIDIA_B200,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=18432,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=18432,device_name=NVIDIA_H20,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=18432,device_name=NVIDIA_H20,dtype=int8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=18432,device_name=NVIDIA_H200,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=18432,device_name=NVIDIA_L20,dtype=fp8_w8a8,block_shape=[128,128].json +26 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=18432,device_name=NVIDIA_L20Y,dtype=fp8_w8a8,block_shape=[128,128].json +26 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=2048,device_name=AMD_Instinct_MI300X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=2048,device_name=AMD_Instinct_MI325X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=2048,device_name=AMD_Instinct_MI325_OAM,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=2048,device_name=NVIDIA_B200,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=2048,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=2048,device_name=NVIDIA_H20,dtype=int8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=2048,device_name=NVIDIA_H200,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=2048,device_name=NVIDIA_L20,dtype=fp8_w8a8,block_shape=[128,128].json +26 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=2304,device_name=AMD_Instinct_MI300X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=2304,device_name=AMD_Instinct_MI325X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=2304,device_name=AMD_Instinct_MI325_OAM,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=2304,device_name=NVIDIA_B200,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=2304,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=2304,device_name=NVIDIA_H20,dtype=int8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=2304,device_name=NVIDIA_H200,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=2304,device_name=NVIDIA_L20,dtype=fp8_w8a8,block_shape=[128,128].json +26 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=256,device_name=AMD_Instinct_MI300X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=256,device_name=AMD_Instinct_MI325X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=256,device_name=AMD_Instinct_MI325_OAM,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=256,device_name=NVIDIA_B200,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=256,device_name=NVIDIA_H20,dtype=int8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=256,device_name=NVIDIA_H200,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=256,device_name=NVIDIA_L20,dtype=fp8_w8a8,block_shape=[128,128].json +26 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=8192,device_name=AMD_Instinct_MI300X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=8192,device_name=AMD_Instinct_MI325X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=8192,device_name=AMD_Instinct_MI325_OAM,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=8192,K=1536,device_name=AMD_Instinct_MI300X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=8192,K=1536,device_name=AMD_Instinct_MI325X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=8192,K=1536,device_name=AMD_Instinct_MI325_OAM,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/fp8_utils.py +618 -0
- vllm/model_executor/layers/quantization/utils/gptq_utils.py +95 -0
- vllm/model_executor/layers/quantization/utils/int8_utils.py +485 -0
- vllm/model_executor/layers/quantization/utils/layer_utils.py +40 -0
- vllm/model_executor/layers/quantization/utils/machete_utils.py +33 -0
- vllm/model_executor/layers/quantization/utils/marlin_utils.py +476 -0
- vllm/model_executor/layers/quantization/utils/marlin_utils_fp4.py +283 -0
- vllm/model_executor/layers/quantization/utils/marlin_utils_fp8.py +325 -0
- vllm/model_executor/layers/quantization/utils/marlin_utils_test.py +165 -0
- vllm/model_executor/layers/quantization/utils/marlin_utils_test_24.py +464 -0
- vllm/model_executor/layers/quantization/utils/marlin_utils_test_qqq.py +126 -0
- vllm/model_executor/layers/quantization/utils/mxfp4_utils.py +45 -0
- vllm/model_executor/layers/quantization/utils/nvfp4_emulation_utils.py +104 -0
- vllm/model_executor/layers/quantization/utils/quant_utils.py +573 -0
- vllm/model_executor/layers/quantization/utils/w8a8_utils.py +405 -0
- vllm/model_executor/layers/rejection_sampler.py +406 -0
- vllm/model_executor/layers/resampler.py +270 -0
- vllm/model_executor/layers/rotary_embedding.py +1862 -0
- vllm/model_executor/layers/sampler.py +1204 -0
- vllm/model_executor/layers/spec_decode_base_sampler.py +259 -0
- vllm/model_executor/layers/typical_acceptance_sampler.py +166 -0
- vllm/model_executor/layers/utils.py +95 -0
- vllm/model_executor/layers/vocab_parallel_embedding.py +487 -0
- vllm/model_executor/model_loader/__init__.py +76 -0
- vllm/model_executor/model_loader/base_loader.py +43 -0
- vllm/model_executor/model_loader/bitsandbytes_loader.py +570 -0
- vllm/model_executor/model_loader/default_loader.py +282 -0
- vllm/model_executor/model_loader/dummy_loader.py +27 -0
- vllm/model_executor/model_loader/gguf_loader.py +120 -0
- vllm/model_executor/model_loader/neuron.py +476 -0
- vllm/model_executor/model_loader/neuronx_distributed.py +685 -0
- vllm/model_executor/model_loader/runai_streamer_loader.py +109 -0
- vllm/model_executor/model_loader/sharded_state_loader.py +201 -0
- vllm/model_executor/model_loader/tensorizer.py +600 -0
- vllm/model_executor/model_loader/tensorizer_loader.py +123 -0
- vllm/model_executor/model_loader/tpu.py +112 -0
- vllm/model_executor/model_loader/utils.py +302 -0
- vllm/model_executor/model_loader/weight_utils.py +782 -0
- vllm/model_executor/models/__init__.py +28 -0
- vllm/model_executor/models/adapters.py +248 -0
- vllm/model_executor/models/aimv2.py +246 -0
- vllm/model_executor/models/arctic.py +559 -0
- vllm/model_executor/models/aria.py +657 -0
- vllm/model_executor/models/aya_vision.py +466 -0
- vllm/model_executor/models/baichuan.py +474 -0
- vllm/model_executor/models/bamba.py +543 -0
- vllm/model_executor/models/bart.py +938 -0
- vllm/model_executor/models/bert.py +523 -0
- vllm/model_executor/models/bert_with_rope.py +769 -0
- vllm/model_executor/models/blip.py +339 -0
- vllm/model_executor/models/blip2.py +718 -0
- vllm/model_executor/models/bloom.py +373 -0
- vllm/model_executor/models/chameleon.py +1136 -0
- vllm/model_executor/models/chatglm.py +478 -0
- vllm/model_executor/models/clip.py +407 -0
- vllm/model_executor/models/commandr.py +472 -0
- vllm/model_executor/models/constant_size_cache.py +137 -0
- vllm/model_executor/models/dbrx.py +472 -0
- vllm/model_executor/models/deepseek.py +486 -0
- vllm/model_executor/models/deepseek_mtp.py +269 -0
- vllm/model_executor/models/deepseek_v2.py +843 -0
- vllm/model_executor/models/deepseek_vl2.py +648 -0
- vllm/model_executor/models/eagle.py +260 -0
- vllm/model_executor/models/exaone.py +551 -0
- vllm/model_executor/models/fairseq2_llama.py +154 -0
- vllm/model_executor/models/falcon.py +510 -0
- vllm/model_executor/models/falcon_h1.py +685 -0
- vllm/model_executor/models/florence2.py +1103 -0
- vllm/model_executor/models/fuyu.py +389 -0
- vllm/model_executor/models/gemma.py +425 -0
- vllm/model_executor/models/gemma2.py +425 -0
- vllm/model_executor/models/gemma3.py +533 -0
- vllm/model_executor/models/gemma3_mm.py +709 -0
- vllm/model_executor/models/glm.py +23 -0
- vllm/model_executor/models/glm4.py +305 -0
- vllm/model_executor/models/glm4v.py +648 -0
- vllm/model_executor/models/gpt2.py +328 -0
- vllm/model_executor/models/gpt_bigcode.py +335 -0
- vllm/model_executor/models/gpt_j.py +339 -0
- vllm/model_executor/models/gpt_neox.py +332 -0
- vllm/model_executor/models/granite.py +493 -0
- vllm/model_executor/models/granite_speech.py +779 -0
- vllm/model_executor/models/granitemoe.py +437 -0
- vllm/model_executor/models/granitemoehybrid.py +586 -0
- vllm/model_executor/models/granitemoeshared.py +341 -0
- vllm/model_executor/models/gritlm.py +224 -0
- vllm/model_executor/models/grok1.py +546 -0
- vllm/model_executor/models/h2ovl.py +546 -0
- vllm/model_executor/models/idefics2_vision_model.py +389 -0
- vllm/model_executor/models/idefics3.py +776 -0
- vllm/model_executor/models/interfaces.py +572 -0
- vllm/model_executor/models/interfaces_base.py +164 -0
- vllm/model_executor/models/intern_vit.py +480 -0
- vllm/model_executor/models/internlm2.py +455 -0
- vllm/model_executor/models/internlm2_ve.py +147 -0
- vllm/model_executor/models/internvl.py +1418 -0
- vllm/model_executor/models/jais.py +373 -0
- vllm/model_executor/models/jamba.py +592 -0
- vllm/model_executor/models/kimi_vl.py +577 -0
- vllm/model_executor/models/llama.py +644 -0
- vllm/model_executor/models/llama4.py +532 -0
- vllm/model_executor/models/llama_eagle.py +165 -0
- vllm/model_executor/models/llama_eagle3.py +263 -0
- vllm/model_executor/models/llava.py +866 -0
- vllm/model_executor/models/llava_next.py +586 -0
- vllm/model_executor/models/llava_next_video.py +471 -0
- vllm/model_executor/models/llava_onevision.py +956 -0
- vllm/model_executor/models/mamba.py +273 -0
- vllm/model_executor/models/mamba2.py +308 -0
- vllm/model_executor/models/mamba_cache.py +76 -0
- vllm/model_executor/models/medusa.py +219 -0
- vllm/model_executor/models/mimo.py +192 -0
- vllm/model_executor/models/mimo_mtp.py +285 -0
- vllm/model_executor/models/minicpm.py +592 -0
- vllm/model_executor/models/minicpm3.py +230 -0
- vllm/model_executor/models/minicpm_eagle.py +391 -0
- vllm/model_executor/models/minicpmo.py +759 -0
- vllm/model_executor/models/minicpmv.py +1287 -0
- vllm/model_executor/models/minimax_cache.py +36 -0
- vllm/model_executor/models/minimax_text_01.py +1301 -0
- vllm/model_executor/models/minimax_vl_01.py +364 -0
- vllm/model_executor/models/mistral3.py +604 -0
- vllm/model_executor/models/mixtral.py +488 -0
- vllm/model_executor/models/mixtral_quant.py +453 -0
- vllm/model_executor/models/mllama.py +1624 -0
- vllm/model_executor/models/mllama4.py +938 -0
- vllm/model_executor/models/mlp_speculator.py +206 -0
- vllm/model_executor/models/modernbert.py +331 -0
- vllm/model_executor/models/module_mapping.py +72 -0
- vllm/model_executor/models/molmo.py +1568 -0
- vllm/model_executor/models/moonvit.py +630 -0
- vllm/model_executor/models/mpt.py +331 -0
- vllm/model_executor/models/nemotron.py +508 -0
- vllm/model_executor/models/nemotron_h.py +573 -0
- vllm/model_executor/models/nemotron_nas.py +484 -0
- vllm/model_executor/models/nvlm_d.py +216 -0
- vllm/model_executor/models/olmo.py +389 -0
- vllm/model_executor/models/olmo2.py +414 -0
- vllm/model_executor/models/olmoe.py +468 -0
- vllm/model_executor/models/opt.py +412 -0
- vllm/model_executor/models/orion.py +349 -0
- vllm/model_executor/models/ovis.py +567 -0
- vllm/model_executor/models/paligemma.py +398 -0
- vllm/model_executor/models/persimmon.py +344 -0
- vllm/model_executor/models/phi.py +356 -0
- vllm/model_executor/models/phi3.py +19 -0
- vllm/model_executor/models/phi3_small.py +465 -0
- vllm/model_executor/models/phi3v.py +723 -0
- vllm/model_executor/models/phi4mm.py +1246 -0
- vllm/model_executor/models/phi4mm_audio.py +1233 -0
- vllm/model_executor/models/phi4mm_utils.py +1884 -0
- vllm/model_executor/models/phimoe.py +665 -0
- vllm/model_executor/models/pixtral.py +1316 -0
- vllm/model_executor/models/plamo2.py +738 -0
- vllm/model_executor/models/prithvi_geospatial_mae.py +232 -0
- vllm/model_executor/models/qwen.py +362 -0
- vllm/model_executor/models/qwen2.py +497 -0
- vllm/model_executor/models/qwen2_5_omni_thinker.py +904 -0
- vllm/model_executor/models/qwen2_5_vl.py +1166 -0
- vllm/model_executor/models/qwen2_audio.py +410 -0
- vllm/model_executor/models/qwen2_moe.py +540 -0
- vllm/model_executor/models/qwen2_rm.py +132 -0
- vllm/model_executor/models/qwen2_vl.py +1405 -0
- vllm/model_executor/models/qwen3.py +321 -0
- vllm/model_executor/models/qwen3_moe.py +535 -0
- vllm/model_executor/models/qwen_vl.py +785 -0
- vllm/model_executor/models/registry.py +622 -0
- vllm/model_executor/models/roberta.py +276 -0
- vllm/model_executor/models/siglip.py +524 -0
- vllm/model_executor/models/skyworkr1v.py +951 -0
- vllm/model_executor/models/smolvlm.py +52 -0
- vllm/model_executor/models/solar.py +506 -0
- vllm/model_executor/models/stablelm.py +343 -0
- vllm/model_executor/models/starcoder2.py +356 -0
- vllm/model_executor/models/tarsier.py +643 -0
- vllm/model_executor/models/telechat2.py +140 -0
- vllm/model_executor/models/teleflm.py +79 -0
- vllm/model_executor/models/transformers.py +508 -0
- vllm/model_executor/models/ultravox.py +656 -0
- vllm/model_executor/models/utils.py +731 -0
- vllm/model_executor/models/vision.py +147 -0
- vllm/model_executor/models/whisper.py +747 -0
- vllm/model_executor/models/zamba2.py +1009 -0
- vllm/model_executor/parameter.py +459 -0
- vllm/model_executor/pooling_metadata.py +72 -0
- vllm/model_executor/sampling_metadata.py +597 -0
- vllm/model_executor/utils.py +77 -0
- vllm/multimodal/__init__.py +33 -0
- vllm/multimodal/audio.py +106 -0
- vllm/multimodal/base.py +219 -0
- vllm/multimodal/hasher.py +118 -0
- vllm/multimodal/image.py +97 -0
- vllm/multimodal/inputs.py +876 -0
- vllm/multimodal/parse.py +461 -0
- vllm/multimodal/processing.py +1895 -0
- vllm/multimodal/profiling.py +258 -0
- vllm/multimodal/registry.py +331 -0
- vllm/multimodal/utils.py +436 -0
- vllm/multimodal/video.py +198 -0
- vllm/outputs.py +512 -0
- vllm/platforms/__init__.py +291 -0
- vllm/platforms/cpu.py +266 -0
- vllm/platforms/cuda.py +526 -0
- vllm/platforms/hpu.py +106 -0
- vllm/platforms/interface.py +538 -0
- vllm/platforms/neuron.py +150 -0
- vllm/platforms/rocm.py +435 -0
- vllm/platforms/tpu.py +216 -0
- vllm/platforms/xpu.py +156 -0
- vllm/plugins/__init__.py +94 -0
- vllm/plugins/lora_resolvers/README.md +15 -0
- vllm/plugins/lora_resolvers/__init__.py +0 -0
- vllm/plugins/lora_resolvers/filesystem_resolver.py +50 -0
- vllm/pooling_params.py +54 -0
- vllm/profiler/__init__.py +0 -0
- vllm/profiler/layerwise_profile.py +375 -0
- vllm/profiler/utils.py +148 -0
- vllm/prompt_adapter/__init__.py +0 -0
- vllm/prompt_adapter/layers.py +83 -0
- vllm/prompt_adapter/models.py +358 -0
- vllm/prompt_adapter/request.py +37 -0
- vllm/prompt_adapter/utils.py +98 -0
- vllm/prompt_adapter/worker_manager.py +179 -0
- vllm/py.typed +2 -0
- vllm/reasoning/__init__.py +15 -0
- vllm/reasoning/abs_reasoning_parsers.py +192 -0
- vllm/reasoning/deepseek_r1_reasoning_parser.py +173 -0
- vllm/reasoning/granite_reasoning_parser.py +363 -0
- vllm/reasoning/qwen3_reasoning_parser.py +151 -0
- vllm/sampling_params.py +602 -0
- vllm/scalar_type.py +347 -0
- vllm/scripts.py +15 -0
- vllm/sequence.py +1568 -0
- vllm/spec_decode/__init__.py +0 -0
- vllm/spec_decode/batch_expansion.py +506 -0
- vllm/spec_decode/draft_model_runner.py +349 -0
- vllm/spec_decode/interfaces.py +99 -0
- vllm/spec_decode/medusa_worker.py +138 -0
- vllm/spec_decode/metrics.py +213 -0
- vllm/spec_decode/mlp_speculator_worker.py +94 -0
- vllm/spec_decode/mqa_scorer.py +160 -0
- vllm/spec_decode/multi_step_worker.py +423 -0
- vllm/spec_decode/ngram_worker.py +196 -0
- vllm/spec_decode/proposer_worker_base.py +59 -0
- vllm/spec_decode/smaller_tp_proposer_worker.py +196 -0
- vllm/spec_decode/spec_decode_worker.py +1326 -0
- vllm/spec_decode/target_model_runner.py +45 -0
- vllm/spec_decode/top1_proposer.py +275 -0
- vllm/spec_decode/util.py +277 -0
- vllm/test_utils.py +130 -0
- vllm/third_party/__init__.py +0 -0
- vllm/third_party/pynvml.py +6140 -0
- vllm/tracing.py +131 -0
- vllm/transformers_utils/__init__.py +24 -0
- vllm/transformers_utils/chat_templates/__init__.py +5 -0
- vllm/transformers_utils/chat_templates/registry.py +60 -0
- vllm/transformers_utils/chat_templates/template_basic.jinja +3 -0
- vllm/transformers_utils/chat_templates/template_blip2.jinja +11 -0
- vllm/transformers_utils/chat_templates/template_chatml.jinja +10 -0
- vllm/transformers_utils/chat_templates/template_deepseek_vl2.jinja +23 -0
- vllm/transformers_utils/chat_templates/template_fuyu.jinja +3 -0
- vllm/transformers_utils/config.py +887 -0
- vllm/transformers_utils/configs/__init__.py +61 -0
- vllm/transformers_utils/configs/arctic.py +207 -0
- vllm/transformers_utils/configs/chatglm.py +72 -0
- vllm/transformers_utils/configs/cohere2.py +195 -0
- vllm/transformers_utils/configs/dbrx.py +280 -0
- vllm/transformers_utils/configs/deepseek_vl2.py +216 -0
- vllm/transformers_utils/configs/eagle.py +85 -0
- vllm/transformers_utils/configs/exaone.py +190 -0
- vllm/transformers_utils/configs/falcon.py +90 -0
- vllm/transformers_utils/configs/h2ovl.py +16 -0
- vllm/transformers_utils/configs/internvl.py +54 -0
- vllm/transformers_utils/configs/jais.py +238 -0
- vllm/transformers_utils/configs/kimi_vl.py +37 -0
- vllm/transformers_utils/configs/medusa.py +63 -0
- vllm/transformers_utils/configs/minimax_text_01.py +70 -0
- vllm/transformers_utils/configs/minimax_vl_01.py +71 -0
- vllm/transformers_utils/configs/mllama.py +31 -0
- vllm/transformers_utils/configs/mlp_speculator.py +68 -0
- vllm/transformers_utils/configs/moonvit.py +33 -0
- vllm/transformers_utils/configs/mpt.py +180 -0
- vllm/transformers_utils/configs/nemotron.py +205 -0
- vllm/transformers_utils/configs/nemotron_h.py +258 -0
- vllm/transformers_utils/configs/nvlm_d.py +15 -0
- vllm/transformers_utils/configs/ovis.py +184 -0
- vllm/transformers_utils/configs/skyworkr1v.py +54 -0
- vllm/transformers_utils/configs/solar.py +247 -0
- vllm/transformers_utils/configs/telechat2.py +64 -0
- vllm/transformers_utils/configs/ultravox.py +108 -0
- vllm/transformers_utils/detokenizer.py +168 -0
- vllm/transformers_utils/detokenizer_utils.py +189 -0
- vllm/transformers_utils/processor.py +221 -0
- vllm/transformers_utils/processors/__init__.py +8 -0
- vllm/transformers_utils/processors/deepseek_vl2.py +363 -0
- vllm/transformers_utils/processors/ovis.py +420 -0
- vllm/transformers_utils/s3_utils.py +162 -0
- vllm/transformers_utils/tokenizer.py +302 -0
- vllm/transformers_utils/tokenizer_base.py +149 -0
- vllm/transformers_utils/tokenizer_group.py +120 -0
- vllm/transformers_utils/tokenizers/__init__.py +10 -0
- vllm/transformers_utils/tokenizers/mistral.py +493 -0
- vllm/transformers_utils/utils.py +99 -0
- vllm/triton_utils/__init__.py +14 -0
- vllm/triton_utils/importing.py +50 -0
- vllm/usage/__init__.py +0 -0
- vllm/usage/usage_lib.py +256 -0
- vllm/utils.py +2910 -0
- vllm/v1/__init__.py +0 -0
- vllm/v1/attention/__init__.py +0 -0
- vllm/v1/attention/backends/__init__.py +0 -0
- vllm/v1/attention/backends/cpu_attn.py +163 -0
- vllm/v1/attention/backends/flash_attn.py +869 -0
- vllm/v1/attention/backends/flashinfer.py +651 -0
- vllm/v1/attention/backends/flex_attention.py +477 -0
- vllm/v1/attention/backends/mla/__init__.py +0 -0
- vllm/v1/attention/backends/mla/common.py +931 -0
- vllm/v1/attention/backends/mla/cutlass_mla.py +97 -0
- vllm/v1/attention/backends/mla/flashmla.py +152 -0
- vllm/v1/attention/backends/mla/rocm_aiter_mla.py +220 -0
- vllm/v1/attention/backends/mla/triton_mla.py +120 -0
- vllm/v1/attention/backends/pallas.py +240 -0
- vllm/v1/attention/backends/triton_attn.py +285 -0
- vllm/v1/attention/backends/utils.py +52 -0
- vllm/v1/core/__init__.py +0 -0
- vllm/v1/core/block_pool.py +349 -0
- vllm/v1/core/encoder_cache_manager.py +150 -0
- vllm/v1/core/kv_cache_coordinator.py +363 -0
- vllm/v1/core/kv_cache_manager.py +392 -0
- vllm/v1/core/kv_cache_utils.py +996 -0
- vllm/v1/core/sched/__init__.py +0 -0
- vllm/v1/core/sched/interface.py +150 -0
- vllm/v1/core/sched/output.py +154 -0
- vllm/v1/core/sched/scheduler.py +1044 -0
- vllm/v1/core/sched/utils.py +23 -0
- vllm/v1/core/single_type_kv_cache_manager.py +403 -0
- vllm/v1/engine/__init__.py +173 -0
- vllm/v1/engine/async_llm.py +558 -0
- vllm/v1/engine/coordinator.py +253 -0
- vllm/v1/engine/core.py +961 -0
- vllm/v1/engine/core_client.py +1129 -0
- vllm/v1/engine/detokenizer.py +261 -0
- vllm/v1/engine/exceptions.py +17 -0
- vllm/v1/engine/llm_engine.py +317 -0
- vllm/v1/engine/logprobs.py +199 -0
- vllm/v1/engine/mm_input_cache.py +91 -0
- vllm/v1/engine/output_processor.py +428 -0
- vllm/v1/engine/parallel_sampling.py +133 -0
- vllm/v1/engine/processor.py +407 -0
- vllm/v1/executor/__init__.py +0 -0
- vllm/v1/executor/abstract.py +113 -0
- vllm/v1/executor/multiproc_executor.py +537 -0
- vllm/v1/executor/ray_distributed_executor.py +62 -0
- vllm/v1/kv_cache_interface.py +194 -0
- vllm/v1/metrics/__init__.py +0 -0
- vllm/v1/metrics/loggers.py +523 -0
- vllm/v1/metrics/prometheus.py +82 -0
- vllm/v1/metrics/ray_wrappers.py +131 -0
- vllm/v1/metrics/reader.py +246 -0
- vllm/v1/metrics/stats.py +239 -0
- vllm/v1/outputs.py +116 -0
- vllm/v1/request.py +193 -0
- vllm/v1/sample/__init__.py +0 -0
- vllm/v1/sample/metadata.py +44 -0
- vllm/v1/sample/ops/__init__.py +0 -0
- vllm/v1/sample/ops/bad_words.py +39 -0
- vllm/v1/sample/ops/penalties.py +59 -0
- vllm/v1/sample/ops/topk_topp_sampler.py +293 -0
- vllm/v1/sample/rejection_sampler.py +631 -0
- vllm/v1/sample/sampler.py +286 -0
- vllm/v1/sample/tpu/__init__.py +0 -0
- vllm/v1/sample/tpu/metadata.py +124 -0
- vllm/v1/sample/tpu/sampler.py +145 -0
- vllm/v1/serial_utils.py +315 -0
- vllm/v1/spec_decode/__init__.py +0 -0
- vllm/v1/spec_decode/eagle.py +432 -0
- vllm/v1/spec_decode/medusa.py +62 -0
- vllm/v1/spec_decode/metadata.py +62 -0
- vllm/v1/spec_decode/metrics.py +178 -0
- vllm/v1/spec_decode/ngram_proposer.py +132 -0
- vllm/v1/spec_decode/utils.py +46 -0
- vllm/v1/structured_output/__init__.py +222 -0
- vllm/v1/structured_output/backend_guidance.py +245 -0
- vllm/v1/structured_output/backend_types.py +134 -0
- vllm/v1/structured_output/backend_xgrammar.py +318 -0
- vllm/v1/structured_output/request.py +86 -0
- vllm/v1/structured_output/utils.py +175 -0
- vllm/v1/utils.py +743 -0
- vllm/v1/worker/__init__.py +0 -0
- vllm/v1/worker/block_table.py +142 -0
- vllm/v1/worker/cpu_model_runner.py +86 -0
- vllm/v1/worker/cpu_worker.py +152 -0
- vllm/v1/worker/gpu_input_batch.py +681 -0
- vllm/v1/worker/gpu_model_runner.py +2320 -0
- vllm/v1/worker/gpu_worker.py +393 -0
- vllm/v1/worker/lora_model_runner_mixin.py +173 -0
- vllm/v1/worker/tpu_model_runner.py +1673 -0
- vllm/v1/worker/tpu_worker.py +299 -0
- vllm/v1/worker/utils.py +111 -0
- vllm/v1/worker/worker_base.py +65 -0
- vllm/version.py +41 -0
- vllm/vllm_flash_attn/.gitkeep +0 -0
- vllm/worker/__init__.py +0 -0
- vllm/worker/cache_engine.py +145 -0
- vllm/worker/cpu_enc_dec_model_runner.py +326 -0
- vllm/worker/cpu_model_runner.py +671 -0
- vllm/worker/cpu_pooling_model_runner.py +125 -0
- vllm/worker/cpu_worker.py +450 -0
- vllm/worker/enc_dec_model_runner.py +555 -0
- vllm/worker/hpu_model_runner.py +2320 -0
- vllm/worker/hpu_worker.py +484 -0
- vllm/worker/model_runner.py +2178 -0
- vllm/worker/model_runner_base.py +282 -0
- vllm/worker/multi_step_hpu_worker.py +123 -0
- vllm/worker/multi_step_model_runner.py +911 -0
- vllm/worker/multi_step_neuron_model_runner.py +84 -0
- vllm/worker/multi_step_neuronx_distributed_model_runner.py +63 -0
- vllm/worker/multi_step_tpu_worker.py +108 -0
- vllm/worker/multi_step_worker.py +197 -0
- vllm/worker/neuron_model_runner.py +460 -0
- vllm/worker/neuron_worker.py +193 -0
- vllm/worker/neuronx_distributed_model_runner.py +294 -0
- vllm/worker/pooling_model_runner.py +211 -0
- vllm/worker/tpu_model_runner.py +909 -0
- vllm/worker/tpu_worker.py +337 -0
- vllm/worker/utils.py +53 -0
- vllm/worker/worker.py +577 -0
- vllm/worker/worker_base.py +646 -0
- vllm/worker/xpu_model_runner.py +606 -0
- vllm/worker/xpu_worker.py +186 -0
- vllm_cpu_amxbf16-0.9.1.dist-info/METADATA +305 -0
- vllm_cpu_amxbf16-0.9.1.dist-info/RECORD +1197 -0
- vllm_cpu_amxbf16-0.9.1.dist-info/WHEEL +5 -0
- vllm_cpu_amxbf16-0.9.1.dist-info/entry_points.txt +5 -0
- vllm_cpu_amxbf16-0.9.1.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,1233 @@
|
|
|
1
|
+
# SPDX-License-Identifier: Apache-2.0
|
|
2
|
+
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
|
|
3
|
+
# Copyright (c) Microsoft Corporation.
|
|
4
|
+
# Licensed under the MIT license.
|
|
5
|
+
# Code copied from Microsoft/MoE by Jacob Platin (jacobplatin@microsoft.com)
|
|
6
|
+
# but implemented by the Phi-Speech team
|
|
7
|
+
#!/usr/bin/env python3
|
|
8
|
+
import abc
|
|
9
|
+
import math
|
|
10
|
+
from typing import Literal, Optional
|
|
11
|
+
|
|
12
|
+
import numpy as np
|
|
13
|
+
import torch
|
|
14
|
+
import torch.nn.functional as F
|
|
15
|
+
from torch import Tensor, nn
|
|
16
|
+
from torch.distributed.algorithms._checkpoint.checkpoint_wrapper import (
|
|
17
|
+
CheckpointWrapper)
|
|
18
|
+
from torch.distributed.fsdp.fully_sharded_data_parallel import (
|
|
19
|
+
FullyShardedDataParallel)
|
|
20
|
+
from transformers import PretrainedConfig
|
|
21
|
+
|
|
22
|
+
from vllm.model_executor.models.phi4mm_utils import (
|
|
23
|
+
AbsolutePositionalEncoding, ConvModule, FeedForward, MeanVarianceNormLayer,
|
|
24
|
+
MultiHeadedAttention, MultiSequential, NemoConvSubsampling,
|
|
25
|
+
T5RelativeAttentionLogitBias, adaptive_enc_mask, get_offset, unfold_tensor)
|
|
26
|
+
|
|
27
|
+
_AUDIO_PLACEHOLDER_TOKEN_ID = 200011 # <|endoftext11|>
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
class ConformerEncoderLayer(nn.Module):
|
|
31
|
+
"""ConformerEncoder Layer module.
|
|
32
|
+
for more details see conformer paper:
|
|
33
|
+
https://arxiv.org/abs/2005.08100
|
|
34
|
+
This module implement the Conformer block layer.
|
|
35
|
+
|
|
36
|
+
Args:
|
|
37
|
+
d_model: int
|
|
38
|
+
attention dim.
|
|
39
|
+
ext_pw_out_channel: int
|
|
40
|
+
if > 0, ext_pw_out_channel is a dim channel size
|
|
41
|
+
for the last pointwise conv after swish activation.
|
|
42
|
+
depthwise_seperable_out_channel: int
|
|
43
|
+
if set different to 0, the number of
|
|
44
|
+
depthwise_seperable_out_channel will be used as a
|
|
45
|
+
channel_out of the second conv1d layer.
|
|
46
|
+
otherwise, it equal to 0, the second conv1d layer is skipped.
|
|
47
|
+
depthwise_multiplier: int
|
|
48
|
+
number of input_dim channels duplication. this value
|
|
49
|
+
will be used to compute the hidden channels of the Conv1D.
|
|
50
|
+
n_head: int
|
|
51
|
+
the number of heads for multihead attention module.
|
|
52
|
+
d_ffn: int
|
|
53
|
+
output size of the feed_forward blocks.
|
|
54
|
+
ext_pw_kernel_size: int
|
|
55
|
+
kernel size of the conv pointwise of the conformer.
|
|
56
|
+
kernel_size: int
|
|
57
|
+
kernel size.
|
|
58
|
+
dropout_rate: float
|
|
59
|
+
dropout rate.
|
|
60
|
+
causal: bool, optional
|
|
61
|
+
if set to True, convolution have no access
|
|
62
|
+
to future frames. default False.
|
|
63
|
+
batch_norm: bool, optional
|
|
64
|
+
if set to True, apply batchnorm before activation
|
|
65
|
+
in ConvModule layer of the conformer.
|
|
66
|
+
default False
|
|
67
|
+
activation: str, optional
|
|
68
|
+
activation function name,
|
|
69
|
+
one of ["relu", "swish", "sigmoid"],
|
|
70
|
+
sigmoid activation is only used with "glu_in_fnn=True",
|
|
71
|
+
default "relu".
|
|
72
|
+
chunk_se: int, optional
|
|
73
|
+
0 for offline SE.
|
|
74
|
+
1 for streaming SE, where mean is computed
|
|
75
|
+
by accumulated history until current chunk_se.
|
|
76
|
+
2 for streaming SE, where mean is computed
|
|
77
|
+
by only the current chunk.
|
|
78
|
+
default 0.
|
|
79
|
+
chunk_size: int, optional
|
|
80
|
+
chunk_size for cnn. default 18
|
|
81
|
+
conv_activation: str, optional
|
|
82
|
+
activation function used in ConvModule part
|
|
83
|
+
of the conformer, default "relu".
|
|
84
|
+
conv_glu_type: str, optional
|
|
85
|
+
activation function used for the glu inside
|
|
86
|
+
the ConvModule part of the conformer.
|
|
87
|
+
default: "sigmoid".
|
|
88
|
+
bias_in_glu: bool, optional
|
|
89
|
+
if set to True, use additive bias in the weight module
|
|
90
|
+
before GLU.
|
|
91
|
+
linear_glu_in_convm: bool, optional
|
|
92
|
+
if set to True, use GLULinear module,
|
|
93
|
+
otherwise, used GLUPointWiseConv module.
|
|
94
|
+
default to False.
|
|
95
|
+
attention_inner_dim: int, optional
|
|
96
|
+
if equal to -1, attention dim for linears k/q/v is
|
|
97
|
+
equal to d_model. otherwise attention_inner_dim is used.
|
|
98
|
+
default -1.
|
|
99
|
+
attention_glu_type: str, optional
|
|
100
|
+
activation function for glu used in the multihead attention,
|
|
101
|
+
default "swish".
|
|
102
|
+
activation_checkpointing: str, optional
|
|
103
|
+
a dictionarry of {"module","interval","offload"}, where
|
|
104
|
+
"module": str
|
|
105
|
+
accept ["transformer", "attention"] to select
|
|
106
|
+
which module should do activation checkpointing.
|
|
107
|
+
"interval": int, default 1,
|
|
108
|
+
interval of applying activation checkpointing,
|
|
109
|
+
interval = 1 means that we apply checkpointing
|
|
110
|
+
on every layer (if activation), otherwise,
|
|
111
|
+
we apply it every x interval.
|
|
112
|
+
"offload": bool, default False,
|
|
113
|
+
if set to True, we offload activation to cpu and
|
|
114
|
+
reload it during backward, otherwise,
|
|
115
|
+
we recalculate activation in backward.
|
|
116
|
+
default "".
|
|
117
|
+
export: bool, optional
|
|
118
|
+
if set to True, it remove the padding from convolutional layers
|
|
119
|
+
and allow the onnx conversion for inference.
|
|
120
|
+
default False.
|
|
121
|
+
use_pt_scaled_dot_product_attention: bool, optional
|
|
122
|
+
if set to True, use pytorch's scaled dot product attention
|
|
123
|
+
implementation in training.
|
|
124
|
+
attn_group_sizes: int, optional
|
|
125
|
+
the number of groups to use for attention, default 1
|
|
126
|
+
(Multi-Head Attention),
|
|
127
|
+
1 = typical Multi-Head Attention,
|
|
128
|
+
1 < attn_group_sizes < attention_heads = Grouped-Query Attention
|
|
129
|
+
attn_group_sizes = attenion_heads = Multi-Query Attention
|
|
130
|
+
"""
|
|
131
|
+
|
|
132
|
+
def __init__(
|
|
133
|
+
self,
|
|
134
|
+
d_model=512,
|
|
135
|
+
ext_pw_out_channel=0,
|
|
136
|
+
depthwise_seperable_out_channel=256,
|
|
137
|
+
depthwise_multiplier=1,
|
|
138
|
+
n_head=4,
|
|
139
|
+
d_ffn=2048,
|
|
140
|
+
ext_pw_kernel_size=1,
|
|
141
|
+
kernel_size=3,
|
|
142
|
+
dropout_rate=0.1,
|
|
143
|
+
causal=False,
|
|
144
|
+
batch_norm=False,
|
|
145
|
+
activation="relu",
|
|
146
|
+
chunk_se=0,
|
|
147
|
+
chunk_size=18,
|
|
148
|
+
conv_activation="relu",
|
|
149
|
+
conv_glu_type="sigmoid",
|
|
150
|
+
bias_in_glu=True,
|
|
151
|
+
linear_glu_in_convm=False,
|
|
152
|
+
attention_inner_dim=-1,
|
|
153
|
+
attention_glu_type="swish",
|
|
154
|
+
activation_checkpointing="",
|
|
155
|
+
export=False,
|
|
156
|
+
use_pt_scaled_dot_product_attention=False,
|
|
157
|
+
attn_group_sizes: int = 1,
|
|
158
|
+
):
|
|
159
|
+
super().__init__()
|
|
160
|
+
|
|
161
|
+
self.feed_forward_in = FeedForward(
|
|
162
|
+
d_model=d_model,
|
|
163
|
+
d_inner=d_ffn,
|
|
164
|
+
dropout_rate=dropout_rate,
|
|
165
|
+
activation=activation,
|
|
166
|
+
bias_in_glu=bias_in_glu,
|
|
167
|
+
)
|
|
168
|
+
|
|
169
|
+
self.self_attn = MultiHeadedAttention(
|
|
170
|
+
n_head,
|
|
171
|
+
d_model,
|
|
172
|
+
dropout_rate,
|
|
173
|
+
attention_inner_dim,
|
|
174
|
+
attention_glu_type,
|
|
175
|
+
bias_in_glu,
|
|
176
|
+
use_pt_scaled_dot_product_attention=
|
|
177
|
+
use_pt_scaled_dot_product_attention,
|
|
178
|
+
group_size=attn_group_sizes,
|
|
179
|
+
)
|
|
180
|
+
self.conv = ConvModule(
|
|
181
|
+
d_model,
|
|
182
|
+
ext_pw_out_channel,
|
|
183
|
+
depthwise_seperable_out_channel,
|
|
184
|
+
ext_pw_kernel_size,
|
|
185
|
+
kernel_size,
|
|
186
|
+
depthwise_multiplier,
|
|
187
|
+
dropout_rate,
|
|
188
|
+
causal,
|
|
189
|
+
batch_norm,
|
|
190
|
+
chunk_se,
|
|
191
|
+
chunk_size,
|
|
192
|
+
conv_activation,
|
|
193
|
+
conv_glu_type,
|
|
194
|
+
bias_in_glu,
|
|
195
|
+
linear_glu_in_convm,
|
|
196
|
+
export=export,
|
|
197
|
+
)
|
|
198
|
+
|
|
199
|
+
self.feed_forward_out = FeedForward(
|
|
200
|
+
d_model=d_model,
|
|
201
|
+
d_inner=d_ffn,
|
|
202
|
+
dropout_rate=dropout_rate,
|
|
203
|
+
activation=activation,
|
|
204
|
+
bias_in_glu=bias_in_glu,
|
|
205
|
+
)
|
|
206
|
+
|
|
207
|
+
self.layer_norm_att = nn.LayerNorm(d_model)
|
|
208
|
+
self.layer_norm = nn.LayerNorm(d_model)
|
|
209
|
+
|
|
210
|
+
def forward(
|
|
211
|
+
self,
|
|
212
|
+
x,
|
|
213
|
+
pos_k,
|
|
214
|
+
pos_v,
|
|
215
|
+
mask,
|
|
216
|
+
relative_attention_bias: Optional[Tensor] = None,
|
|
217
|
+
):
|
|
218
|
+
"""ConformerEncoder forward.
|
|
219
|
+
|
|
220
|
+
Args:
|
|
221
|
+
x: torch.Tensor
|
|
222
|
+
input feature of shape (batch, max_time_in, size)
|
|
223
|
+
pos_k: torch.Tensor
|
|
224
|
+
positional key embedding.
|
|
225
|
+
mask: torch.Tensor
|
|
226
|
+
mask for x (batch, max_time_in)
|
|
227
|
+
relative_attention_bias: Optional[torch.Tensor]
|
|
228
|
+
bias added to attention logits w.r.t. relative positions
|
|
229
|
+
(1, n_head, time1, time2)
|
|
230
|
+
"""
|
|
231
|
+
x = x + 0.5 * self.feed_forward_in(x)
|
|
232
|
+
norm_x = self.layer_norm_att(x)
|
|
233
|
+
|
|
234
|
+
x = x + self.self_attn(
|
|
235
|
+
norm_x,
|
|
236
|
+
norm_x,
|
|
237
|
+
norm_x,
|
|
238
|
+
pos_k,
|
|
239
|
+
pos_v,
|
|
240
|
+
mask,
|
|
241
|
+
relative_attention_bias=relative_attention_bias,
|
|
242
|
+
)
|
|
243
|
+
x = x + self.conv(x)
|
|
244
|
+
x = x + 0.5 * self.feed_forward_out(x)
|
|
245
|
+
|
|
246
|
+
out = self.layer_norm(x)
|
|
247
|
+
|
|
248
|
+
return out, pos_k, pos_v, mask
|
|
249
|
+
|
|
250
|
+
|
|
251
|
+
class TransformerEncoderBase(abc.ABC, nn.Module):
|
|
252
|
+
"""The Base class for Transformer based encoders
|
|
253
|
+
|
|
254
|
+
Please set causal = True in streaming model
|
|
255
|
+
Args:
|
|
256
|
+
input_size: int
|
|
257
|
+
input feature dimension.
|
|
258
|
+
chunk_size: int, list(int)
|
|
259
|
+
Number of frames for each chunk
|
|
260
|
+
This variable can take 2 forms:
|
|
261
|
+
int: Used for inference, or single chunk size training
|
|
262
|
+
list(int) : Used only for variable chunk size training
|
|
263
|
+
Some examples for the 2 cases:
|
|
264
|
+
chunk_size = 12
|
|
265
|
+
chunk_size = [6, 8, 12, 24]
|
|
266
|
+
left_chunk: int, list(int)
|
|
267
|
+
Number of chunks used for masking in streaming mode.
|
|
268
|
+
This variable can take 2 forms:
|
|
269
|
+
int: Used for inference, or single chunk size training
|
|
270
|
+
list(int) : Used only for variable chunk size training. When
|
|
271
|
+
chunk_size is a list, left_chunk must be a list with same length.
|
|
272
|
+
Some examples for the 2 cases:
|
|
273
|
+
left_chunk = 6
|
|
274
|
+
left_chunk = [12, 9, 6, 3]
|
|
275
|
+
attention_dim: int, optional
|
|
276
|
+
attention dimension. default 256.
|
|
277
|
+
attention_heads: int, optional
|
|
278
|
+
the number of heads. default 4
|
|
279
|
+
input_layer: str, optional
|
|
280
|
+
input layer type before Conformer,
|
|
281
|
+
one of ["linear", "conv2d", "custom", "vgg2l", "embed"],
|
|
282
|
+
default "conv2d"
|
|
283
|
+
cnn_out: int, optional
|
|
284
|
+
the number of CNN channels before Conformer.
|
|
285
|
+
default -1.
|
|
286
|
+
cnn_layer_norm: bool, optional
|
|
287
|
+
layer norm between Conformer and the first CNN.
|
|
288
|
+
default False.
|
|
289
|
+
time_reduction: int, optional
|
|
290
|
+
time reduction factor
|
|
291
|
+
default 4
|
|
292
|
+
dropout_rate: float, optional
|
|
293
|
+
dropout rate. default 0.1
|
|
294
|
+
padding_idx: int, optional
|
|
295
|
+
padding index for input_layer=embed
|
|
296
|
+
default -1
|
|
297
|
+
relative_attention_bias_args: dict, optional
|
|
298
|
+
use more efficient scalar bias-based relative multihead attention
|
|
299
|
+
(Q*K^T + B) implemented in cmb.basics.embedding.
|
|
300
|
+
[T5/ALiBi]RelativeAttentionLogitBias
|
|
301
|
+
usage: relative_attention_bias_args={"type": t5/alibi}
|
|
302
|
+
additional method-specific arguments can be provided (see
|
|
303
|
+
transformer_base.py)
|
|
304
|
+
positional_dropout_rate: float, optional
|
|
305
|
+
dropout rate after positional encoding. default 0.0
|
|
306
|
+
nemo_conv_settings: dict, optional
|
|
307
|
+
A dictionary of settings for NeMo Subsampling.
|
|
308
|
+
default None
|
|
309
|
+
conv2d_extra_padding: str, optional
|
|
310
|
+
Add extra padding in conv2d subsampling layers. Choices are
|
|
311
|
+
(feat, feat_time, none, True).
|
|
312
|
+
if True or feat_time, the extra padding is added into non full
|
|
313
|
+
supraframe utts in batch.
|
|
314
|
+
Default: none
|
|
315
|
+
attention_group_size: int, optional
|
|
316
|
+
the number of groups to use for attention, default 1
|
|
317
|
+
(Multi-Head Attention),
|
|
318
|
+
1 = typical Multi-Head Attention,
|
|
319
|
+
1 < attention_group_size < attention_heads = Grouped-Query
|
|
320
|
+
Attention
|
|
321
|
+
attention_group_size = attenion_heads = Multi-Query Attention
|
|
322
|
+
"""
|
|
323
|
+
|
|
324
|
+
def __init__(
|
|
325
|
+
self,
|
|
326
|
+
input_size,
|
|
327
|
+
chunk_size,
|
|
328
|
+
left_chunk,
|
|
329
|
+
attention_dim=256,
|
|
330
|
+
attention_heads=4,
|
|
331
|
+
input_layer="nemo_conv",
|
|
332
|
+
cnn_out=-1,
|
|
333
|
+
cnn_layer_norm=False,
|
|
334
|
+
time_reduction=4,
|
|
335
|
+
dropout_rate=0.0,
|
|
336
|
+
padding_idx=-1,
|
|
337
|
+
relative_attention_bias_args=None,
|
|
338
|
+
positional_dropout_rate=0.0,
|
|
339
|
+
nemo_conv_settings=None,
|
|
340
|
+
conv2d_extra_padding: Literal["feat", "feat_time", "none",
|
|
341
|
+
True] = "none",
|
|
342
|
+
attention_group_size=1,
|
|
343
|
+
encoder_embedding_config=None,
|
|
344
|
+
):
|
|
345
|
+
super().__init__()
|
|
346
|
+
self.input_size = input_size
|
|
347
|
+
self.input_layer = input_layer
|
|
348
|
+
self.chunk_size = chunk_size
|
|
349
|
+
self.left_chunk = left_chunk
|
|
350
|
+
self.attention_dim = attention_dim
|
|
351
|
+
self.num_heads = attention_heads
|
|
352
|
+
self.attention_group_size = attention_group_size
|
|
353
|
+
self.time_reduction = time_reduction
|
|
354
|
+
self.nemo_conv_settings = nemo_conv_settings
|
|
355
|
+
self.encoder_embedding_config = encoder_embedding_config
|
|
356
|
+
|
|
357
|
+
if self.input_layer == "nemo_conv":
|
|
358
|
+
default_nemo_conv_settings = {
|
|
359
|
+
"subsampling": "dw_striding",
|
|
360
|
+
"subsampling_factor": self.time_reduction,
|
|
361
|
+
"feat_in": input_size,
|
|
362
|
+
"feat_out": attention_dim,
|
|
363
|
+
"conv_channels": 256,
|
|
364
|
+
"subsampling_conv_chunking_factor": 1,
|
|
365
|
+
"activation": nn.ReLU(),
|
|
366
|
+
"is_causal": False,
|
|
367
|
+
}
|
|
368
|
+
# Override any of the defaults with the incoming, user settings
|
|
369
|
+
if nemo_conv_settings:
|
|
370
|
+
default_nemo_conv_settings.update(nemo_conv_settings)
|
|
371
|
+
for i in ["subsampling_factor", "feat_in", "feat_out"]:
|
|
372
|
+
assert (
|
|
373
|
+
i not in nemo_conv_settings
|
|
374
|
+
), "{i} should be specified outside of the NeMo dictionary"
|
|
375
|
+
|
|
376
|
+
self.embed = NemoConvSubsampling(**default_nemo_conv_settings, )
|
|
377
|
+
else:
|
|
378
|
+
raise ValueError("unknown input_layer: " + input_layer)
|
|
379
|
+
|
|
380
|
+
self.pos_emb = AbsolutePositionalEncoding(attention_dim,
|
|
381
|
+
positional_dropout_rate)
|
|
382
|
+
|
|
383
|
+
self.relative_attention_bias_type = (
|
|
384
|
+
relative_attention_bias_args.get("type")
|
|
385
|
+
if relative_attention_bias_args else None)
|
|
386
|
+
if self.relative_attention_bias_type == "t5":
|
|
387
|
+
assert (self.num_heads % self.attention_group_size == 0
|
|
388
|
+
), "attention_group_size must divide n_head"
|
|
389
|
+
self.relative_attention_bias_layer = T5RelativeAttentionLogitBias(
|
|
390
|
+
self.num_heads // self.attention_group_size,
|
|
391
|
+
max_distance=relative_attention_bias_args.get(
|
|
392
|
+
"t5_bias_max_distance", 1000),
|
|
393
|
+
symmetric=relative_attention_bias_args.get(
|
|
394
|
+
"t5_bias_symmetric", False),
|
|
395
|
+
)
|
|
396
|
+
else:
|
|
397
|
+
raise NotImplementedError
|
|
398
|
+
|
|
399
|
+
self.encoder_embedding = MeanVarianceNormLayer(
|
|
400
|
+
self.encoder_embedding_config["input_size"])
|
|
401
|
+
|
|
402
|
+
def compute_lens_change(self, feature_lens):
|
|
403
|
+
"""feature_lens: int
|
|
404
|
+
return updated feature lens.
|
|
405
|
+
|
|
406
|
+
This used to return a different lambda function for each case that
|
|
407
|
+
computed the right thing. That does not work within Torchscript.
|
|
408
|
+
If you really need this to be faster, create nn.Module()-s for all
|
|
409
|
+
the cases and return one of them. Torchscript does support that.
|
|
410
|
+
"""
|
|
411
|
+
if self.input_layer == "nemo_conv":
|
|
412
|
+
# Handle the special causal case
|
|
413
|
+
subsampling_causal_cond = self.nemo_conv_settings.get(
|
|
414
|
+
"subsampling", "dw_striding") in [
|
|
415
|
+
"dw_striding",
|
|
416
|
+
"striding",
|
|
417
|
+
"striding_conv1d",
|
|
418
|
+
]
|
|
419
|
+
is_causal = self.nemo_conv_settings.get("is_causal", False)
|
|
420
|
+
if is_causal and subsampling_causal_cond:
|
|
421
|
+
lens_change = (torch.ceil(feature_lens /
|
|
422
|
+
self.time_reduction).long()
|
|
423
|
+
if isinstance(feature_lens, Tensor) else
|
|
424
|
+
math.ceil(feature_lens / self.time_reduction))
|
|
425
|
+
feature_lens_remainder = feature_lens % self.time_reduction
|
|
426
|
+
if isinstance(feature_lens, Tensor):
|
|
427
|
+
lens_change[feature_lens_remainder != 1] += 1
|
|
428
|
+
elif feature_lens_remainder != 1:
|
|
429
|
+
lens_change += 1
|
|
430
|
+
return lens_change
|
|
431
|
+
ceil_func = (math.ceil
|
|
432
|
+
if isinstance(feature_lens, int) else torch.ceil)
|
|
433
|
+
return ceil_func(feature_lens / self.time_reduction)
|
|
434
|
+
|
|
435
|
+
@abc.abstractmethod
|
|
436
|
+
def forward(self):
|
|
437
|
+
"""Abstract forward method implementation."""
|
|
438
|
+
|
|
439
|
+
def _chunk_size_selection(self, chunk_size=None, left_chunk=None):
|
|
440
|
+
"""If chunk size is a list, we will randomly select a chunk size."""
|
|
441
|
+
|
|
442
|
+
if chunk_size is None:
|
|
443
|
+
chunk_size = self.chunk_size
|
|
444
|
+
if left_chunk is None:
|
|
445
|
+
left_chunk = self.left_chunk
|
|
446
|
+
if isinstance(chunk_size, list):
|
|
447
|
+
# Variable chunk size during training
|
|
448
|
+
chunk_size_index = int(
|
|
449
|
+
torch.randint(low=0, high=len(chunk_size), size=(1, )))
|
|
450
|
+
chunk_size_train_eff = chunk_size[chunk_size_index]
|
|
451
|
+
if not isinstance(left_chunk, list):
|
|
452
|
+
raise ValueError(
|
|
453
|
+
"Since chunk_size is a list, left_chunk must be a list")
|
|
454
|
+
if len(left_chunk) != len(chunk_size):
|
|
455
|
+
raise ValueError(
|
|
456
|
+
"The length of left_chunk must be the same as length of "\
|
|
457
|
+
"chunk_size."
|
|
458
|
+
)
|
|
459
|
+
left_chunk_train_eff = left_chunk[chunk_size_index]
|
|
460
|
+
else:
|
|
461
|
+
chunk_size_train_eff = chunk_size
|
|
462
|
+
left_chunk_train_eff = left_chunk
|
|
463
|
+
|
|
464
|
+
return chunk_size_train_eff, left_chunk_train_eff
|
|
465
|
+
|
|
466
|
+
def _get_embed_class(self, embed):
|
|
467
|
+
# pylint: disable=protected-access
|
|
468
|
+
is_embed_using_act_chkpt = isinstance(embed, CheckpointWrapper)
|
|
469
|
+
is_embed_fsdp_wrapped = isinstance(embed, FullyShardedDataParallel)
|
|
470
|
+
embed_class = embed
|
|
471
|
+
if is_embed_using_act_chkpt:
|
|
472
|
+
embed_class = embed._checkpoint_wrapped_module
|
|
473
|
+
if is_embed_fsdp_wrapped:
|
|
474
|
+
embed_class = embed.module
|
|
475
|
+
return embed_class
|
|
476
|
+
|
|
477
|
+
def _forward_embeddings_core(self, input_tensor, masks):
|
|
478
|
+
embed_class = self._get_embed_class(self.embed)
|
|
479
|
+
assert isinstance(embed_class, NemoConvSubsampling)
|
|
480
|
+
input_tensor, masks = self.embed(input_tensor, masks)
|
|
481
|
+
return input_tensor, masks
|
|
482
|
+
|
|
483
|
+
def _position_embedding(self, input_tensor):
|
|
484
|
+
pos_k = None
|
|
485
|
+
pos_v = None
|
|
486
|
+
if self.relative_attention_bias_layer is None:
|
|
487
|
+
input_tensor = self.pos_emb(
|
|
488
|
+
input_tensor) # default to add abs sinusoid embedding
|
|
489
|
+
return pos_k, pos_v
|
|
490
|
+
|
|
491
|
+
def _streaming_mask(self, seq_len, batch_size, chunk_size, left_chunk):
|
|
492
|
+
chunk_size_train_eff, left_chunk_train_eff = \
|
|
493
|
+
self._chunk_size_selection(chunk_size, left_chunk)
|
|
494
|
+
|
|
495
|
+
# Create mask matrix for streaming
|
|
496
|
+
# S stores start index. if chunksize is 18, s is [0,18,36,....]
|
|
497
|
+
chunk_start_idx = np.arange(0, seq_len, chunk_size_train_eff)
|
|
498
|
+
|
|
499
|
+
enc_streaming_mask = (adaptive_enc_mask(
|
|
500
|
+
seq_len, chunk_start_idx,
|
|
501
|
+
left_window=left_chunk_train_eff).unsqueeze(0).expand(
|
|
502
|
+
[batch_size, -1, -1]))
|
|
503
|
+
return enc_streaming_mask
|
|
504
|
+
|
|
505
|
+
def forward_embeddings(self,
|
|
506
|
+
xs_pad,
|
|
507
|
+
masks,
|
|
508
|
+
chunk_size_nc=None,
|
|
509
|
+
left_chunk_nc=None):
|
|
510
|
+
"""Forwarding the inputs through the top embedding layers
|
|
511
|
+
|
|
512
|
+
Args:
|
|
513
|
+
xs_pad: torch.Tensor
|
|
514
|
+
input tensor
|
|
515
|
+
masks: torch.Tensor
|
|
516
|
+
input mask
|
|
517
|
+
chunk_size_nc: (optional, default is None) chunk size for
|
|
518
|
+
non-causal layers
|
|
519
|
+
left_chunk_nc: (optional, default is None) # of left chunks for
|
|
520
|
+
non-causal layers
|
|
521
|
+
"""
|
|
522
|
+
# pylint: disable=R0915
|
|
523
|
+
# get new lens.
|
|
524
|
+
seq_len = int(self.compute_lens_change(xs_pad.shape[1]))
|
|
525
|
+
if seq_len <= 0:
|
|
526
|
+
raise ValueError(
|
|
527
|
+
f"""The sequence length after time reduction is invalid:
|
|
528
|
+
{seq_len}. Your input feature is too short. Consider
|
|
529
|
+
filtering out the very short sentence from data
|
|
530
|
+
loader""", )
|
|
531
|
+
|
|
532
|
+
batch_size = xs_pad.shape[0]
|
|
533
|
+
|
|
534
|
+
enc_streaming_mask = self._streaming_mask(seq_len, batch_size,
|
|
535
|
+
self.chunk_size,
|
|
536
|
+
self.left_chunk)
|
|
537
|
+
|
|
538
|
+
if xs_pad.is_cuda:
|
|
539
|
+
enc_streaming_mask = enc_streaming_mask.cuda()
|
|
540
|
+
xs_pad = xs_pad.cuda()
|
|
541
|
+
|
|
542
|
+
input_tensor = xs_pad
|
|
543
|
+
input_tensor, masks = self._forward_embeddings_core(
|
|
544
|
+
input_tensor, masks)
|
|
545
|
+
|
|
546
|
+
streaming_mask = enc_streaming_mask
|
|
547
|
+
if streaming_mask is not None and masks is not None:
|
|
548
|
+
hs_mask = masks & streaming_mask
|
|
549
|
+
elif masks is not None:
|
|
550
|
+
hs_mask = masks
|
|
551
|
+
else:
|
|
552
|
+
hs_mask = streaming_mask
|
|
553
|
+
|
|
554
|
+
if chunk_size_nc is not None:
|
|
555
|
+
enc_streaming_mask_nc = self._streaming_mask(
|
|
556
|
+
seq_len, batch_size, chunk_size_nc, left_chunk_nc)
|
|
557
|
+
if xs_pad.is_cuda:
|
|
558
|
+
enc_streaming_mask_nc = enc_streaming_mask_nc.cuda()
|
|
559
|
+
if masks is not None:
|
|
560
|
+
hs_mask_nc = masks & enc_streaming_mask_nc
|
|
561
|
+
else:
|
|
562
|
+
hs_mask_nc = enc_streaming_mask_nc
|
|
563
|
+
else:
|
|
564
|
+
hs_mask_nc = None
|
|
565
|
+
|
|
566
|
+
pos_k, pos_v = self._position_embedding(input_tensor)
|
|
567
|
+
|
|
568
|
+
if chunk_size_nc is None:
|
|
569
|
+
return input_tensor, pos_k, pos_v, hs_mask, masks
|
|
570
|
+
return input_tensor, pos_k, pos_v, hs_mask, masks, hs_mask_nc
|
|
571
|
+
|
|
572
|
+
def get_offset(self):
|
|
573
|
+
"""Returns offset used when retaining inputs for decoding.
|
|
574
|
+
|
|
575
|
+
This is essentially, how many additional frames have to be added to
|
|
576
|
+
the front-end CNN input to ensure it can produce a single output.
|
|
577
|
+
So if the "padding" parameter is 0, typically offset will be > 0.
|
|
578
|
+
"""
|
|
579
|
+
return get_offset(self.input_layer, self.time_reduction)
|
|
580
|
+
|
|
581
|
+
|
|
582
|
+
class ConformerEncoder(TransformerEncoderBase):
|
|
583
|
+
"""ConformerEncoder module.
|
|
584
|
+
see original paper for more details:
|
|
585
|
+
https://arxiv.org/abs/2005.08100
|
|
586
|
+
|
|
587
|
+
Please set causal = True in streaming model
|
|
588
|
+
Args:
|
|
589
|
+
input_size: int
|
|
590
|
+
input feature dimension.
|
|
591
|
+
chunk_size: int, list(int)
|
|
592
|
+
Number of frames for each chunk
|
|
593
|
+
This variable can take 2 forms:
|
|
594
|
+
int: Used for inference, or single chunk size training
|
|
595
|
+
list(int) : Used only for variable chunk size training
|
|
596
|
+
Some examples for the 2 cases:
|
|
597
|
+
chunk_size = 12
|
|
598
|
+
chunk_size = [6, 8, 12, 24]
|
|
599
|
+
left_chunk: int, list(int)
|
|
600
|
+
Number of chunks used for masking in streaming mode.
|
|
601
|
+
This variable can take 2 forms:
|
|
602
|
+
int: Used for inference, or single chunk size training
|
|
603
|
+
list(int) : Used only for variable chunk size training. When
|
|
604
|
+
chunk_size is a list, left_chunk must be a list with same length.
|
|
605
|
+
Some examples for the 2 cases:
|
|
606
|
+
left_chunk = 6
|
|
607
|
+
left_chunk = [12, 9, 6, 3]
|
|
608
|
+
left_chunk: int
|
|
609
|
+
number of chunks used for masking in streaming mode.
|
|
610
|
+
num_lang: int
|
|
611
|
+
This parameter is used to store the number of languages in the
|
|
612
|
+
lang_dict, only used for multiseed/multilingual models.
|
|
613
|
+
default None.
|
|
614
|
+
attention_dim: int, optional
|
|
615
|
+
attention dimension. default 256.
|
|
616
|
+
attention_heads: int, optional
|
|
617
|
+
the number of heads. default 4
|
|
618
|
+
linear_units:
|
|
619
|
+
the number of units of position-wise feed forward.
|
|
620
|
+
default 2048
|
|
621
|
+
num_block:
|
|
622
|
+
number of Transformer layer. default 6
|
|
623
|
+
dropout_rate: float, optional
|
|
624
|
+
dropout rate. default 0.1
|
|
625
|
+
input_layer: str, optional
|
|
626
|
+
input layer type before Conformer,
|
|
627
|
+
one of ["linear", "conv2d", "custom", "vgg2l", "embed"],
|
|
628
|
+
default "conv2d"
|
|
629
|
+
causal: bool, optional
|
|
630
|
+
if set to True, convolution have no access
|
|
631
|
+
to future frames. default False.
|
|
632
|
+
batch_norm: bool, optional
|
|
633
|
+
if set to True, apply batchnorm before activation
|
|
634
|
+
in ConvModule layer of the conformer.
|
|
635
|
+
default False
|
|
636
|
+
cnn_out: int, optional
|
|
637
|
+
the number of CNN channels before Conformer.
|
|
638
|
+
default -1.
|
|
639
|
+
cnn_layer_norm: bool, optional
|
|
640
|
+
layer norm between Conformer and the first CNN.
|
|
641
|
+
default False.
|
|
642
|
+
ext_pw_out_channel: int, optional
|
|
643
|
+
the number of channel for CNN
|
|
644
|
+
before depthwise_seperable_CNN.
|
|
645
|
+
If 0 then use linear. default 0.
|
|
646
|
+
ext_pw_kernel_size: int, optional
|
|
647
|
+
kernel size of N before depthwise_seperable_CNN.
|
|
648
|
+
only work for ext_pw_out_channel > 0.
|
|
649
|
+
default 1
|
|
650
|
+
depthwise_seperable_out_channel: int, optional
|
|
651
|
+
the number of channel for
|
|
652
|
+
depthwise_seperable_CNN.
|
|
653
|
+
default 256.
|
|
654
|
+
depthwise_multiplier: int, optional
|
|
655
|
+
the number of multiplier for
|
|
656
|
+
depthwise_seperable_CNN.
|
|
657
|
+
default 1.
|
|
658
|
+
chunk_se: int, optional
|
|
659
|
+
0 for offline SE.
|
|
660
|
+
1 for streaming SE, where mean is computed
|
|
661
|
+
by accumulated history until current chunk_se.
|
|
662
|
+
2 for streaming SE, where mean is computed
|
|
663
|
+
by only the current chunk.
|
|
664
|
+
default 0.
|
|
665
|
+
kernel_size: int, optional
|
|
666
|
+
the number of kernels for depthwise_seperable_CNN.
|
|
667
|
+
default 3.
|
|
668
|
+
activation: str, optional
|
|
669
|
+
FeedForward block activation.
|
|
670
|
+
one of ["relu", "swish", "sigmoid"]
|
|
671
|
+
default "relu".
|
|
672
|
+
conv_activation: str, optional
|
|
673
|
+
activation function used in ConvModule part
|
|
674
|
+
of the conformer, default "relu".
|
|
675
|
+
conv_glu_type: str, optional
|
|
676
|
+
activation used use glu in depthwise_seperable_CNN,
|
|
677
|
+
default "sigmoid"
|
|
678
|
+
bias_in_glu: bool, optional
|
|
679
|
+
if set to True, use additive bias in the weight module
|
|
680
|
+
before GLU. default True
|
|
681
|
+
linear_glu_in_convm: bool, optional
|
|
682
|
+
if set to True, use GLULinear module,
|
|
683
|
+
otherwise, used GLUPointWiseConv module.
|
|
684
|
+
default to False.
|
|
685
|
+
attention_glu_type: str
|
|
686
|
+
only work for glu_in_attention !=0
|
|
687
|
+
default "swish".
|
|
688
|
+
export: bool, optional
|
|
689
|
+
if set to True, it remove the padding from convolutional layers
|
|
690
|
+
and allow the onnx conversion for inference.
|
|
691
|
+
default False.
|
|
692
|
+
activation_checkpointing: str, optional
|
|
693
|
+
a dictionarry of {"module","interval","offload"}, where
|
|
694
|
+
"module": str
|
|
695
|
+
accept ["transformer", "attention"] to select
|
|
696
|
+
which module should do activation checkpointing.
|
|
697
|
+
"interval": int, default 1,
|
|
698
|
+
interval of applying activation checkpointing,
|
|
699
|
+
interval = 1 means that we apply checkpointing
|
|
700
|
+
on every layer (if activation), otherwise,
|
|
701
|
+
we apply it every x interval.
|
|
702
|
+
"offload": bool, default False,
|
|
703
|
+
if set to True, we offload activation to cpu and
|
|
704
|
+
reload it during backward, otherwise,
|
|
705
|
+
we recalculate activation in backward.
|
|
706
|
+
default "".
|
|
707
|
+
extra_layer_output_idx: int
|
|
708
|
+
the layer index to be exposed.
|
|
709
|
+
relative_attention_bias_args: dict, optional
|
|
710
|
+
use more efficient scalar bias-based relative multihead attention
|
|
711
|
+
(Q*K^T + B) implemented in cmb.basics.embedding.
|
|
712
|
+
[T5/ALiBi]RelativeAttentionLogitBias
|
|
713
|
+
usage: relative_attention_bias_args={"type": t5/alibi}
|
|
714
|
+
additional method-specific arguments can be provided (see
|
|
715
|
+
transformer_base.py)
|
|
716
|
+
time_reduction: int optional
|
|
717
|
+
time reduction factor
|
|
718
|
+
default 4
|
|
719
|
+
use_pt_scaled_dot_product_attention: whether to use pytorch scaled
|
|
720
|
+
dot product attention in training.
|
|
721
|
+
Default: False
|
|
722
|
+
nemo_conv_settings: dict, optional
|
|
723
|
+
A dictionary of settings for NeMo Subsampling.
|
|
724
|
+
default: None
|
|
725
|
+
usage: nemo_conv_settings=
|
|
726
|
+
{
|
|
727
|
+
"subsampling":
|
|
728
|
+
dw_striding/striding/dw_striding_conv1d/striding_conv1d,
|
|
729
|
+
"conv_channels": int,
|
|
730
|
+
"subsampling_conv_chunking_factor": int,
|
|
731
|
+
"is_causal": True/False
|
|
732
|
+
}
|
|
733
|
+
conv2d_extra_padding: str, optional
|
|
734
|
+
Add extra padding in conv2d subsampling layers. Choices are
|
|
735
|
+
(feat, feat_time, none, True)
|
|
736
|
+
Default: none
|
|
737
|
+
replication_pad_for_subsample_embedding: For batched-streaming
|
|
738
|
+
decoding, use "replication" padding for the cache at start of
|
|
739
|
+
utterance.
|
|
740
|
+
Default: False
|
|
741
|
+
attention_group_size: int, optional
|
|
742
|
+
the number of groups to use for attention, default 1
|
|
743
|
+
(Multi-Head Attention),
|
|
744
|
+
1 = typical Multi-Head Attention,
|
|
745
|
+
1 < attention_group_size < attention_heads = Grouped-Query
|
|
746
|
+
Attention
|
|
747
|
+
attention_group_size = attenion_heads = Multi-Query Attention
|
|
748
|
+
"""
|
|
749
|
+
|
|
750
|
+
extra_multi_layer_output_idxs: list[int]
|
|
751
|
+
|
|
752
|
+
def __init__( # pylint: disable-all
|
|
753
|
+
self,
|
|
754
|
+
input_size,
|
|
755
|
+
chunk_size,
|
|
756
|
+
left_chunk,
|
|
757
|
+
num_lang=None,
|
|
758
|
+
attention_dim=256,
|
|
759
|
+
attention_heads=4,
|
|
760
|
+
linear_units=2048,
|
|
761
|
+
num_blocks=6,
|
|
762
|
+
dropout_rate=0.1,
|
|
763
|
+
input_layer="nemo_conv",
|
|
764
|
+
causal=True,
|
|
765
|
+
batch_norm=False,
|
|
766
|
+
cnn_out=-1,
|
|
767
|
+
cnn_layer_norm=False,
|
|
768
|
+
ext_pw_out_channel=0,
|
|
769
|
+
ext_pw_kernel_size=1,
|
|
770
|
+
depthwise_seperable_out_channel=256,
|
|
771
|
+
depthwise_multiplier=1,
|
|
772
|
+
chunk_se=0,
|
|
773
|
+
kernel_size=3,
|
|
774
|
+
activation="relu",
|
|
775
|
+
conv_activation="relu",
|
|
776
|
+
conv_glu_type="sigmoid",
|
|
777
|
+
bias_in_glu=True,
|
|
778
|
+
linear_glu_in_convm=False,
|
|
779
|
+
attention_glu_type="swish",
|
|
780
|
+
export=False,
|
|
781
|
+
extra_layer_output_idx=-1,
|
|
782
|
+
extra_multi_layer_output_idxs=[], # noqa
|
|
783
|
+
activation_checkpointing="",
|
|
784
|
+
relative_attention_bias_args=None,
|
|
785
|
+
time_reduction=4,
|
|
786
|
+
use_pt_scaled_dot_product_attention=False,
|
|
787
|
+
nemo_conv_settings=None,
|
|
788
|
+
conv2d_extra_padding: Literal["feat", "feat_time", "none",
|
|
789
|
+
True] = "none",
|
|
790
|
+
replication_pad_for_subsample_embedding=False,
|
|
791
|
+
attention_group_size=1,
|
|
792
|
+
encoder_embedding_config=None,
|
|
793
|
+
):
|
|
794
|
+
super().__init__(
|
|
795
|
+
input_size,
|
|
796
|
+
chunk_size,
|
|
797
|
+
left_chunk,
|
|
798
|
+
attention_dim,
|
|
799
|
+
attention_heads,
|
|
800
|
+
input_layer,
|
|
801
|
+
cnn_out,
|
|
802
|
+
cnn_layer_norm,
|
|
803
|
+
time_reduction,
|
|
804
|
+
dropout_rate=dropout_rate,
|
|
805
|
+
relative_attention_bias_args=relative_attention_bias_args,
|
|
806
|
+
positional_dropout_rate=0.0,
|
|
807
|
+
nemo_conv_settings=nemo_conv_settings,
|
|
808
|
+
conv2d_extra_padding=conv2d_extra_padding,
|
|
809
|
+
attention_group_size=attention_group_size,
|
|
810
|
+
encoder_embedding_config=encoder_embedding_config,
|
|
811
|
+
)
|
|
812
|
+
self.num_blocks = num_blocks
|
|
813
|
+
self.num_lang = num_lang
|
|
814
|
+
self.kernel_size = kernel_size
|
|
815
|
+
self.replication_pad_for_subsample_embedding: bool = (
|
|
816
|
+
replication_pad_for_subsample_embedding)
|
|
817
|
+
assert (self.num_heads % attention_group_size == 0
|
|
818
|
+
), "attention_group_size must divide n_head"
|
|
819
|
+
self.num_heads_k = self.num_heads // attention_group_size
|
|
820
|
+
|
|
821
|
+
self.encoders = MultiSequential(*[
|
|
822
|
+
ConformerEncoderLayer(
|
|
823
|
+
d_model=attention_dim,
|
|
824
|
+
ext_pw_out_channel=ext_pw_out_channel,
|
|
825
|
+
depthwise_seperable_out_channel=depthwise_seperable_out_channel,
|
|
826
|
+
depthwise_multiplier=depthwise_multiplier,
|
|
827
|
+
n_head=attention_heads,
|
|
828
|
+
d_ffn=linear_units,
|
|
829
|
+
ext_pw_kernel_size=ext_pw_kernel_size,
|
|
830
|
+
kernel_size=kernel_size,
|
|
831
|
+
dropout_rate=dropout_rate,
|
|
832
|
+
causal=causal,
|
|
833
|
+
batch_norm=batch_norm,
|
|
834
|
+
activation=activation,
|
|
835
|
+
chunk_se=chunk_se,
|
|
836
|
+
chunk_size=chunk_size,
|
|
837
|
+
conv_activation=conv_activation,
|
|
838
|
+
conv_glu_type=conv_glu_type,
|
|
839
|
+
bias_in_glu=bias_in_glu,
|
|
840
|
+
linear_glu_in_convm=linear_glu_in_convm,
|
|
841
|
+
attention_glu_type=attention_glu_type,
|
|
842
|
+
activation_checkpointing=activation_checkpointing,
|
|
843
|
+
export=export,
|
|
844
|
+
use_pt_scaled_dot_product_attention=
|
|
845
|
+
use_pt_scaled_dot_product_attention,
|
|
846
|
+
attn_group_sizes=attention_group_size,
|
|
847
|
+
) for _ in range(num_blocks)
|
|
848
|
+
])
|
|
849
|
+
self.extra_layer_output_idx = extra_layer_output_idx
|
|
850
|
+
self.extra_multi_layer_output_idxs = extra_multi_layer_output_idxs
|
|
851
|
+
# Make a zeros scalar we can use in get_initial_state to determine
|
|
852
|
+
# the device and the needed dtype:
|
|
853
|
+
self.register_buffer("dev_type", torch.zeros(()), persistent=False)
|
|
854
|
+
|
|
855
|
+
def init_relative_attention_bias(self, input_tensor):
|
|
856
|
+
if self.relative_attention_bias_layer:
|
|
857
|
+
return self.relative_attention_bias_layer(input_tensor)
|
|
858
|
+
|
|
859
|
+
def calculate_hs_mask(self, xs_pad, device, mask):
|
|
860
|
+
max_audio_length = xs_pad.shape[1]
|
|
861
|
+
batch_size = xs_pad.shape[0]
|
|
862
|
+
enc_streaming_mask = self._streaming_mask(max_audio_length, batch_size,
|
|
863
|
+
self.chunk_size,
|
|
864
|
+
self.left_chunk)
|
|
865
|
+
enc_streaming_mask = enc_streaming_mask.to(device)
|
|
866
|
+
if mask is None:
|
|
867
|
+
return enc_streaming_mask
|
|
868
|
+
|
|
869
|
+
feature_lens = mask.sum(1)
|
|
870
|
+
padding_length = feature_lens
|
|
871
|
+
pad_mask = (torch.arange(0, max_audio_length,
|
|
872
|
+
device=device).expand(padding_length.size(0),
|
|
873
|
+
-1)
|
|
874
|
+
< padding_length.unsqueeze(1))
|
|
875
|
+
pad_mask = pad_mask.unsqueeze(1)
|
|
876
|
+
pad_mask = pad_mask & enc_streaming_mask
|
|
877
|
+
return pad_mask
|
|
878
|
+
|
|
879
|
+
@torch.jit.ignore
|
|
880
|
+
def forward(self, xs_pad, masks):
|
|
881
|
+
"""Conformer Forward function
|
|
882
|
+
|
|
883
|
+
Args:
|
|
884
|
+
xs_pad: torch.Tensor
|
|
885
|
+
input tensor
|
|
886
|
+
masks: torch.Tensor
|
|
887
|
+
post-embedding input lengths
|
|
888
|
+
"""
|
|
889
|
+
xs_pad = self.encoder_embedding(xs_pad)
|
|
890
|
+
input_tensor, pos_k, pos_v, hs_mask, masks = self.forward_embeddings(
|
|
891
|
+
xs_pad, masks)
|
|
892
|
+
|
|
893
|
+
unfolded = False
|
|
894
|
+
ori_bz, seq_len, D = input_tensor.shape
|
|
895
|
+
max_seq_len = 500 #maximum position for absolute positional encoding
|
|
896
|
+
if seq_len > max_seq_len:
|
|
897
|
+
# audio sequence is longer than max_seq_len, unfold it into chunks
|
|
898
|
+
# of max_seq_len
|
|
899
|
+
unfolded = True
|
|
900
|
+
# the unfold op will drop residual frames, pad it to the multiple
|
|
901
|
+
# of max_seq_len
|
|
902
|
+
if seq_len % max_seq_len > 0:
|
|
903
|
+
chunk_pad_size = max_seq_len - (seq_len % max_seq_len)
|
|
904
|
+
else:
|
|
905
|
+
chunk_pad_size = 0
|
|
906
|
+
if chunk_pad_size > 0:
|
|
907
|
+
input_tensor_pad = F.pad(input_tensor,
|
|
908
|
+
(0, 0, 0, chunk_pad_size), "constant",
|
|
909
|
+
0)
|
|
910
|
+
input_tensor = input_tensor_pad.to(input_tensor.device)
|
|
911
|
+
input_tensor = unfold_tensor(input_tensor, max_seq_len)
|
|
912
|
+
if masks is not None:
|
|
913
|
+
# revise hs_mask here because the previous calculated hs_mask
|
|
914
|
+
# did not consider extra pad
|
|
915
|
+
subsampled_pad_mask = masks.squeeze(
|
|
916
|
+
1) # [bz, subsampled_unmask_seq_len]
|
|
917
|
+
extra_padded_subsamlped_pad_mask = F.pad(
|
|
918
|
+
subsampled_pad_mask, (0, chunk_pad_size), "constant",
|
|
919
|
+
False) # extra padding to the pad mask
|
|
920
|
+
extra_padded_subsamlped_pad_mask = \
|
|
921
|
+
extra_padded_subsamlped_pad_mask.unsqueeze(-1).float()
|
|
922
|
+
masks_unfold = unfold_tensor(
|
|
923
|
+
extra_padded_subsamlped_pad_mask, max_seq_len
|
|
924
|
+
) # unfold the pad mask like we did to the input tensor
|
|
925
|
+
masks_unfold = masks_unfold.squeeze(
|
|
926
|
+
-1).bool() # unfold op does not support bool tensor
|
|
927
|
+
else:
|
|
928
|
+
masks_unfold = None
|
|
929
|
+
hs_mask = self.calculate_hs_mask(
|
|
930
|
+
input_tensor, input_tensor.device, masks_unfold
|
|
931
|
+
) # calculate hs_mask based on the unfolded pad mask
|
|
932
|
+
|
|
933
|
+
# layer_emb = None
|
|
934
|
+
|
|
935
|
+
relative_attention_bias = self.init_relative_attention_bias(
|
|
936
|
+
input_tensor)
|
|
937
|
+
|
|
938
|
+
_simplified_path = (self.extra_layer_output_idx == -1
|
|
939
|
+
and relative_attention_bias is None)
|
|
940
|
+
|
|
941
|
+
if _simplified_path:
|
|
942
|
+
input_tensor, *_ = self.encoders(input_tensor, pos_k, pos_v,
|
|
943
|
+
hs_mask)
|
|
944
|
+
else:
|
|
945
|
+
for i, layer in enumerate(self.encoders):
|
|
946
|
+
input_tensor, _, _, _ = layer(
|
|
947
|
+
input_tensor,
|
|
948
|
+
pos_k,
|
|
949
|
+
pos_v,
|
|
950
|
+
hs_mask,
|
|
951
|
+
relative_attention_bias=relative_attention_bias,
|
|
952
|
+
)
|
|
953
|
+
|
|
954
|
+
# if i == self.extra_layer_output_idx:
|
|
955
|
+
# layer_emb = input_tensor
|
|
956
|
+
|
|
957
|
+
if unfolded:
|
|
958
|
+
embed_dim = input_tensor.shape[-1]
|
|
959
|
+
input_tensor = input_tensor.reshape(ori_bz, -1, embed_dim)
|
|
960
|
+
# if we ever padded before unfolding, we need to remove the padding
|
|
961
|
+
if chunk_pad_size > 0:
|
|
962
|
+
input_tensor = input_tensor[:, :-chunk_pad_size, :]
|
|
963
|
+
|
|
964
|
+
return input_tensor, masks # , layer_emb
|
|
965
|
+
|
|
966
|
+
|
|
967
|
+
class WindowQformer(nn.Module):
|
|
968
|
+
"""Window-level Qformer"""
|
|
969
|
+
|
|
970
|
+
def __init__(
|
|
971
|
+
self,
|
|
972
|
+
window_size: int = 8,
|
|
973
|
+
num_queries: int = 1,
|
|
974
|
+
num_blocks: int = 2,
|
|
975
|
+
attention_dim: int = 512,
|
|
976
|
+
attention_heads: int = 8,
|
|
977
|
+
linear_units: int = 2048,
|
|
978
|
+
dropout_rate: float = 0.0,
|
|
979
|
+
normalize_before: bool = True,
|
|
980
|
+
):
|
|
981
|
+
super().__init__()
|
|
982
|
+
|
|
983
|
+
self.decoders = nn.ModuleList([
|
|
984
|
+
nn.TransformerDecoderLayer(
|
|
985
|
+
d_model=attention_dim,
|
|
986
|
+
nhead=attention_heads,
|
|
987
|
+
dim_feedforward=linear_units,
|
|
988
|
+
dropout=dropout_rate,
|
|
989
|
+
activation="relu",
|
|
990
|
+
batch_first=True,
|
|
991
|
+
norm_first=normalize_before, # TODO need to verify
|
|
992
|
+
) for _ in range(num_blocks)
|
|
993
|
+
])
|
|
994
|
+
|
|
995
|
+
self.queries = nn.Parameter(torch.zeros(1, num_queries, attention_dim))
|
|
996
|
+
self.after_norm = (nn.LayerNorm(attention_dim, eps=1e-12)
|
|
997
|
+
if normalize_before else None)
|
|
998
|
+
self.window_size = window_size
|
|
999
|
+
|
|
1000
|
+
def forward(self, audio_embed, mask, embed_len=None):
|
|
1001
|
+
"""forward decoder"""
|
|
1002
|
+
# audio_embed: N x T x D => N x D x T
|
|
1003
|
+
|
|
1004
|
+
audio_embed = audio_embed.transpose(1, 2)
|
|
1005
|
+
# audio_embed: N x D x 1 x T => N x DK x T'
|
|
1006
|
+
padding = audio_embed.shape[-1] % self.window_size
|
|
1007
|
+
if padding > 0:
|
|
1008
|
+
audio_embed = F.pad(audio_embed, (0, self.window_size - padding),
|
|
1009
|
+
"constant", 0)
|
|
1010
|
+
|
|
1011
|
+
embed_chunk = F.unfold(
|
|
1012
|
+
audio_embed[..., None, :],
|
|
1013
|
+
kernel_size=(1, self.window_size),
|
|
1014
|
+
stride=(1, self.window_size),
|
|
1015
|
+
)
|
|
1016
|
+
bsz, _, slen = embed_chunk.shape
|
|
1017
|
+
# N x D x K x T'
|
|
1018
|
+
embed_chunk = embed_chunk.view(bsz, -1, self.window_size, slen)
|
|
1019
|
+
# N x T' x K x D
|
|
1020
|
+
embed_chunk = embed_chunk.transpose(1, 3).contiguous()
|
|
1021
|
+
# NT' x K x D
|
|
1022
|
+
embed_chunk = embed_chunk.view(bsz * slen, self.window_size, -1)
|
|
1023
|
+
# NT' x 1 x D
|
|
1024
|
+
q = self.queries.expand(bsz * slen, -1, -1)
|
|
1025
|
+
for layer in self.decoders:
|
|
1026
|
+
q = layer(tgt=q,
|
|
1027
|
+
memory=embed_chunk,
|
|
1028
|
+
tgt_mask=None,
|
|
1029
|
+
memory_mask=mask)
|
|
1030
|
+
|
|
1031
|
+
if self.after_norm is not None:
|
|
1032
|
+
q = self.after_norm(q)
|
|
1033
|
+
|
|
1034
|
+
if embed_len is not None:
|
|
1035
|
+
embed_len = embed_len // self.window_size
|
|
1036
|
+
# N x T' x D
|
|
1037
|
+
out = q.view(bsz, slen, -1)
|
|
1038
|
+
|
|
1039
|
+
return out, embed_len
|
|
1040
|
+
|
|
1041
|
+
|
|
1042
|
+
class AudioEmbedding(nn.Module):
|
|
1043
|
+
"""Image embedding."""
|
|
1044
|
+
|
|
1045
|
+
def __init__(self, config: PretrainedConfig, **kwargs) -> None:
|
|
1046
|
+
super().__init__()
|
|
1047
|
+
self.config = config
|
|
1048
|
+
# n_embed or hidden_size for text LM
|
|
1049
|
+
hidden_size = (config.n_embd
|
|
1050
|
+
if hasattr(config, "n_embd") else config.hidden_size)
|
|
1051
|
+
|
|
1052
|
+
# self.wte = nn.Embedding(config.vocab_size, hidden_size)
|
|
1053
|
+
|
|
1054
|
+
audio_dim_out = (
|
|
1055
|
+
None # Set this variable according to the actual audio processor
|
|
1056
|
+
)
|
|
1057
|
+
self.layer_idx = -2
|
|
1058
|
+
|
|
1059
|
+
if (isinstance(config.audio_processor, dict)
|
|
1060
|
+
and config.audio_processor.get("name", None) == "cascades"):
|
|
1061
|
+
encoder_config = config.audio_processor.get("config", None)
|
|
1062
|
+
assert encoder_config is not None
|
|
1063
|
+
self.encoder = ConformerEncoder(**encoder_config)
|
|
1064
|
+
|
|
1065
|
+
audio_dim_out = encoder_config["attention_dim"]
|
|
1066
|
+
n_mels = encoder_config["input_size"]
|
|
1067
|
+
else:
|
|
1068
|
+
raise NotImplementedError("")
|
|
1069
|
+
|
|
1070
|
+
assert (audio_dim_out
|
|
1071
|
+
is not None), "Remember to set values for audio_dim_out"
|
|
1072
|
+
self.audio_dim_out = audio_dim_out
|
|
1073
|
+
self.audio_dim_in = n_mels
|
|
1074
|
+
|
|
1075
|
+
self.freeze_audio_processor = kwargs.get("freeze_audio_processor",
|
|
1076
|
+
False)
|
|
1077
|
+
|
|
1078
|
+
self.downsample_rate = kwargs.get("downsample_rate", 1)
|
|
1079
|
+
|
|
1080
|
+
if kwargs.get("use_qformer", False):
|
|
1081
|
+
qformer_config = kwargs.get("qformer_config", {})
|
|
1082
|
+
qformer_config["attention_dim"] = audio_dim_out
|
|
1083
|
+
self.qformer = WindowQformer(**qformer_config)
|
|
1084
|
+
else:
|
|
1085
|
+
self.qformer = None
|
|
1086
|
+
|
|
1087
|
+
if kwargs.get("use_conv_downsample", False):
|
|
1088
|
+
assert (self.qformer is None
|
|
1089
|
+
), "don't support use qformer and conv downsample together"
|
|
1090
|
+
nemo_conv_settings = kwargs.get("nemo_conv_settings", {})
|
|
1091
|
+
default_nemo_conv_settings = {
|
|
1092
|
+
"subsampling": "dw_striding",
|
|
1093
|
+
"subsampling_factor": self.downsample_rate,
|
|
1094
|
+
"feat_in": audio_dim_out,
|
|
1095
|
+
"feat_out": audio_dim_out,
|
|
1096
|
+
"conv_channels": 256,
|
|
1097
|
+
"subsampling_conv_chunking_factor": 1,
|
|
1098
|
+
"activation": nn.ReLU(),
|
|
1099
|
+
"is_causal": False,
|
|
1100
|
+
}
|
|
1101
|
+
# Override any of the defaults with the incoming, user settings
|
|
1102
|
+
if nemo_conv_settings:
|
|
1103
|
+
default_nemo_conv_settings.update(nemo_conv_settings)
|
|
1104
|
+
for i in ["subsampling_factor", "feat_in", "feat_out"]:
|
|
1105
|
+
assert (
|
|
1106
|
+
i not in nemo_conv_settings
|
|
1107
|
+
), "{i} should be specified outside of the NeMo dictionary"
|
|
1108
|
+
|
|
1109
|
+
self.conv_ds = NemoConvSubsampling(**default_nemo_conv_settings, )
|
|
1110
|
+
else:
|
|
1111
|
+
self.conv_ds = None
|
|
1112
|
+
|
|
1113
|
+
projection_cls = kwargs.get("projection_cls", "linear")
|
|
1114
|
+
if projection_cls == "linear":
|
|
1115
|
+
self.audio_projection = nn.Linear(audio_dim_out, hidden_size)
|
|
1116
|
+
elif projection_cls == "mlp":
|
|
1117
|
+
# follow llava-v1.5's implementation
|
|
1118
|
+
# (do not use image_projection and image_proj_norm)
|
|
1119
|
+
dim_projection = hidden_size
|
|
1120
|
+
depth = 2
|
|
1121
|
+
self.linear_downsample_rate = (1 if (self.qformer or self.conv_ds)
|
|
1122
|
+
else self.downsample_rate)
|
|
1123
|
+
layers = [
|
|
1124
|
+
nn.Linear(audio_dim_out * self.linear_downsample_rate,
|
|
1125
|
+
dim_projection)
|
|
1126
|
+
]
|
|
1127
|
+
for _ in range(1, depth):
|
|
1128
|
+
layers.extend(
|
|
1129
|
+
[nn.GELU(),
|
|
1130
|
+
nn.Linear(dim_projection, dim_projection)])
|
|
1131
|
+
self.audio_projection = nn.Sequential(*layers)
|
|
1132
|
+
# NOTE vision-speech tasks use a separate projection layer
|
|
1133
|
+
layers = [
|
|
1134
|
+
nn.Linear(audio_dim_out * self.linear_downsample_rate,
|
|
1135
|
+
dim_projection)
|
|
1136
|
+
]
|
|
1137
|
+
for _ in range(1, depth):
|
|
1138
|
+
layers.extend(
|
|
1139
|
+
[nn.GELU(),
|
|
1140
|
+
nn.Linear(dim_projection, dim_projection)])
|
|
1141
|
+
self.audio_projection_for_vision = nn.Sequential(*layers)
|
|
1142
|
+
else:
|
|
1143
|
+
raise NotImplementedError(
|
|
1144
|
+
f"projection_cls = {projection_cls}, not implemented")
|
|
1145
|
+
|
|
1146
|
+
# TODO: audio sequence compression - Qformer
|
|
1147
|
+
self.vocab_size = config.vocab_size
|
|
1148
|
+
self.input_embeds = None
|
|
1149
|
+
self.audio_embed_sizes = None
|
|
1150
|
+
|
|
1151
|
+
def set_audio_embeds(self, input_embeds: torch.FloatTensor) -> None:
|
|
1152
|
+
self.input_embeds = input_embeds
|
|
1153
|
+
|
|
1154
|
+
def set_audio_embed_sizes(self,
|
|
1155
|
+
audio_embed_sizes: torch.LongTensor) -> None:
|
|
1156
|
+
self.audio_embed_sizes = audio_embed_sizes
|
|
1157
|
+
|
|
1158
|
+
def get_audio_features(
|
|
1159
|
+
self,
|
|
1160
|
+
input_embeds: torch.FloatTensor,
|
|
1161
|
+
audio_attention_mask: torch.Tensor = None,
|
|
1162
|
+
audio_projection_mode: str = "speech",
|
|
1163
|
+
) -> torch.FloatTensor:
|
|
1164
|
+
"""
|
|
1165
|
+
arguments:
|
|
1166
|
+
input_embeds: audio features (B, T, D) B: num audios in a sequence
|
|
1167
|
+
"""
|
|
1168
|
+
if self.freeze_audio_processor:
|
|
1169
|
+
with torch.no_grad():
|
|
1170
|
+
audio_features, masks = self.encoder(input_embeds,
|
|
1171
|
+
audio_attention_mask)
|
|
1172
|
+
else:
|
|
1173
|
+
audio_features, masks = self.encoder(input_embeds,
|
|
1174
|
+
audio_attention_mask)
|
|
1175
|
+
|
|
1176
|
+
if self.qformer is not None:
|
|
1177
|
+
audio_features, _ = self.qformer(audio_features, mask=None)
|
|
1178
|
+
|
|
1179
|
+
if self.conv_ds is not None:
|
|
1180
|
+
if masks is not None:
|
|
1181
|
+
masks = masks.squeeze(1)
|
|
1182
|
+
|
|
1183
|
+
audio_features, masks = self.conv_ds(audio_features, mask=masks)
|
|
1184
|
+
|
|
1185
|
+
if self.linear_downsample_rate != 1:
|
|
1186
|
+
bs, seq_len, feat_dim = audio_features.size()
|
|
1187
|
+
padding = seq_len % self.linear_downsample_rate
|
|
1188
|
+
if padding > 0:
|
|
1189
|
+
audio_features = F.pad(
|
|
1190
|
+
audio_features,
|
|
1191
|
+
(0, 0, 0, self.linear_downsample_rate - padding),
|
|
1192
|
+
"constant",
|
|
1193
|
+
0,
|
|
1194
|
+
)
|
|
1195
|
+
|
|
1196
|
+
seq_len = audio_features.size(1)
|
|
1197
|
+
audio_features = audio_features.view(
|
|
1198
|
+
bs,
|
|
1199
|
+
seq_len // self.linear_downsample_rate,
|
|
1200
|
+
feat_dim * self.linear_downsample_rate,
|
|
1201
|
+
)
|
|
1202
|
+
|
|
1203
|
+
if audio_projection_mode == 'speech':
|
|
1204
|
+
audio_set_tensor = self.audio_projection(audio_features)
|
|
1205
|
+
elif audio_projection_mode == 'vision':
|
|
1206
|
+
audio_set_tensor = self.audio_projection_for_vision(audio_features)
|
|
1207
|
+
else:
|
|
1208
|
+
raise ValueError(
|
|
1209
|
+
f"audio_projection_mode = {audio_projection_mode} not "\
|
|
1210
|
+
"implemented"
|
|
1211
|
+
)
|
|
1212
|
+
|
|
1213
|
+
return audio_set_tensor
|
|
1214
|
+
|
|
1215
|
+
def forward(
|
|
1216
|
+
self,
|
|
1217
|
+
audio_features: torch.FloatTensor,
|
|
1218
|
+
audio_attention_mask: torch.Tensor = None,
|
|
1219
|
+
audio_projection_mode: str = "speech",
|
|
1220
|
+
) -> torch.FloatTensor:
|
|
1221
|
+
"""
|
|
1222
|
+
arguments:
|
|
1223
|
+
audio_features: audio features (T, D)
|
|
1224
|
+
|
|
1225
|
+
returns:
|
|
1226
|
+
audio_embeds: audio embeddings (num_audio_tokens, hidden_dim)
|
|
1227
|
+
"""
|
|
1228
|
+
audio_embeds = self.get_audio_features(
|
|
1229
|
+
audio_features.unsqueeze(0),
|
|
1230
|
+
audio_attention_mask=audio_attention_mask,
|
|
1231
|
+
audio_projection_mode=audio_projection_mode,
|
|
1232
|
+
)
|
|
1233
|
+
return audio_embeds.squeeze(0)
|