before_code
stringlengths
14
465k
reviewer_comment
stringlengths
16
64.5k
after_code
stringlengths
9
467k
diff_context
stringlengths
0
97k
file_path
stringlengths
5
226
comment_line
int32
0
26
language
stringclasses
37 values
quality_score
float32
0.07
1
comment_type
stringclasses
9 values
comment_length
int32
16
64.5k
before_lines
int32
1
17.2k
after_lines
int32
1
12.1k
is_negative
bool
2 classes
pr_title
stringlengths
1
308
pr_number
int32
1
299k
repo_name
stringclasses
533 values
repo_stars
int64
321
419k
repo_language
stringclasses
27 values
reviewer_username
stringlengths
0
39
author_username
stringlengths
2
39
self.vllm_config.weight_transfer_config, self.vllm_config.parallel_config, ) if self.vllm_config.weight_transfer_config is not None else None ) # Torch/CUDA profiler. Enabled and configured through profiler_config. self.profile...
```suggestion self._pp_send_work: list[Handle] = [] ```
self.weight_transfer_engine = ( WeightTransferEngineFactory.create_engine( self.vllm_config.weight_transfer_config, self.vllm_config.parallel_config, ) if self.vllm_config.weight_transfer_config is not None else None ) ...
@@ -118,6 +150,8 @@ def __init__( self.profiler = None self.use_v2_model_runner = envs.VLLM_USE_V2_MODEL_RUNNER + # pending non-blocking PP send work from the previous iteration + self._pp_send_work: list[Any] = []
vllm/v1/worker/gpu_worker.py
26
Python
1
suggestion
63
51
51
false
[Feature] Pipeline Parallel Async send/recv, 2.9% E2E throughput improvement
33,368
vllm-project/vllm
71,895
Python
njhill
yewentao256
fake_impl=flashinfer_fused_moe_blockscale_fp8_fake, tags=(torch.Tag.needs_fixed_stride_order,), ) def fi_trtllm_fp8_per_tensor_moe( routing_logits: torch.Tensor, routing_bias: torch.Tensor | None, hidden_states: torch.Tensor, input_scale: torch.Tensor, gemm1_weights: torch.Tensor, gemm...
Let's remove the default value to always be explicit
op_func=flashinfer_fused_moe_blockscale_fp8, fake_impl=flashinfer_fused_moe_blockscale_fp8_fake, tags=(torch.Tag.needs_fixed_stride_order,), ) def fi_trtllm_fp8_per_tensor_moe( routing_logits: torch.Tensor, routing_bias: torch.Tensor | None, hidden_states: torch.Tensor, input_scale: torch....
@@ -291,6 +291,7 @@ def fi_trtllm_fp8_per_tensor_moe( use_routing_scales_on_input: bool, routing_method_type: int, routed_scaling_factor: float = 1.0, + activation_type: int = 3, # Swiglu
vllm/model_executor/layers/fused_moe/flashinfer_trtllm_moe.py
26
Python
0.357
suggestion
52
51
51
false
[Kernel] Support Flashinfer trtllm fused MoE non gated FP8 & NVFP4
33,506
vllm-project/vllm
71,895
Python
mgoin
amitz-nv
logger = init_logger(__name__) class FlashinferMoeBackend(Enum): TENSORRT_LLM = "TensorRT-LLM" CUTLASS = "CUTLASS" CUTEDSL = "CUTEDSL" def is_gated_activation(activation: str) -> bool: return not activation.lower().endswith("_no_mul") def activation_str_to_int(activation: str) -> int: from fl...
Would be nice if we could have this use the MoEActivation refactor, hopefully landing soon https://github.com/vllm-project/vllm/pull/33843
from vllm.utils.math_utils import round_up logger = init_logger(__name__) class FlashinferMoeBackend(Enum): TENSORRT_LLM = "TensorRT-LLM" CUTLASS = "CUTLASS" CUTEDSL = "CUTEDSL" def activation_to_flashinfer_int(activation: MoEActivation) -> int: from flashinfer.fused_moe.core import ActivationType ...
@@ -18,14 +18,32 @@ class FlashinferMoeBackend(Enum): CUTEDSL = "CUTEDSL" +def is_gated_activation(activation: str) -> bool: + return not activation.lower().endswith("_no_mul") + + +def activation_str_to_int(activation: str) -> int: + from flashinfer.fused_moe.core import ActivationType + + # silu and...
vllm/model_executor/layers/quantization/utils/flashinfer_utils.py
26
Python
0.5
refactor
138
51
51
false
[Kernel] Support Flashinfer trtllm fused MoE non gated FP8 & NVFP4
33,506
vllm-project/vllm
71,895
Python
mgoin
amitz-nv
def prepare_fp8_moe_layer_for_fi( layer: torch.nn.Module, w13: torch.Tensor, w2: torch.Tensor, w13_scale: torch.Tensor, w13_input_scale: torch.Tensor | None, w2_scale: torch.Tensor, w2_input_scale: torch.Tensor | None, is_trtllm: bool = False, ) -> tuple[torch.Tensor, torch.Tensor, torch...
Is there some justification for 128 we can reference?
w13_scale: torch.Tensor, w13_input_scale: torch.Tensor | None, w2_scale: torch.Tensor, w2_input_scale: torch.Tensor | None, is_trtllm: bool = False, ) -> tuple[torch.Tensor, torch.Tensor, torch.Tensor]: """ Convert Fp8 MoE weights to flashinfer kernel format Note that for trtllm we upda...
@@ -342,11 +426,14 @@ def prepare_fp8_moe_layer_for_fi( # Some FI MoE kernels require internal alignment of 16 # for the gate-up proj. Pad the weights to respect this. + is_gated = is_gated_activation(layer.activation) if not block_quant: + min_alignment = 16 if is_gated else 128
vllm/model_executor/layers/quantization/utils/flashinfer_utils.py
26
Python
0.143
question
53
51
51
false
[Kernel] Support Flashinfer trtllm fused MoE non gated FP8 & NVFP4
33,506
vllm-project/vllm
71,895
Python
mgoin
amitz-nv
is_gated = is_gated_activation(layer.activation) if ( is_gated and is_act_and_mul and backend in [ NvFp4MoeBackend.FLASHINFER_CUTLASS, NvFp4MoeBackend.FLASHINFER_TRTLLM, ] ): w13, w13_scale = reorder_w1w3_to_w3w1(w13, w13_scale) # ...
If we are in NVFP4, why would we expect weight_block_size in any case?
NvFp4MoeBackend.VLLM_CUTLASS, NvFp4MoeBackend.FLASHINFER_CUTLASS, NvFp4MoeBackend.FLASHINFER_TRTLLM, NvFp4MoeBackend.FLASHINFER_CUTEDSL, ] # Reorder [w1, w3] to [w3, w1] for FI NVFP4 MoE kernels. is_gated = layer.activation.is_gated if ( is_gated and is_a...
@@ -493,19 +507,35 @@ def prepare_nvfp4_moe_layer_for_fi_or_cutlass( # Shuffle weights and scales for FI TRTLLM NVFP4 MoE kernels. if backend == NvFp4MoeBackend.FLASHINFER_TRTLLM: + # Align weights for FI NVFP4 MoE kernels. + block_quant = ( + hasattr(layer, "weight_block_size") and...
vllm/model_executor/layers/quantization/utils/flashinfer_fp4_moe.py
26
Python
0.143
question
70
51
51
false
[Kernel] Support Flashinfer trtllm fused MoE non gated FP8 & NVFP4
33,506
vllm-project/vllm
71,895
Python
mgoin
amitz-nv
a1_scale=a1_scale, a2_scale=a2_scale, ) @property def is_monolithic(self) -> bool: return self.fp8_backend == Fp8MoeBackend.FLASHINFER_TRTLLM def apply_monolithic( self, layer: FusedMoE, x: torch.Tensor, router_logits: torch.Tensor, ...
Note: we need to update the compressed tensors side too, can do in followup PR
a1_scale=a1_scale, a2_scale=a2_scale, ) @property def is_monolithic(self) -> bool: return self.fp8_backend == Fp8MoeBackend.FLASHINFER_TRTLLM def apply_monolithic( self, layer: FusedMoE, x: torch.Tensor, router_logits: torch.Tensor, ...
@@ -937,10 +937,11 @@ def apply_monolithic( ) # TODO(rob): this validation should happen at kernel selection # time in the oracle rather than here. - assert layer.activation == MoEActivation.SILU, ( - f"Expected 'silu' activation but got {layer.activation}" + SUPP...
vllm/model_executor/layers/quantization/modelopt.py
26
Python
0.143
suggestion
78
51
51
false
[Kernel] Support Flashinfer trtllm fused MoE non gated FP8 & NVFP4
33,506
vllm-project/vllm
71,895
Python
mgoin
amitz-nv
request_id: str, mcp_tools: dict[str, Mcp], ) -> None: pass async def cleanup_session(self) -> None: raise NotImplementedError("Should not be called.") class ParsableContext(ConversationContext): def __init__( self, *, response_messages: list[Respon...
@anencore94 I think you can remove this since you've implemented it?
request_id: str, mcp_tools: dict[str, Mcp], ) -> None: pass async def cleanup_session(self) -> None: raise NotImplementedError("Should not be called.") class ParsableContext(ConversationContext): def __init__( self, *, response_messages: list[Respon...
vllm/entrypoints/openai/responses/context.py
26
Python
0.357
refactor
68
51
51
false
[Frontend] Fix reasoning_tokens for text-based parsers in Responses API
33,513
vllm-project/vllm
71,895
Python
qandrew
anencore94
from vllm.config.cache import BlockSize if block_size is None: return True valid_sizes = get_args(BlockSize) if block_size not in valid_sizes: return False supported_kernel_block_sizes = cls.get_supported_kernel_block_sizes() if not supported_ke...
Do we need to handle the case where `default_block_size` is among `valid_block_sizes` but is not the minimal one?
if block_size is None: return True supported_kernel_block_sizes = cls.get_supported_kernel_block_sizes() if not supported_kernel_block_sizes: return True for supported_size in supported_kernel_block_sizes: if isinstance(supported_size, MultipleOf): ...
@@ -167,6 +167,49 @@ def supports_block_size(cls, block_size: int | None) -> bool: return True return False + @classmethod + def get_preferred_block_size(cls, default_block_size: int = 16) -> int: + """Get the preferred block size for this backend.
vllm/v1/attention/backend.py
26
Python
0.786
question
113
51
51
false
[Attention] Refactor `check_and_update_config`
33,600
vllm-project/vllm
71,895
Python
ElizaWszola
MatthewBonanni
the backend is selected unconstrained and block_size is set to the backend's preferred value. """ from vllm.config.vllm import set_current_vllm_config from vllm.v1.attention.selector import AttentionSelectorConfig model_config = vllm_config.model_config cache_con...
really small nit: It slightly confusing to differentiate between `chosen_backend` and `selected_backend` when `selected_backend` is the input. Could we call the user specified backend as `user_specified_backend`?
If the user specified --block-size, the selector validates/filters backends by that block size (raising on incompatibility). Otherwise, the backend is selected unconstrained and block_size is set to the backend's preferred value. """ from vllm.config.vllm import set_curre...
@@ -293,6 +196,144 @@ def check_and_update_config(cls, vllm_config: "VllmConfig") -> None: ) scheduler_config.disable_chunked_mm_input = True + @classmethod + def _update_block_size_for_backend( + cls, + vllm_config: "VllmConfig", + user_specified_block_size: bool,...
vllm/platforms/cuda.py
26
Python
0.786
question
212
51
51
false
[Attention] Refactor `check_and_update_config`
33,600
vllm-project/vllm
71,895
Python
pavanimajety
MatthewBonanni
logger.info( "Setting kv cache block size to %d for %s backend.", preferred, chosen_backend.name, ) cache_config.block_size = preferred # type: ignore[assignment] return # No valid backend f...
```suggestion f"the specified --attention-backend {selected_backend.name}" ```
preferred = backend_class.get_preferred_block_size( cache_config.block_size, ) if cache_config.block_size != preferred: logger.info( "Setting kv cache block size to %d for %s backend.", ...
@@ -293,6 +196,144 @@ def check_and_update_config(cls, vllm_config: "VllmConfig") -> None: ) scheduler_config.disable_chunked_mm_input = True + @classmethod + def _update_block_size_for_backend( + cls, + vllm_config: "VllmConfig", + user_specified_block_size: bool,...
vllm/platforms/cuda.py
26
Python
0.857
suggestion
94
51
51
false
[Attention] Refactor `check_and_update_config`
33,600
vllm-project/vllm
71,895
Python
pavanimajety
MatthewBonanni
text=choice.message.content, ) ) for tool_call in choice.message.tool_calls: anthropic_tool_call = AnthropicContentBlock( type="tool_use", id=tool_call.id, name=tool_call.function.name, i...
Maybe better to manage state using a separate class
text=choice.message.content, ) ) for tool_call in choice.message.tool_calls: anthropic_tool_call = AnthropicContentBlock( type="tool_use", id=tool_call.id, name=tool_call.function.name, i...
@@ -300,7 +316,75 @@ async def message_stream_converter( first_item = True finish_reason = None content_block_index = 0 - content_block_started = False + active_block_type: str | None = None
vllm/entrypoints/anthropic/serving.py
26
Python
0.357
suggestion
51
51
51
false
[Feature]Supports Anthropic Thinking Block
33,671
vllm-project/vllm
71,895
Python
DarkLight1337
mariohong128
num_new_local_computed_tokens: int = 0, num_external_computed_tokens: int = 0, ) -> int: assert num_external_computed_tokens == 0, ( "External KV connector is not verified yet" ) num_computed_tokens = ( request.num_computed_tokens + num_new...
Why do we need these code? I think the previous code can make sure we can cache the last prompt tokens.
+ num_external_computed_tokens ) # Perform block-aligned splitting at prefill phase, including: # * non-resumed requests: num_computed_tokens < num_prompt_tokens + 0 # * resumed requests: num_computed_tokens < ( # num_prompt_tokens + num_output_t...
@@ -275,31 +284,44 @@ def _mamba_block_aligned_split( assert num_external_computed_tokens == 0, ( "External KV connector is not verified yet" ) - # TODO: need check for resume requests - if request.num_output_tokens == 0: # prefill + num_computed_tokens = ( + ...
vllm/v1/core/sched/scheduler.py
26
Python
0.286
performance
103
51
51
false
[Hybrid] Fix and optimize block-aligned splitting in mamba cache align mode
33,706
vllm-project/vllm
71,895
Python
heheda12345
peakcrosser7
"""Use expert parallelism instead of tensor parallelism for MoE layers.""" enable_eplb: bool = False """Enable expert parallelism load balancing for MoE layers.""" eplb_config: EPLBConfig = Field(default_factory=EPLBConfig) """Expert parallelism configuration.""" expert_placement_strategy: Exper...
What do you think about adding this to Kernel config instead of ParallelConfig?
will have experts [1, 3]. This strategy can help improve load balancing for grouped expert models with no redundant experts.""" all2all_backend: All2AllBackend = "allgather_reducescatter" """All2All backend for MoE expert parallel communication. Available options: - "naive": Naive all2all imple...
@@ -158,6 +170,19 @@ class ParallelConfig: - "mori": Use mori kernels\n - "flashinfer_all2allv": Use flashinfer alltoallv kernels for mnnvl""" + moe_backend: MoEBackend = "auto"
vllm/config/parallel.py
26
Python
0.357
question
80
51
51
false
[UX] Add `--moe-backend` arg for explicit kernel selection
33,807
vllm-project/vllm
71,895
Python
ProExpertProg
mgoin
return FusedMoEQuantConfig( _a1=FusedMoEQuantDesc(), _a2=FusedMoEQuantDesc(), _w1=FusedMoEQuantDesc(bias=w1_bias), _w2=FusedMoEQuantDesc(bias=w2_bias), ) # A FusedMoEQuantConfig constant for an unquantized MoE op. FUSED_MOE_UNQUANTIZED_CONFIG: FusedMoEQuantConfig = FusedMoEQuan...
I dont think this should be in the `FusedMoEParallelConfig`
return FusedMoEQuantConfig( _a1=FusedMoEQuantDesc(), _a2=FusedMoEQuantDesc(), _w1=FusedMoEQuantDesc(bias=w1_bias), _w2=FusedMoEQuantDesc(bias=w2_bias), ) # A FusedMoEQuantConfig constant for an unquantized MoE op. FUSED_MOE_UNQUANTIZED_CONFIG: FusedMoEQuantConfig = FusedMoEQuan...
@@ -924,6 +924,7 @@ class FusedMoEParallelConfig: sp_size: int use_ep: bool # whether to use EP or not + moe_backend: str # backend for MoE expert computation kernels
vllm/model_executor/layers/fused_moe/config.py
26
Python
0.571
suggestion
59
51
51
false
[UX] Add `--moe-backend` arg for explicit kernel selection
33,807
vllm-project/vllm
71,895
Python
robertgshaw2-redhat
mgoin
"""Use expert parallelism instead of tensor parallelism for MoE layers.""" enable_eplb: bool = False """Enable expert parallelism load balancing for MoE layers.""" eplb_config: EPLBConfig = Field(default_factory=EPLBConfig) """Expert parallelism configuration.""" expert_placement_strategy: Exper...
I feel like adding this in `ParallelConfig` make this PR easy but introduces technical debt since it does not really make sense for kernel selection to be in `ParallelConfig`
will have experts [1, 3]. This strategy can help improve load balancing for grouped expert models with no redundant experts.""" all2all_backend: All2AllBackend = "allgather_reducescatter" """All2All backend for MoE expert parallel communication. Available options: - "naive": Naive all2all imple...
@@ -158,6 +170,19 @@ class ParallelConfig: - "mori": Use mori kernels\n - "flashinfer_all2allv": Use flashinfer alltoallv kernels for mnnvl""" + moe_backend: MoEBackend = "auto"
vllm/config/parallel.py
26
Python
0.5
suggestion
174
51
51
false
[UX] Add `--moe-backend` arg for explicit kernel selection
33,807
vllm-project/vllm
71,895
Python
robertgshaw2-redhat
mgoin
layer_names=[self.attn.layer_name], vllm_config=self.vllm_config, device=self.device, ) def build_attn_metadata(self, batch_size: int) -> AttentionMetadata: """Initialize attention metadata.""" # Create common attn metadata batch_spec = BatchSpec...
Can you make an issue to properly fix this in the base class?
layer_names=[self.attn.layer_name], vllm_config=self.vllm_config, device=self.device, ) def build_attn_metadata(self, batch_size: int) -> AttentionMetadata: """Initialize attention metadata.""" # TODO (Rohan138) reuse utils from vllm/v1/worker/gpu/attn_u...
@@ -102,58 +102,20 @@ def build_attn_metadata(self, batch_size: int) -> AttentionMetadata: max_blocks = (max(batch_spec.seq_lens) + self.block_size - 1) // self.block_size num_blocks = batch_size * max_blocks - backend = self.attn.backend - - # TODO(luka) use get_kv_cache_stride_order ...
tests/compile/passes/test_fusion_attn.py
26
Python
0.143
question
62
51
51
false
[Bugfix]: Fix ROCm fusion attn test; use AttentionBackend utils to create kv cache
33,948
vllm-project/vllm
71,895
Python
ProExpertProg
Rohan138
assert len(multimodal_embeddings) > 0, ( "For realtime you must provide a multimodal_embedding at every step." ) mm_embeds_flat = _flatten_embeddings(multimodal_embeddings) return mm_embeds_flat def forward( self, input_ids: torch.Tensor | None, p...
can you add a branch on is_torch_equal_or_newer("2.11") ? so we automatically switch back when 2.11 comes along
client disconnect), return zero embeddings instead of crashing the engine so that all other in-flight requests stay alive. """ if multimodal_embeddings is None or len(multimodal_embeddings) == 0: logger.warning( "Realtime model received empty multimodal embedd...
@@ -323,9 +323,16 @@ def forward( assert input_ids is not None pool_size = self.config.audio_config.block_pool_size - inputs_embeds = inputs_embeds.view( + # TODO Use reshape + clone to break the view chain and avoid output + # aliasing input bug in torch.compile's AOT autograd ...
vllm/model_executor/models/voxtral_realtime.py
26
Python
0.286
suggestion
111
51
51
false
Make voxtral compile friendly
33,959
vllm-project/vllm
71,895
Python
zou3519
tugsbayasgalan
self.prepare_dummy_attn_metadata(input_batch) # FIXME(woosuk): Fix warmup for LoRA. # Run model. if use_cudagraph: # Run CUDA graph. # NOTE(woosuk): Here, we don't need to pass the input tensors, # because they are already copied to the CU...
Can we keep the model inputs explicit? I’m not a fan of encapsulating them into a separate object. For example, when supporting CUDA graphs, it’s critical to reason about all inputs and ensure they use consistent memory addresses. This abstraction makes that harder to see.
# NOTE(woosuk): Here, we don't need to pass the input tensors, # because they are already copied to the CUDA graph input buffers. self.kv_connector.pre_forward(scheduler_output) hidden_states = self.cudagraph_manager.run( input_batch.num_tokens_after_paddi...
@@ -889,6 +935,15 @@ def execute_model( if self.uses_mrope: assert input_batch.mrope_positions is not None positions = input_batch.mrope_positions + + # PP input preparation: handler centralizes all PP input logic. + model_inputs = self.pp_handler.pre...
vllm/v1/worker/gpu/model_runner.py
26
Python
0.857
refactor
273
51
51
false
[Core] Pipeline Parallel support for Model Runner V2
33,960
vllm-project/vllm
71,895
Python
WoosukKwon
ZhanqiuHu
# PP input preparation: handler centralizes all PP input logic. model_inputs = self.pp_handler.prepare_model_inputs( input_batch.input_ids, positions, input_batch.inputs_embeds, intermediate_tensors, ) with...
Can we just check the PP rank directly?
cudagraph_runtime_mode=CUDAGraphMode.NONE, num_tokens_across_dp=num_tokens_across_dp, slot_mapping=input_batch.slot_mappings, ): self.kv_connector.pre_forward(scheduler_output) if self.use_pp and not get_pp_group().is_first_rank...
@@ -899,27 +954,52 @@ def execute_model( slot_mapping=input_batch.slot_mappings, ): self.kv_connector.pre_forward(scheduler_output) - hidden_states = self.model( - input_ids=input_batch.input_ids, - positions=positions, ...
vllm/v1/worker/gpu/model_runner.py
26
Python
0.071
question
39
51
51
false
[Core] Pipeline Parallel support for Model Runner V2
33,960
vllm-project/vllm
71,895
Python
WoosukKwon
ZhanqiuHu
assert input_batch.mrope_positions is not None positions = input_batch.mrope_positions # PP input preparation: handler centralizes all PP input logic. model_inputs = self.pp_handler.prepare_model_inputs( input_batch.input_ids, posi...
Same. It'd be nicer to make `output` here more explicit.
num_tokens=input_batch.num_tokens_after_padding, # TODO(woosuk): Support piecewise CUDA graph. cudagraph_runtime_mode=CUDAGraphMode.NONE, num_tokens_across_dp=num_tokens_across_dp, slot_mapping=input_batch.slot_mappings, ): ...
@@ -899,27 +954,52 @@ def execute_model( slot_mapping=input_batch.slot_mappings, ): self.kv_connector.pre_forward(scheduler_output) - hidden_states = self.model( - input_ids=input_batch.input_ids, - positions=positions, ...
vllm/v1/worker/gpu/model_runner.py
26
Python
0.357
suggestion
56
51
51
false
[Core] Pipeline Parallel support for Model Runner V2
33,960
vllm-project/vllm
71,895
Python
WoosukKwon
ZhanqiuHu
) input_batch.attn_metadata = attn_metadata input_batch.slot_mappings = slot_mappings_by_layer @torch.inference_mode() def _dummy_run( self, num_tokens: int, *args, skip_attn: bool = True, **kwargs ) -> tuple[torch.Tensor | None, torch.Tensor | None]: # Create a dumm...
Can we just use `is_first_rank` directly?
kv_cache_config=self.kv_cache_config, ) input_batch.attn_metadata = attn_metadata input_batch.slot_mappings = slot_mappings_by_layer @torch.inference_mode() def _dummy_run( self, num_tokens: int, *args, skip_attn: bool = True, **kwargs ) -> tuple[torch.Tensor | N...
@@ -303,13 +312,31 @@ def _dummy_run( # Disable any use of KVConnector for dummy runs. self.kv_connector.set_disabled(True) + # For non-first PP ranks, create dummy intermediate_tensors. + intermediate_tensors = None + if not self.pp_handler.receives_raw_inputs:
vllm/v1/worker/gpu/model_runner.py
26
Python
0.5
question
41
51
51
false
[Core] Pipeline Parallel support for Model Runner V2
33,960
vllm-project/vllm
71,895
Python
WoosukKwon
ZhanqiuHu
num_speculative_tokens=self.num_speculative_steps + 1, ) self.prompt_logprobs_worker = PromptLogprobsWorker(self.max_num_reqs) # CUDA graphs. self.cudagraph_manager = CudaGraphManager( self.vllm_config, self.uses_mrope, self.device ) # Structured ...
For better readability, can we not initialize `pp_handler` at all when PP is not used? As PP is not a super popular feature, I think we should prioritize users/developers who do not want to be bothered by it.
self.prompt_logprobs_worker = PromptLogprobsWorker(self.max_num_reqs) # CUDA graphs. self.cudagraph_manager = CudaGraphManager( self.vllm_config, self.uses_mrope, self.device ) # Structured outputs worker. self.structured_outputs_worker = StructuredOutputsWor...
@@ -175,6 +181,10 @@ def __init__( # KV Connector if configured. self.kv_connector: KVConnector = NO_OP_KV_CONNECTOR + # PP Handler for pipeline parallelism. + # Initialize here since distributed groups are set up before model runner. + self.pp_handler: PPHandler = get_pp_handle...
vllm/v1/worker/gpu/model_runner.py
26
Python
1
suggestion
208
51
51
false
[Core] Pipeline Parallel support for Model Runner V2
33,960
vllm-project/vllm
71,895
Python
WoosukKwon
ZhanqiuHu
from vllm.v1.worker.gpu.dp_utils import ( get_cudagraph_and_dp_padding, make_num_tokens_across_dp, ) from vllm.v1.worker.gpu.input_batch import ( InputBatch, InputBuffers, combine_sampled_and_draft_tokens, expand_idx_mapping, get_num_sampled_and_rejected, post_update, prepare_pos_seq...
```suggestion from vllm.v1.worker.gpu.pp_handler import PPHandler,mget_pp_handler ```
from vllm.v1.worker.gpu.cudagraph_utils import CudaGraphManager from vllm.v1.worker.gpu.dp_utils import ( get_cudagraph_and_dp_padding, make_num_tokens_across_dp, ) from vllm.v1.worker.gpu.input_batch import ( InputBatch, InputBuffers, combine_sampled_and_draft_tokens, expand_idx_mapping, ge...
@@ -54,6 +56,10 @@ from vllm.v1.worker.gpu.lora_utils import LoraState from vllm.v1.worker.gpu.mm.encoder_runner import EncoderRunner from vllm.v1.worker.gpu.mm.mrope_utils import MRopeState +from vllm.v1.worker.gpu.pp_handler import ( + PPHandler, + get_pp_handler, +)
vllm/v1/worker/gpu/model_runner.py
26
Python
1
suggestion
85
51
51
false
[Core] Pipeline Parallel support for Model Runner V2
33,960
vllm-project/vllm
71,895
Python
WoosukKwon
ZhanqiuHu
assert self.execute_model_state is not None hidden_states, input_batch, kv_connector_output = self.execute_model_state self.execute_model_state = None # type: ignore # Non-last PP rank: receive tokens and update state. # Don't need to sample tokens here - just receive from last...
I think it'd be nice if we can do something like ```suggestion if self.use_pp: # Broadcast to non-last ranks (handles spec decode multi-token) self.pp_handler.maybe_broadcast_sampled_tokens( sampler_output, num_sampled, num_rejected ) ```
) -> AsyncOutput | ModelRunnerOutput | None: assert self.execute_model_state is not None hidden_states, input_batch, kv_connector_output = self.execute_model_state self.execute_model_state = None # type: ignore # Non-last PP rank: hidden_states is None because this rank produced ...
@@ -899,27 +954,52 @@ def execute_model( slot_mapping=input_batch.slot_mappings, ): self.kv_connector.pre_forward(scheduler_output) - hidden_states = self.model( - input_ids=input_batch.input_ids, - positions=positions, ...
vllm/v1/worker/gpu/model_runner.py
26
Python
1
suggestion
298
51
51
false
[Core] Pipeline Parallel support for Model Runner V2
33,960
vllm-project/vllm
71,895
Python
WoosukKwon
ZhanqiuHu
# Disable any use of KVConnector for dummy runs. self.kv_connector.set_disabled(True) # For non-first PP ranks, create dummy intermediate_tensors. intermediate_tensors = None if not self.pp_handler.receives_raw_inputs: intermediate_tensors = self.model.make_empty_in...
Let's use `is_last_rank` directly
dummy_scheduler_output.num_scheduled_tokens = num_scheduled_tokens # Disable any use of KVConnector for dummy runs. self.kv_connector.set_disabled(True) # For non-first PP ranks, create dummy intermediate_tensors. intermediate_tensors = None if self.use_pp and not get_p...
@@ -303,13 +312,31 @@ def _dummy_run( # Disable any use of KVConnector for dummy runs. self.kv_connector.set_disabled(True) + # For non-first PP ranks, create dummy intermediate_tensors. + intermediate_tensors = None + if not self.pp_handler.receives_raw_inputs: + int...
vllm/v1/worker/gpu/model_runner.py
26
Python
0.5
suggestion
33
51
51
false
[Core] Pipeline Parallel support for Model Runner V2
33,960
vllm-project/vllm
71,895
Python
WoosukKwon
ZhanqiuHu
for req_new_block_ids, req_id in zip(reqs.new_block_ids, reqs.req_ids): if req_new_block_ids is not None: req_index = self.req_states.req_id_to_index[req_id] self.block_tables.append_block_ids( req_index, req_new_block_ids, overwrite=False ...
I don't think this should be needed. The `num_tokens_per_req` dict received by each rank should be identical, and `sorted` is stable. I found that this sort is actually quite a bit faster without the lambda.
for req_new_block_ids, req_id in zip(reqs.new_block_ids, reqs.req_ids): if req_new_block_ids is not None: req_index = self.req_states.req_id_to_index[req_id] self.block_tables.append_block_ids( req_index, req_new_block_ids, overwrite=False ...
@@ -506,7 +545,15 @@ def prepare_inputs( # Decode first, then prefill. # batch_idx -> req_id - req_ids = sorted(num_tokens_per_req, key=num_tokens_per_req.get) # type: ignore[arg-type] + # NOTE: In PP mode, every rank must construct the *exact* same request + # ordering for the...
vllm/v1/worker/gpu/model_runner.py
26
Python
0.786
suggestion
208
51
51
false
[Core] Pipeline Parallel support for Model Runner V2
33,960
vllm-project/vllm
71,895
Python
njhill
ZhanqiuHu
) # Prepare the model runner output. model_runner_output = ModelRunnerOutput( req_ids=input_batch.req_ids, # NOTE(woosuk): req_id_to_index is unused in this model runner. # Only for compatibility with the existing model runner and scheduler. req_i...
suggested: ```suggestion if get_pp_group().is_first_rank: input_ids = input_batch.input_ids inputs_embeds = input_batch.inputs_embeds else: # Non-first PP rank: forward with intermediate tensors. input_ids, i...
with set_forward_context( input_batch.attn_metadata, self.vllm_config, num_tokens=input_batch.num_tokens_after_padding, # TODO(woosuk): Support piecewise CUDA graph. cudagraph_runtime_mode=CUDAGraphMode.NONE, nu...
@@ -899,27 +940,71 @@ def execute_model( slot_mapping=input_batch.slot_mappings, ): self.kv_connector.pre_forward(scheduler_output) - hidden_states = self.model( - input_ids=input_batch.input_ids, - positions=positions, ...
vllm/v1/worker/gpu/model_runner.py
26
Python
1
performance
666
46
51
false
[Core] Pipeline Parallel support for Model Runner V2
33,960
vllm-project/vllm
71,895
Python
njhill
ZhanqiuHu
# Flag to enable v2 model runner. "VLLM_USE_V2_MODEL_RUNNER": lambda: bool( int(os.getenv("VLLM_USE_V2_MODEL_RUNNER", "0")) ), # Log model inspection after loading. # If enabled, logs a transformers-style hierarchical view of the model # with quantization methods and attention backends. ...
`VLLM_ENABLE_CUDA_COMPATIBILITY` env parser is split across lines using method chaining (`.strip().lower()`) without parentheses, which is invalid Python syntax and will prevent the module from importing. Wrap the chained call in parentheses (or keep it on one line) so line continuation is valid. ```suggestion "VLL...
# If set to 1, enable max_autotune; By default, this is enabled (1) "VLLM_ENABLE_INDUCTOR_MAX_AUTOTUNE": lambda: bool( int(os.getenv("VLLM_ENABLE_INDUCTOR_MAX_AUTOTUNE", "1")) ), # If set to 1, enable coordinate_descent_tuning; # By default, this is enabled (1) "VLLM_ENABLE_INDUCTOR_COOR...
@@ -1537,6 +1539,18 @@ def _get_or_set_default() -> str: # Disable PDL for LoRA, as enabling PDL with LoRA on SM100 causes # Triton compilation to fail. "VLLM_LORA_DISABLE_PDL": lambda: bool(int(os.getenv("VLLM_LORA_DISABLE_PDL", "0"))), + # Enable CUDA compatibility mode for datacenter GPUs with olde...
vllm/envs.py
26
Python
1
suggestion
465
51
51
false
[Bugfix] Fix CUDA compatibility path setting for both datacenter and consumer NVIDIA GPUs
33,992
vllm-project/vllm
71,895
Python
Copilot
ehfd
def _maybe_set_cuda_compatibility_path(): enable_cuda_compatibility = os.environ.get( "VLLM_ENABLE_CUDA_COMPATIBILITY", "0" ).strip().lower() in ("1", "true") if not enable_cuda_compatibility: return cuda_compat_path = os.environ.get("VLLM_CUDA_COMPATIBILITY_PATH", None) if not cuda_...
`VLLM_CUDA_COMPATIBILITY_PATH` comparisons are string-exact, so common variants like a trailing slash (e.g. `/usr/local/cuda-compat` vs `/usr/local/cuda-compat/`) will cause duplicate entries in `LD_LIBRARY_PATH` and skip the early-return. Consider normalizing paths (e.g., `os.path.normpath`) for both the configured pa...
because it will trigger the CUDA initialization, losing the chance to set the LD_LIBRARY_PATH beforehand. """ try: spec = importlib.util.find_spec("torch") if not spec: return None if spec.origin: torch_root = os.path.dirname(spec.origin) elif spec...
@@ -2,6 +2,42 @@ # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import os + +# The CUDA compatibility library path must be set before importing +# torch, because torch loads CUDA shared libraries at import time and the +# dynamic linker only consults LD_LIBRARY_PATH when a library is first +# ...
vllm/env_override.py
26
Python
0.857
refactor
370
51
51
false
[Bugfix] Fix CUDA compatibility path setting for both datacenter and consumer NVIDIA GPUs
33,992
vllm-project/vllm
71,895
Python
Copilot
ehfd
# ruff: noqa: E402 def _maybe_set_cuda_compatibility_path(): enable_cuda_compatibility = os.environ.get( "VLLM_ENABLE_CUDA_COMPATIBILITY", "0" ).strip().lower() in ("1", "true") if not enable_cuda_compatibility: return cuda_compat_path = os.environ.get("VLLM_CUDA_COMPATIBILITY_PATH", Non...
When adding the CUDA compatibility path to LD_LIBRARY_PATH, the original cuda_compat_path should be used instead of the normalized version. On line 35, cuda_compat_path is used, but on line 38 the normalized version is used for comparison. This inconsistency means if the user provides a path with symbolic links or rela...
PyTorch version must not be determined by importing directly because it will trigger the CUDA initialization, losing the chance to set the LD_LIBRARY_PATH beforehand. """ try: spec = importlib.util.find_spec("torch") if not spec: return None if spec.origin: ...
@@ -2,6 +2,46 @@ # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import os + +# The CUDA compatibility library path must be set before importing +# torch, because torch loads CUDA shared libraries at import time and the +# dynamic linker only consults LD_LIBRARY_PATH when a library is first +# ...
vllm/env_override.py
26
Python
1
refactor
638
51
51
false
[Bugfix] Fix CUDA compatibility path setting for both datacenter and consumer NVIDIA GPUs
33,992
vllm-project/vllm
71,895
Python
Copilot
ehfd
import torch from vllm.logger import init_logger from vllm.utils.torch_utils import is_torch_equal logger = init_logger(__name__) # set some common config/environment variables that should be set # for all processes created by vllm and all processes # that interact with vllm workers. # they are executed whenever `im...
The CUDA compatibility path is added to LD_LIBRARY_PATH without verifying that the directory exists. If VLLM_CUDA_COMPATIBILITY_PATH points to a non-existent directory, this could lead to confusing behavior where the environment variable is set but has no effect, or could cause issues with the dynamic linker. Consider ...
CUDA forward compatibility is only supported on select professional and datacenter NVIDIA GPUs. Consumer GPUs (GeForce, RTX) do not support it and will get Error 803 if compat libs are loaded. """ enable = os.environ.get("VLLM_ENABLE_CUDA_COMPATIBILITY", "0").strip().lower() in ( "1", ...
@@ -2,6 +2,46 @@ # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import os + +# The CUDA compatibility library path must be set before importing +# torch, because torch loads CUDA shared libraries at import time and the +# dynamic linker only consults LD_LIBRARY_PATH when a library is first +# ...
vllm/env_override.py
26
Python
1
suggestion
552
51
51
false
[Bugfix] Fix CUDA compatibility path setting for both datacenter and consumer NVIDIA GPUs
33,992
vllm-project/vllm
71,895
Python
Copilot
ehfd
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import os # The CUDA compatibility library path must be set before importing # torch, because torch loads CUDA shared libraries at import time and the # dynamic linker only consults LD_LIBRARY_PATH when a librar...
If VLLM_CUDA_COMPATIBILITY_PATH is set to an empty string, it will be treated as falsy and the function will return early (line 18). However, if a user explicitly sets it to an empty string (e.g., to disable a default value), this silent behavior might be confusing. Consider adding explicit handling for empty strings, ...
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project # ruff: noqa: E402 import importlib.util import os def _get_torch_cuda_version(): """Peripheral function to _maybe_set_cuda_compatibility_path(). PyTorch version must not be determined by importing direc...
@@ -2,6 +2,46 @@ # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import os + +# The CUDA compatibility library path must be set before importing +# torch, because torch loads CUDA shared libraries at import time and the +# dynamic linker only consults LD_LIBRARY_PATH when a library is first +# ...
vllm/env_override.py
19
Python
0.643
suggestion
411
44
44
false
[Bugfix] Fix CUDA compatibility path setting for both datacenter and consumer NVIDIA GPUs
33,992
vllm-project/vllm
71,895
Python
Copilot
ehfd
if not enable_cuda_compatibility: return cuda_compat_path = os.environ.get("VLLM_CUDA_COMPATIBILITY_PATH", None) if not cuda_compat_path or not os.path.isdir(cuda_compat_path): return existing_ld_library = os.environ.get("LD_LIBRARY_PATH", None) if not existing_ld_library: ld...
When CUDA compatibility is enabled, this code rewrites `LD_LIBRARY_PATH` by splitting on `":"` and filtering out empty segments. Empty segments in `LD_LIBRARY_PATH` have meaning (current directory), so this can unintentionally change runtime library resolution. Consider using `os.pathsep` and preserving empty segments ...
spec = importlib.util.find_spec("torch") if not spec: return None if spec.origin: torch_root = os.path.dirname(spec.origin) elif spec.submodule_search_locations: torch_root = spec.submodule_search_locations[0] else: return None ...
@@ -2,6 +2,46 @@ # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import os + +# The CUDA compatibility library path must be set before importing +# torch, because torch loads CUDA shared libraries at import time and the +# dynamic linker only consults LD_LIBRARY_PATH when a library is first +# ...
vllm/env_override.py
26
Python
1
refactor
1,426
51
51
false
[Bugfix] Fix CUDA compatibility path setting for both datacenter and consumer NVIDIA GPUs
33,992
vllm-project/vllm
71,895
Python
Copilot
ehfd
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import os # The CUDA compatibility library path must be set before importing # torch, because torch loads CUDA shared libraries at import time and the # dynamic linker only consults LD_LIBRARY_PATH when a librar...
`# ruff: noqa: E402` is placed after an executable statement (`import os`). Ruff’s file-level directives typically need to be in the leading comment block to take effect; otherwise the later `import torch` may still trigger E402 in CI. Move the Ruff directive to the top-of-file (after SPDX headers, before imports) or a...
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project # ruff: noqa: E402 import importlib.util import os def _get_torch_cuda_version(): """Peripheral function to _maybe_set_cuda_compatibility_path(). PyTorch version must not be determined by importing direc...
@@ -2,6 +2,44 @@ # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import os + +# The CUDA compatibility library path must be set before importing +# torch, because torch loads CUDA shared libraries at import time and the +# dynamic linker only consults LD_LIBRARY_PATH when a library is first +# ...
vllm/env_override.py
11
Python
0.857
suggestion
375
36
36
false
[Bugfix] Fix CUDA compatibility path setting for both datacenter and consumer NVIDIA GPUs
33,992
vllm-project/vllm
71,895
Python
Copilot
ehfd
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import os # The CUDA compatibility library path must be set before importing # torch, because torch loads CUDA shared libraries at import time and the # dynamic linker only consults LD_LIBRARY_PATH when a librar...
When `VLLM_ENABLE_CUDA_COMPATIBILITY` is set but `VLLM_CUDA_COMPATIBILITY_PATH` is missing/invalid, the code silently returns. This can make CUDA import failures much harder to diagnose. Consider logging a warning (or raising a clear error) when compatibility is explicitly enabled but the path is not usable.
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project # ruff: noqa: E402 import importlib.util import os def _get_torch_cuda_version(): """Peripheral function to _maybe_set_cuda_compatibility_path(). PyTorch version must not be determined by importing direc...
@@ -2,6 +2,44 @@ # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import os + +# The CUDA compatibility library path must be set before importing +# torch, because torch loads CUDA shared libraries at import time and the +# dynamic linker only consults LD_LIBRARY_PATH when a library is first +# ...
vllm/env_override.py
19
Python
1
bug
309
44
44
false
[Bugfix] Fix CUDA compatibility path setting for both datacenter and consumer NVIDIA GPUs
33,992
vllm-project/vllm
71,895
Python
Copilot
ehfd
) monkeypatch.setattr(mamba_utils, "preprocess_mamba", fake_preprocess_mamba_fn) monkeypatch.setattr(mamba_utils, "postprocess_mamba", fake_post_process_mamba_fn) monkeypatch.setattr(mamba_utils, "do_mamba_copy_block", fake_copy_fn) def test_mamba_prefix_cache(monkeypatch: pytest.MonkeyPatch): run...
why do we need to change the test here? I think we only need 1 block + 3 spec block for at most 559 tokens?
get_fake_process_mamba_fn( mamba_utils.preprocess_mamba, mamba_utils.postprocess_mamba, mamba_utils.do_mamba_copy_block, ) ) monkeypatch.setattr(mamba_utils, "preprocess_mamba", fake_preprocess_mamba_fn) monkeypatch.setattr(mamba_utils, "postprocess_mamba"...
@@ -490,9 +522,9 @@ def test_mamba_prefix_cache(monkeypatch: pytest.MonkeyPatch): step_actions=[ StepAction(0, 554, [1, 1, 1, 1], (-1, -1), (-1, -1)), StepAction(554, 4, [], (-1, -1), (-1, -1)), - StepAction(555, 4, [], (-1, -1), (-1, -1)), + ...
tests/v1/e2e/test_mamba_prefix_cache.py
26
Python
0.5
question
107
51
51
false
[Hybrid] Enable mamba prefix cache "align" mode with async scheduling
33,997
vllm-project/vllm
71,895
Python
heheda12345
tdoublep
# possible. # # We only set it here in the CLI entrypoint, because changing to `spawn` # could break some existing code using vLLM as a library. `spawn` will cause # unexpected behavior if the code is not protected by # `if __name__ == "__main__":`. # # References: # - https://docs.p...
Can you rename the variables to be less confusing as well? - `default_max_tokens -> model_max_tokens` - `max_output_tokens -> platform_max_tokens` - `effective_max_tokens -> fallback_max_tokens`
# possible. # # We only set it here in the CLI entrypoint, because changing to `spawn` # could break some existing code using vLLM as a library. `spawn` will cause # unexpected behavior if the code is not protected by # `if __name__ == "__main__":`. # # References: # - https://docs.p...
@@ -180,14 +180,19 @@ def get_max_tokens( ) -> int: default_max_tokens = max_model_len - input_length max_output_tokens = current_platform.get_max_output_tokens(input_length) + # Use generation_config max_tokens as fallback, not as a ceiling
vllm/entrypoints/utils.py
26
Python
0.714
suggestion
195
51
51
false
[Bugfix] Treat generation_config max_tokens as default not ceiling
34,063
vllm-project/vllm
71,895
Python
DarkLight1337
almogtavor
@model_validator(mode="before") @classmethod def check_generation_prompt(cls, data): if data.get("continue_final_message") and data.get("add_generation_prompt"): raise ValueError( "Cannot set both `continue_final_message` and " "`add_generation_prompt` to...
Thanks @veeceey and @qandrew. I just have one question: does this limitation also apply to some multimodal models? cc @DarkLight1337 WDYT?
): raise ValueError( "Parameter 'cache_salt' must be a non-empty string if provided." ) return data @model_validator(mode="before") @classmethod def check_system_message_content_type(cls, data): """Warn if system messages contain non-text cont...
@@ -690,3 +690,47 @@ def check_cache_salt_support(cls, data): "Parameter 'cache_salt' must be a non-empty string if provided." ) return data + + @model_validator(mode="before") + @classmethod + def check_system_message_content_type(cls, data): + """Validate that sy...
vllm/entrypoints/openai/chat_completion/protocol.py
26
Python
0.286
question
141
51
51
false
Add validation to reject non-text content in system messages
34,072
vllm-project/vllm
71,895
Python
chaunceyjiang
veeceey
if isinstance(msg, dict) and msg.get("role") == "system": content = msg.get("content") # If content is a list (multimodal format) if isinstance(content, list): for part in content: if isinstance(part, dict): ...
```suggestion logger.warning_once( ``` Avoid log spam
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project # Adapted from # https://github.com/lm-sys/FastChat/blob/168ccc29d3f7edc50823016105c024fe2282732a/fastchat/protocol/openai_api_protocol.py import json import time from dataclasses import replace from typing impor...
@@ -690,3 +690,50 @@ def check_cache_salt_support(cls, data): "Parameter 'cache_salt' must be a non-empty string if provided." ) return data + + @model_validator(mode="before") + @classmethod + def check_system_message_content_type(cls, data): + """Warn if system m...
vllm/entrypoints/openai/chat_completion/protocol.py
26
Python
0.857
suggestion
86
34
726
false
Add validation to reject non-text content in system messages
34,072
vllm-project/vllm
71,895
Python
DarkLight1337
veeceey
synced_cudagraph_mode: The synchronized cudagraph mode (min across ranks) ] """ assert num_tokens_padded >= num_tokens_unpadded # Coordinate between the DP ranks via an All Reduce # to determine the total number of tokens that each rank # will run and if we are using ubatching or not. ...
Hi @LucasWilkinson. thinking about the case where some ranks are running cudagraphs and others aren't - Let tensor[3:] be `{0, 0, 1, 1, 1}` processing tokens `{600, 700, 16, 256, 128}` (with max cudagraph capture size 512). Here `synced_cudagraph_mode` will evaluate to `0` and `should_pad_dp` will be false. But it loo...
synced_cudagraph_mode: The synchronized cudagraph mode (min across ranks) ] """ assert num_tokens_padded >= num_tokens_unpadded # Coordinate between the DP ranks via an All Reduce # to determine the total number of tokens that each rank # will run and if we are using ubatching or not. ...
@@ -133,26 +130,29 @@ def _synchronize_dp_ranks( # will run and if we are using ubatching or not. tensor = _run_ar( should_ubatch=should_attempt_ubatching, - should_dp_pad=should_attempt_dp_padding, orig_num_tokens_per_ubatch=num_tokens_unpadded, padded_num_tokens_per_ubatch=...
vllm/v1/worker/dp_utils.py
26
Python
0.857
suggestion
412
51
51
false
[DP] Only use DP padding when cudagraphs are actually used
34,102
vllm-project/vllm
71,895
Python
varun-sundar-rabindranath
LucasWilkinson
synced_cudagraph_mode: The synchronized cudagraph mode (min across ranks) ] """ assert num_tokens_padded >= num_tokens_unpadded # Coordinate between the DP ranks via an All Reduce # to determine the total number of tokens that each rank # will run and if we are using ubatching or not. ...
Can you update the check to also pad if we are running with DBO?
synced_cudagraph_mode: The synchronized cudagraph mode (min across ranks) ] """ assert num_tokens_padded >= num_tokens_unpadded # Coordinate between the DP ranks via an All Reduce # to determine the total number of tokens that each rank # will run and if we are using ubatching or not. ...
@@ -133,26 +130,29 @@ def _synchronize_dp_ranks( # will run and if we are using ubatching or not. tensor = _run_ar( should_ubatch=should_attempt_ubatching, - should_dp_pad=should_attempt_dp_padding, orig_num_tokens_per_ubatch=num_tokens_unpadded, padded_num_tokens_per_ubatch=...
vllm/v1/worker/dp_utils.py
26
Python
0.143
question
64
51
51
false
[DP] Only use DP padding when cudagraphs are actually used
34,102
vllm-project/vllm
71,895
Python
SageMoore
LucasWilkinson
""" assert num_tokens_padded >= num_tokens_unpadded # Coordinate between the DP ranks via an All Reduce # to determine the total number of tokens that each rank # will run and if we are using ubatching or not. tensor = _run_ar( should_ubatch=should_attempt_ubatching, orig_num_t...
Shouldn't we use the runtime `should_ubatch` instead of `parallel_config.use_ubatching`? That way we don't pad for DBO when `should_ubatch` turns out false
""" assert num_tokens_padded >= num_tokens_unpadded # Coordinate between the DP ranks via an All Reduce # to determine the total number of tokens that each rank # will run and if we are using ubatching or not. tensor = _run_ar( should_ubatch=should_attempt_ubatching, orig_num_t...
@@ -133,47 +130,40 @@ def _synchronize_dp_ranks( # will run and if we are using ubatching or not. tensor = _run_ar( should_ubatch=should_attempt_ubatching, - should_dp_pad=should_attempt_dp_padding, orig_num_tokens_per_ubatch=num_tokens_unpadded, padded_num_tokens_per_ubatch=...
vllm/v1/worker/dp_utils.py
26
Python
0.714
performance
155
51
51
false
[DP] Only use DP padding when cudagraphs are actually used
34,102
vllm-project/vllm
71,895
Python
MatthewBonanni
LucasWilkinson
Need this assumption to ensure all drafting layers can use the same AttentionMetadata. May extend to multiple AttentionMetadata in the future. """ kv_cache_groups: dict[str, int] = {} for id, kv_cache_group in enumerate(kv_cache_config.kv_cache_groups): for la...
This lambda seems unnecessary, it's just used for the `use_cudagraphs` override, but that's only used once in line 1675. In line 1700, `valid_modes` is passed. The one in gpu_model_runner.py is useful because it captures other arguments
Need this assumption to ensure all drafting layers can use the same AttentionMetadata. May extend to multiple AttentionMetadata in the future. """ kv_cache_groups: dict[str, int] = {} for id, kv_cache_group in enumerate(kv_cache_config.kv_cache_groups): for la...
@@ -1680,28 +1658,55 @@ def validate_same_kv_cache_group(self, kv_cache_config: KVCacheConfig) -> None: == 1 ), "All drafting layers should belong to the same kv cache group" - def _pad_batch_across_dp( + def _determine_batch_execution_and_padding( self, - num_tokens_unpadd...
vllm/v1/spec_decode/eagle.py
26
Python
0.786
suggestion
237
51
51
false
[DP] Only use DP padding when cudagraphs are actually used
34,102
vllm-project/vllm
71,895
Python
MatthewBonanni
LucasWilkinson
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project from collections.abc import Set as AbstractSet from dataclasses import replace from itertools import product from vllm.config import CUDAGraphMode, VllmConfig from vllm.forward_context import BatchDescriptor from...
This duplicates the list from `CUDAGraphMode.valid_runtime_modes` -- maybe we move this definition to `compilation.py` and update `valid_runtime_modes` to use that too so we have a single source of truth? I also think `valid_runtime_modes`, as written, should really be called `is_valid_runtime_mode`. You can make `C...
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project from collections.abc import Set as AbstractSet from dataclasses import replace from itertools import product from vllm.config import CUDAGraphMode, VllmConfig from vllm.forward_context import BatchDescriptor from...
@@ -10,6 +11,10 @@ logger = init_logger(__name__) +ALL_CUDAGRAPH_RUNTIME_MODES = frozenset(
vllm/v1/cudagraph_dispatcher.py
14
Python
0.857
refactor
370
39
39
false
[DP] Only use DP padding when cudagraphs are actually used
34,102
vllm-project/vllm
71,895
Python
MatthewBonanni
LucasWilkinson
to a graph that supports a more general batch (uniform to non-uniform). Args: num_tokens: Number of tokens in the batch. uniform_decode: Whether the batch is uniform decode (i.e. uniform and query length is uniform_decode_query_len). has_lora: Whether...
nit: this could be `==` because we've already asserted `len(allowed_modes) >= 1`. Might be clearer that way but nbd if you want to keep it more defensive
uniform_decode: Whether the batch is uniform decode (i.e. uniform and query length is uniform_decode_query_len). has_lora: Whether LoRA is active. num_active_loras: Number of distinct active LoRA adapters. valid_modes: Set of cudagraph modes that are allow...
@@ -246,15 +252,29 @@ def dispatch( uniform_decode: Whether the batch is uniform decode (i.e. uniform and query length is uniform_decode_query_len). has_lora: Whether LoRA is active. - disable_full: If True, skip FULL cudagraph checks and - return PIE...
vllm/v1/cudagraph_dispatcher.py
26
Python
0.714
suggestion
153
51
51
false
[DP] Only use DP padding when cudagraphs are actually used
34,102
vllm-project/vllm
71,895
Python
MatthewBonanni
LucasWilkinson
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import random import pytest import torch from vllm import _custom_ops as ops from vllm.platforms import current_platform DEVICE_TYPE = current_platform.device_type def round_up(x, base): return ((x + base...
I am thinking we can revert such UTs now that we didn't enable these in xpu CI. We will have a unified change for device in the future.
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import random import pytest import torch from vllm import _custom_ops as ops def round_up(x, base): return ((x + base - 1) // base) * base def CEILDIV(x, y): return (x + y - 1) // y def sample_data...
@@ -6,6 +6,9 @@ import torch from vllm import _custom_ops as ops +from vllm.platforms import current_platform
tests/lora/test_moe_lora_align_sum.py
9
Python
0.5
suggestion
135
34
34
false
[XPU][8/N] Fix kernel bugs in XPU LoRA and MOE LORA
34,115
vllm-project/vllm
71,895
Python
jikunshang
chaojun-zhang
data.token_lora_mapping, slice_offset, slice_size=hidden_size, add_inputs=add_inputs, ) slice_offset += hidden_size assert_close(data.ref_out_tensor, data.our_out_tensor) # General tests params that tests for variations in all dimensions # except hi...
we should add some pytest skip for non-xpu platform.
data.ref_out_tensor, data.token_lora_mapping, slice_offset, slice_size=hidden_size, add_inputs=add_inputs, ) slice_offset += hidden_size assert_close(data.ref_out_tensor, data.our_out_tensor) # General tests params that tests for variati...
@@ -0,0 +1,295 @@ +# SPDX-License-Identifier: Apache-2.0 +# SPDX-FileCopyrightText: Copyright contributors to the vLLM project + +import pytest +import torch + +from tests.lora.utils import ( + PunicaTensors, + assert_close, + generate_data, + generate_data_for_expand_nslices, +) +from vllm.lora.ops.xpu_ops...
tests/lora/test_punica_xpu_ops.py
26
Python
0.357
suggestion
53
51
51
false
[XPU][8/N] Fix kernel bugs in XPU LoRA and MOE LORA
34,115
vllm-project/vllm
71,895
Python
jikunshang
chaojun-zhang
torch.rand((E, n_tiles_w2, k_tiles_w2), dtype=torch.float32) * factor_for_scale ) else: w1_scale = torch.randn(num_experts, dtype=torch.float32) w2_scale = torch.randn(num_experts, dtype=torch.float32) a1_scale = torch.randn(1, dtype=t...
doesn't `FusedMoEQuantConfig.make` support `int4_w4a16` ?
w2_scale = ( torch.rand((E, n_tiles_w2, k_tiles_w2), dtype=torch.float32) * factor_for_scale ) else: w1_scale = torch.randn(num_experts, dtype=torch.float32) w2_scale = torch.randn(num_experts, dtype=torch.float32) a1_scale...
@@ -183,22 +221,34 @@ def prepare(i: int): def run(): from vllm.model_executor.layers.fused_moe import override_config + from vllm.model_executor.layers.fused_moe.config import ( + int4_w4a16_moe_quant_config, + ) - if use_fp8_w8a8: - quant_dtype = torch.floa...
benchmarks/kernels/benchmark_moe.py
26
Python
0.571
question
57
51
51
false
[Perf] fused_moe: add int4_w4a16 benchmark support and tuning config
34,130
vllm-project/vllm
71,895
Python
tjtanaa
mgehre-amd
next_idx = frame_idx + 1 while next_idx < total_frames_num: ret, next_frame = cap.read() if ret: frames[i] = cv2.cvtColor(next_frame, cv2.COLOR_BGR2RGB) i += 1 break ...
I feel a bit confused about the introduction of this video backend. Seems that there is no usage of this `sample_frame_timestamps`? BTW, I think the timestamps computation should be at hf_processor side instead of video backend. Otherwise offline video inference can't have correct timestamps as well.
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import math from abc import abstractmethod from io import BytesIO from typing import TYPE_CHECKING, Any, cast import numpy as np import numpy.typing as npt if TYPE_CHECKING: import cv2 from vllm.logger impo...
@@ -747,3 +748,112 @@ def load_bytes( **kwargs, ) return out + + +@VIDEO_LOADER_REGISTRY.register("opencv_dynamic_openpangu") +class OpenCVDynamicOpenPanguVideoBackend(OpenCVVideoBackend): + @classmethod + def load_bytes( + cls, + data: bytes, + num_frames: int ...
vllm/multimodal/video.py
26
Python
0.857
suggestion
302
29
837
false
openpangu-vl support video input
34,134
vllm-project/vllm
71,895
Python
Isotr0py
hujiaxin0
i = 0 for frame_idx in frames_indices: cap.set(cv2.CAP_PROP_POS_FRAMES, frame_idx) ret, frame = cap.read() if ret: frames[i] = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB) i += 1 else: # when get a bad frame,conti...
```suggestion logger.warning( f"Expected reading {len(frames_indices)} frames," f"but only loaded {i} frames from video.", ) ``` Use `logger.warning` for warning message
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import math from abc import abstractmethod from io import BytesIO from typing import TYPE_CHECKING, Any, cast import numpy as np import numpy.typing as npt if TYPE_CHECKING: import cv2 from vllm.logger impo...
@@ -747,3 +748,111 @@ def load_bytes( **kwargs, ) return out + + +@VIDEO_LOADER_REGISTRY.register("opencv_dynamic_openpangu") +class OpenCVDynamicOpenPanguVideoBackend(OpenCVVideoBackend): + @classmethod + def load_bytes( + cls, + data: bytes, + num_frames: int ...
vllm/multimodal/video.py
26
Python
1
suggestion
225
38
837
false
openpangu-vl support video input
34,134
vllm-project/vllm
71,895
Python
Isotr0py
hujiaxin0
frames_indices = [ min(total_frames_num - 1, round(t * original_fps)) for t in sample_frame_timestamps ] width = int(cap.get(cv2.CAP_PROP_FRAME_WIDTH)) height = int(cap.get(cv2.CAP_PROP_FRAME_HEIGHT)) frames = np.empty((len(frames_indices), height, width,...
We can use `cls._read_frames` and `cls._read_frames_with_recovery` here to avoid duplicate implementation.
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import math from abc import abstractmethod from io import BytesIO from typing import TYPE_CHECKING, Any, cast import numpy as np import numpy.typing as npt if TYPE_CHECKING: import cv2 from vllm.logger impo...
@@ -747,3 +748,111 @@ def load_bytes( **kwargs, ) return out + + +@VIDEO_LOADER_REGISTRY.register("opencv_dynamic_openpangu") +class OpenCVDynamicOpenPanguVideoBackend(OpenCVVideoBackend): + @classmethod + def load_bytes( + cls, + data: bytes, + num_frames: int ...
vllm/multimodal/video.py
26
Python
0.714
refactor
106
46
837
false
openpangu-vl support video input
34,134
vllm-project/vllm
71,895
Python
Isotr0py
hujiaxin0
} return frames, metadata @classmethod def load_bytes( cls, data: bytes, num_frames: int = -1, **kwargs, ) -> tuple[npt.NDArray, dict[str, Any]]: frame_sample_mode = cast(str | None, kwargs.pop("frame_sample_mode", None)) max_fps = cast(int, ...
```suggestion @VIDEO_LOADER_REGISTRY.register("openpangu") ``` Since this is model-specific video loader, I prefer to register model type here.
} return frames, metadata @classmethod def load_bytes( cls, data: bytes, num_frames: int = -1, **kwargs, ) -> tuple[npt.NDArray, dict[str, Any]]: frame_sample_mode = cast(str | None, kwargs.pop("frame_sample_mode", None)) max_fps = cast(int, ...
@@ -747,3 +747,90 @@ def load_bytes( **kwargs, ) return out + + +@VIDEO_LOADER_REGISTRY.register("opencv_dynamic_openpangu")
vllm/multimodal/video.py
26
Python
1
suggestion
143
51
51
false
openpangu-vl support video input
34,134
vllm-project/vllm
71,895
Python
Isotr0py
hujiaxin0
quant_config_with_hf_to_vllm_mapper = {} for k, v in self.quant_config.items(): if isinstance(v, list): quant_config_with_hf_to_vllm_mapper[k] = hf_to_vllm_mapper.apply_list(v) elif isinstance(v, dict): quant_config_with_hf_to_vllm_mapper[k] = hf_...
if you wanted to hack something in to force mxfp4 for certain models, you could do it with the`prefix` (i.e. the layer name here). I still don't really love the idea of unilaterally doing this (its kind of suprising behavior without something opt-in). But perhaps we could also align with other work for more generic o...
def get_min_capability(cls) -> int: return 70 def get_name(self) -> QuantizationMethods: return "quark" def apply_vllm_mapper( # noqa: B027 self, hf_to_vllm_mapper: "WeightsMapper" ): """ Interface for models to update module names referenced in quantiz...
@@ -108,7 +109,15 @@ def get_quant_method( if should_ignore_layer( prefix, ignore=exclude_layers, fused_mapping=self.packed_modules_mapping ): - return UnquantizedLinearMethod() + if prefix == "lm_head" or not getattr(self, "dynamic_mxfp4_quant", False):
vllm/model_executor/layers/quantization/quark/quark.py
26
Python
0.857
suggestion
377
51
51
false
[ROCm] Add dynamic mxfp4 quantization for DeepSeek V2 projection layers
34,157
vllm-project/vllm
71,895
Python
robertgshaw2-redhat
dllehr-amd
is_io_processor_request = isinstance(request, IOProcessorRequest) try: lora_request = self._maybe_get_adapters(request) if getattr(request, "dimensions", None) is not None: return self.create_error_response( "dimensions is currently not suppo...
Here’s also an interesting finding from my recent refactoring of the pooling entrypoints. https://github.com/vllm-project/vllm/pull/28631#discussion_r2782025144 As the renderer is being used more and more frequently, the “last mile” between the input and the renderer calls for a new abstraction… <img width="1280"...
try: lora_request = self._maybe_get_adapters(request) if getattr(request, "dimensions", None) is not None: return self.create_error_response( "dimensions is currently not supported" ) engine_prompts: Sequence[ProcessorInpu...
@@ -107,7 +107,9 @@ async def create_pooling( validated_prompt = self.io_processor.parse_request(request) raw_prompts = await self.io_processor.pre_process_async( - prompt=validated_prompt, request_id=request_id + prompt=validated_prompt, + ...
vllm/entrypoints/pooling/pooling/serving.py
26
Python
0.643
refactor
434
51
51
false
add io_process_plugin for sparse embedding
34,214
vllm-project/vllm
71,895
Python
noooop
staugust
self._build_render_params(prompt), ) return engine_prompts def post_process( self, model_output: Sequence[PoolingRequestOutput], request_id: str | None = None, **kwargs, ) -> IOProcessorOutput: num_prompt_tokens = 0 response_data = [] ...
```suggestion sparse_embedding[token_id] = max(weight, sparse_embedding.get(token_id, 0.0)) ```
def post_process( self, model_output: Sequence[PoolingRequestOutput], request_id: str | None = None, **kwargs, ) -> SparseEmbeddingResponse: num_prompt_tokens = 0 response_data = [] return_tokens = self._get_sparse_embedding_request(request_id).return_tok...
@@ -0,0 +1,154 @@ +# SPDX-License-Identifier: Apache-2.0 +# SPDX-FileCopyrightText: Copyright contributors to the vLLM project + +from collections.abc import Sequence +from typing import Any + +from vllm.config import VllmConfig +from vllm.entrypoints.openai.engine.protocol import UsageInfo +from vllm.entrypoints.pooli...
tests/plugins/bge_m3_sparse_plugin/bge_m3_sparse_processor/sparse_embeddings_processor.py
26
Python
1
suggestion
111
51
43
false
add io_process_plugin for sparse embedding
34,214
vllm-project/vllm
71,895
Python
maxdebayser
staugust
# which means first token and last token are special tokens mo.prompt_token_ids = mo.prompt_token_ids[1:] for token_id, weight in zip(mo.prompt_token_ids, mo.outputs.data): if token_id not in sparse_embedding: sparse_embedding[token_id] = w...
Perhaps in `output_to_response` you could translate the token_ids to the token text representation, as they do in the FlagEmbedding library.
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project from collections.abc import Sequence from vllm.config import VllmConfig from vllm.entrypoints.openai.engine.protocol import UsageInfo from vllm.inputs.data import PromptType from vllm.logger import init_logger f...
@@ -0,0 +1,154 @@ +# SPDX-License-Identifier: Apache-2.0 +# SPDX-FileCopyrightText: Copyright contributors to the vLLM project + +from collections.abc import Sequence +from typing import Any + +from vllm.config import VllmConfig +from vllm.entrypoints.openai.engine.protocol import UsageInfo +from vllm.entrypoints.pooli...
tests/plugins/bge_m3_sparse_plugin/bge_m3_sparse_processor/sparse_embeddings_processor.py
26
Python
0.714
suggestion
140
44
136
false
add io_process_plugin for sparse embedding
34,214
vllm-project/vllm
71,895
Python
maxdebayser
staugust
if truncate_prompt_tokens is not None: warnings.warn( "The `truncate_prompt_tokens` parameter in `LLM.encode()` " "is deprecated and will be removed in v0.16. " "Please pass it via `tokenization_kwargs` instead.", DeprecationWarning, ...
I think the invariant should be `request.data == prompt`, not `prompt.data == request`, according to the current definition of `tests/plugins/prithvi_io_processor_plugin/prithvi_io_processor/prithvi_processor.py`.
pooling_params, len(prompts_seq), ) ] for p in params_seq: if p.task is None: p.task = "plugin" else: if pooling_params is None: # Use default pooling params. ...
@@ -1154,10 +1154,12 @@ def encode( ) # Validate the request data is valid for the loaded plugin - validated_prompt = self.io_processor.parse_data(prompts) + validated_prompt = self.io_processor.parse_data(prompts.get("data", None))
vllm/entrypoints/llm.py
26
Python
1
suggestion
213
51
51
false
add io_process_plugin for sparse embedding
34,214
vllm-project/vllm
71,895
Python
DarkLight1337
staugust
params: PoolingParams | None = None, request: Any = None, ) -> PoolingParams: if params is None: params = PoolingParams() # refer to PoolingCompletionRequest.to_pooling_params if isinstance(request, IOProcessorRequest): if params.task is None: ...
Isn't there a way to access the renderer when initializing the plugin?
if params is None: params = PoolingParams() # refer to PoolingCompletionRequest.to_pooling_params params.task = "token_classify" return params def parse_request( self, request_data: object ) -> SparseEmbeddingCompletionRequestMixin: # for vllm.entrypo...
@@ -0,0 +1,142 @@ +# SPDX-License-Identifier: Apache-2.0 +# SPDX-FileCopyrightText: Copyright contributors to the vLLM project + +from collections.abc import Sequence +from typing import Any + +from vllm.config import VllmConfig +from vllm.entrypoints.openai.engine.protocol import UsageInfo +from vllm.entrypoints.pooli...
tests/plugins/bge_m3_sparse_plugin/bge_m3_sparse_processor/sparse_embeddings_processor.py
26
Python
0.143
question
70
51
51
false
add io_process_plugin for sparse embedding
34,214
vllm-project/vllm
71,895
Python
christian-pinto
staugust
created_time = int(time.time()) try: lora_request = self._maybe_get_adapters(request) if getattr(request, "dimensions", None) is not None: return self.create_error_response( "dimensions is currently not supported" ) ...
Inside `pre_process` this plugin checks whether the renderer is in kwargs but here we pass it all the time. If models can have no renderer we should not pass it here or make the `renderer` a proper argument.
created_time = int(time.time()) try: lora_request = self._maybe_get_adapters(request) if getattr(request, "dimensions", None) is not None: return self.create_error_response( "dimensions is currently not supported" ) ...
@@ -105,7 +105,9 @@ async def create_pooling( validated_prompt = self.io_processor.parse_data(request.data) raw_prompts = await self.io_processor.pre_process_async( - prompt=validated_prompt, request_id=request_id + prompt=validated_prompt, + ...
vllm/entrypoints/pooling/pooling/serving.py
26
Python
0.786
suggestion
208
51
51
false
add io_process_plugin for sparse embedding
34,214
vllm-project/vllm
71,895
Python
christian-pinto
staugust
if match: year = int(match.group(1)[:4]) julian_day = match.group(1).split("T")[0][4:] if len(julian_day) == 3: julian_day = int(julian_day) else: julian_day = ( datetime.datetime....
Can the renderer be `None`?. From @DarkLight1337's comment I understand all models must have a renderer.
if match: year = int(match.group(1)[:4]) julian_day = match.group(1).split("T")[0][4:] if len(julian_day) == 3: julian_day = int(julian_day) else: julian_day = ( datetime.datetime....
@@ -218,7 +219,7 @@ def load_image( class PrithviMultimodalDataProcessor(IOProcessor[ImagePrompt, ImageRequestOutput]): indices = [0, 1, 2, 3, 4, 5] - def __init__(self, vllm_config: VllmConfig): + def __init__(self, vllm_config: VllmConfig, renderer: BaseRenderer | None = None):
tests/plugins/prithvi_io_processor_plugin/prithvi_io_processor/prithvi_processor.py
26
Python
0.5
suggestion
104
51
51
false
add io_process_plugin for sparse embedding
34,214
vllm-project/vllm
71,895
Python
christian-pinto
staugust
try: assert callable(func) processor_cls_qualname = func() if processor_cls_qualname is not None: loadable_plugins[name] = processor_cls_qualname except Exception: logger.warning("Failed to load plugin %s.", name, exc_info=True) num_av...
Add a warning to indicate that the argument will be required in v0.18
try: assert callable(func) processor_cls_qualname = func() if processor_cls_qualname is not None: loadable_plugins[name] = processor_cls_qualname except Exception: logger.warning("Failed to load plugin %s.", name, exc_info=True) num_av...
@@ -65,4 +69,7 @@ def get_io_processor( activated_plugin_cls = loadable_plugins[model_plugin] - return resolve_obj_by_qualname(activated_plugin_cls)(vllm_config) + # for backward compatibility, the plugin does not have a renderer argument + if "renderer" not in inspect.signature(activated_plugin_cls._...
vllm/plugins/io_processors/__init__.py
26
Python
0.143
suggestion
69
28
35
false
add io_process_plugin for sparse embedding
34,214
vllm-project/vllm
71,895
Python
DarkLight1337
staugust
def merge_sampling_params( self, params: SamplingParams | None = None, ) -> SamplingParams: if callable( validate_or_generate_params := getattr( self, "validate_or_generate_params", None ) ): warnings.warn( "`val...
Use `object` as the type annotation so downstream developers are expected to validate the type
def merge_sampling_params( self, params: SamplingParams | None = None, ) -> SamplingParams: if callable( validate_or_generate_params := getattr( self, "validate_or_generate_params", None ) ): warnings.warn( "`val...
@@ -62,6 +63,7 @@ def merge_sampling_params( def merge_pooling_params( self, params: PoolingParams | None = None, + request: Any = None,
vllm/plugins/io_processors/interface.py
26
Python
0.857
suggestion
94
51
51
false
add io_process_plugin for sparse embedding
34,214
vllm-project/vllm
71,895
Python
DarkLight1337
staugust
class BgeM3SparseEmbeddingsProcessor( IOProcessor[SparseEmbeddingCompletionRequestMixin, SparseEmbeddingResponse] ): def __init__(self, vllm_config: VllmConfig, renderer: BaseRenderer): super().__init__(vllm_config, renderer) self.offline_requests: list[SparseEmbeddingCompletionRequestMixin] = ...
```suggestion def parse_request(self, request_data: object) -> SparseEmbeddingCompletionRequestMixin: ```
IOProcessor[SparseEmbeddingCompletionRequestMixin, SparseEmbeddingResponse] ): def __init__(self, vllm_config: VllmConfig, renderer: BaseRenderer): super().__init__(vllm_config, renderer) self.offline_requests: list[SparseEmbeddingCompletionRequestMixin] = [] self.online_requests: dict[s...
@@ -0,0 +1,140 @@ +# SPDX-License-Identifier: Apache-2.0 +# SPDX-FileCopyrightText: Copyright contributors to the vLLM project + +from collections.abc import Sequence +from typing import Any + +from vllm.config import VllmConfig +from vllm.entrypoints.openai.engine.protocol import UsageInfo +from vllm.entrypoints.pooli...
tests/plugins/bge_m3_sparse_plugin/bge_m3_sparse_processor/sparse_embeddings_processor.py
26
Python
1
suggestion
109
51
51
false
add io_process_plugin for sparse embedding
34,214
vllm-project/vllm
71,895
Python
DarkLight1337
staugust
from vllm.outputs import PoolingRequestOutput from vllm.plugins.io_processors.interface import ( IOProcessor, ) from vllm.pooling_params import PoolingParams from vllm.renderers import BaseRenderer from vllm.tokenizers.detokenizer_utils import convert_ids_list_to_tokens from .types import ( SparseEmbeddingComp...
Honestly I'm not sure whether we still need to pass it here now, because we now define `IOProcessorRequest.build_tok_params`. `truncate_prompt_tokens` is deprecated in `PoolingParams` and should be applied via `TokenizeParams` now, see `InputProcessor._validate_params` for the deprecation message.
IOProcessor, ) from vllm.pooling_params import PoolingParams from vllm.renderers import BaseRenderer from vllm.tokenizers.detokenizer_utils import convert_ids_list_to_tokens from .types import ( SparseEmbeddingCompletionRequestMixin, SparseEmbeddingResponse, SparseEmbeddingResponseData, SparseEmbed...
@@ -0,0 +1,140 @@ +# SPDX-License-Identifier: Apache-2.0 +# SPDX-FileCopyrightText: Copyright contributors to the vLLM project + +from collections.abc import Sequence +from typing import Any + +from vllm.config import VllmConfig +from vllm.entrypoints.openai.engine.protocol import UsageInfo +from vllm.entrypoints.pooli...
tests/plugins/bge_m3_sparse_plugin/bge_m3_sparse_processor/sparse_embeddings_processor.py
26
Python
0.786
suggestion
298
51
51
false
add io_process_plugin for sparse embedding
34,214
vllm-project/vllm
71,895
Python
DarkLight1337
staugust
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import inspect import logging from vllm.config import VllmConfig from vllm.plugins import IO_PROCESSOR_PLUGINS_GROUP, load_plugins_by_group from vllm.plugins.io_processors.interface import IOProcessor from vllm....
```suggestion renderer: BaseRenderer, ```
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import inspect import logging from vllm.config import VllmConfig from vllm.plugins import IO_PROCESSOR_PLUGINS_GROUP, load_plugins_by_group from vllm.plugins.io_processors.interface import IOProcessor from vllm....
@@ -1,18 +1,22 @@ # SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project +import inspect import logging from vllm.config import VllmConfig from vllm.plugins import IO_PROCESSOR_PLUGINS_GROUP, load_plugins_by_group from vllm.plugins.io_processors.interface im...
vllm/plugins/io_processors/__init__.py
19
Python
0.786
suggestion
45
44
44
false
add io_process_plugin for sparse embedding
34,214
vllm-project/vllm
71,895
Python
christian-pinto
staugust
class BgeM3SparseEmbeddingsProcessor( IOProcessor[SparseEmbeddingCompletionRequestMixin, SparseEmbeddingResponse] ): def __init__(self, vllm_config: VllmConfig, renderer: BaseRenderer): super().__init__(vllm_config, renderer) self.offline_requests: list[SparseEmbeddingCompletionRequestMixin] = [...
```suggestion raise TypeError("request_data should be a dictionary") ```
class BgeM3SparseEmbeddingsProcessor( IOProcessor[SparseEmbeddingCompletionRequestMixin, SparseEmbeddingResponse] ): def __init__(self, vllm_config: VllmConfig, renderer: BaseRenderer): super().__init__(vllm_config, renderer) self.offline_requests: list[SparseEmbeddingCompletionRequestMixin] = [...
@@ -0,0 +1,135 @@ +# SPDX-License-Identifier: Apache-2.0 +# SPDX-FileCopyrightText: Copyright contributors to the vLLM project + +from collections.abc import Sequence + +from vllm.config import VllmConfig +from vllm.entrypoints.openai.engine.protocol import UsageInfo +from vllm.inputs.data import PromptType +from vllm....
tests/plugins/bge_m3_sparse_plugin/bge_m3_sparse_processor/sparse_embeddings_processor.py
26
Python
1
suggestion
80
51
51
false
add io_process_plugin for sparse embedding
34,214
vllm-project/vllm
71,895
Python
DarkLight1337
staugust
logger.warning("Failed to load plugin %s.", name, exc_info=True) num_available_plugins = len(loadable_plugins.keys()) if num_available_plugins == 0: raise ValueError( f"No IOProcessor plugins installed but one is required ({model_plugin})." ) if model_plugin not in ...
```suggestion activated_plugin_typ = resolve_obj_by_qualname(activated_plugin_cls) # for backward compatibility, the plugin does not have a renderer argument if "renderer" not in inspect.signature(activated_plugin_typ.__init__).parameters: logger.warning( "The renderer argument will be ...
logger.warning("Failed to load plugin %s.", name, exc_info=True) num_available_plugins = len(loadable_plugins.keys()) if num_available_plugins == 0: raise ValueError( f"No IOProcessor plugins installed but one is required ({model_plugin})." ) if model_plugin not in ...
@@ -65,4 +69,12 @@ def get_io_processor( activated_plugin_cls = loadable_plugins[model_plugin] - return resolve_obj_by_qualname(activated_plugin_cls)(vllm_config) + # for backward compatibility, the plugin does not have a renderer argument + if "renderer" not in inspect.signature(activated_plugin_cls....
vllm/plugins/io_processors/__init__.py
26
Python
1
suggestion
549
27
29
false
add io_process_plugin for sparse embedding
34,214
vllm-project/vllm
71,895
Python
DarkLight1337
staugust
"32", "--hf_overrides", json.dumps(model_config["hf_overrides"]), "--io-processor-plugin", model_config["plugin"], ] with RemoteOpenAIServer(model_config["model_name"], args) as remote_server: yield remote_server @pytest.mark.asyncio @pytest.mark.parametrize( ...
Note that you have to modify the buildkite config to install the plugins and execute this test. https://github.com/vllm-project/vllm/blob/main/.buildkite/test_areas/plugins.yaml
@pytest.fixture(scope="function") def server(): args = [ "--runner", "pooling", "--enforce-eager", "--max-num-seqs", "32", "--hf_overrides", model_config["hf_overrides"], "--io-processor-plugin", model_config["plugin"], ] with Remote...
@@ -0,0 +1,203 @@ +# SPDX-License-Identifier: Apache-2.0 +# SPDX-FileCopyrightText: Copyright contributors to the vLLM project + +import json + +import pytest +import requests + +# Test configuration for BGE-M3 sparse plugin +from tests.utils import RemoteOpenAIServer +from vllm.entrypoints.pooling.pooling.protocol imp...
tests/plugins_tests/test_bge_m3_sparse_io_processor_plugins.py
26
Python
0.286
suggestion
179
51
51
false
add io_process_plugin for sparse embedding
34,214
vllm-project/vllm
71,895
Python
christian-pinto
staugust
w1, # Tensor or triton_kernels.Tensor w2, # Tensor or triton_kernels.Tensor gating_output: torch.Tensor, topk: int, renormalize: bool, activation: str = "silu", quant_config: FusedMoEQuantConfig | None = None, apply_router_weight_on_input: bool = False, global_num_experts: int = -1...
Hey @elizabetht - I tried this PR on an H100 and I ran into ``` (Worker_TP1_EP1 pid=716570) ERROR 02-13 17:09:54 [multiproc_executor.py:863] File "/home/varun-sundar-rabindranath/code/vllm/vllm/model_executor/layers/fused_moe/gpt_oss_triton_kernels_moe.py", line 196, in triton_kernel_moe_forward (Worker_TP1_EP1 pid...
hidden_states: torch.Tensor, w1, # Tensor or triton_kernels.Tensor w2, # Tensor or triton_kernels.Tensor gating_output: torch.Tensor, topk: int, renormalize: bool, activation: MoEActivation = MoEActivation.SWIGLUOAI, quant_config: FusedMoEQuantConfig | None = None, apply_router_wei...
@@ -178,9 +178,35 @@ def triton_kernel_moe_forward( global_num_experts: int = -1, expert_map: torch.Tensor | None = None, ) -> torch.Tensor: - routing_data, gather_idx, scatter_idx = legacy_routing( - gating_output, topk, sm_first=not renormalize - ) + if expert_map is not None: + # Wi...
vllm/model_executor/layers/fused_moe/gpt_oss_triton_kernels_moe.py
26
Python
1
suggestion
822
51
51
false
fix(mxfp4): Disable monolithic path for TRITON backend with EP
34,270
vllm-project/vllm
71,895
Python
varun-sundar-rabindranath
elizabetht
mock_get_config, mock_get_backend, backend, ep_size, expected_monolithic, ): """is_monolithic should be True for TRITON regardless of EP size.""" mock_get_backend.return_value = backend mock_compilation_config = MagicMock() mock_compilation_co...
@elizabetht This test doesn't pass for me on H100. Can you fix it by ``` diff --git a/tests/kernels/quantization/test_mxfp4_triton_ep.py b/tests/kernels/quantization/test_mxfp4_triton_ep.py index 5ef21810b..7f1e62280 100644 --- a/tests/kernels/quantization/test_mxfp4_triton_ep.py +++ b/tests/kernels/quantization/test...
mock_get_config, mock_get_backend, backend, ep_size, expected_monolithic, ): """is_monolithic should be True for TRITON regardless of EP size.""" mock_get_backend.return_value = backend mock_compilation_config = MagicMock() mock_compilation_co...
@@ -0,0 +1,192 @@ +# SPDX-License-Identifier: Apache-2.0 +# SPDX-FileCopyrightText: Copyright contributors to the vLLM project +""" +Tests that triton_kernel_moe_forward correctly applies expert_map +remapping when expert parallelism (EP) is enabled. + +Previously, legacy_routing was always used and it produced routing...
tests/kernels/quantization/test_mxfp4_triton_ep.py
26
Python
1
suggestion
1,995
51
51
false
fix(mxfp4): Disable monolithic path for TRITON backend with EP
34,270
vllm-project/vllm
71,895
Python
varun-sundar-rabindranath
elizabetht
from typing import NamedTuple, cast, get_args import torch from vllm.config.cache import CacheDType from vllm.logger import init_logger from vllm.utils.import_utils import resolve_obj_by_qualname from vllm.v1.attention.backend import AttentionBackend, AttentionType from vllm.v1.attention.backends.registry import ( ...
Could we call this `use_per_head_quant_scales` for consistency with the other arguments?
from typing import NamedTuple, cast, get_args import torch from vllm.config.cache import CacheDType from vllm.logger import init_logger from vllm.utils.import_utils import resolve_obj_by_qualname from vllm.v1.attention.backend import AttentionBackend, AttentionType from vllm.v1.attention.backends.registry import ( ...
@@ -27,6 +27,7 @@ class AttentionSelectorConfig(NamedTuple): has_sink: bool = False use_sparse: bool = False use_mm_prefix: bool = False + requires_per_head_quant_scales: bool = False
vllm/v1/attention/selector.py
26
Python
0.571
question
88
51
51
false
[Attn,KV-cache] Use per-head scales in the attention selector
34,281
vllm-project/vllm
71,895
Python
MatthewBonanni
eldarkurtic
("FLEX_ATTENTION", False, False), # Flex does not support ], ) def test_per_head_quant_scales_backend_selection( backend_name: str, supports_per_head: bool, should_succeed: bool ): """Test backend selection when use_per_head_quant_scales=True.""" # Clear cache to ensure fresh backend selection ...
By patching this I think the test isn't actually exercising the backend support, it'll just always pass as long as `supports_per_head` matches `should_succeed` in the test case. Can you get rid of this patch? ```suggestion ```
("FLEX_ATTENTION", None, False), # Flex does not support ], ) def test_per_head_quant_scales_backend_selection( backend_name: str, flash_attn_version: int | None, should_succeed: bool ): """Test backend selection when use_per_head_quant_scales=True.""" # Clear cache to ensure fresh backend sele...
@@ -291,3 +291,57 @@ def test_invalid_backend(): ): # Invalid backend name should raise ValueError when creating enum AttentionConfig(backend=AttentionBackendEnum["INVALID"]) + + +@pytest.mark.parametrize( + "backend_name,supports_per_head,should_succeed", + [ + ("FLASH_ATTN", True, ...
tests/kernels/attention/test_attention_selector.py
26
Python
1
suggestion
226
47
47
false
[Attn,KV-cache] Use per-head scales in the attention selector
34,281
vllm-project/vllm
71,895
Python
MatthewBonanni
eldarkurtic
# Unsupported head size backend = get_attn_backend(17, torch.float16, None, 16) assert backend.get_name() != "FLASH_ATTN" def test_invalid_backend(): """Test that invalid attention backend names raise ValueError.""" with ( pytest.raises(ValueError), ): # Invalid ba...
see below ```suggestion backend_name: str, should_succeed: bool ```
# Unsupported head size backend = get_attn_backend(17, torch.float16, None, 16) assert backend.get_name() != "FLASH_ATTN" def test_invalid_backend(): """Test that invalid attention backend names raise ValueError.""" with ( pytest.raises(ValueError), ): # Invalid ba...
@@ -291,3 +291,57 @@ def test_invalid_backend(): ): # Invalid backend name should raise ValueError when creating enum AttentionConfig(backend=AttentionBackendEnum["INVALID"]) + + +@pytest.mark.parametrize( + "backend_name,supports_per_head,should_succeed", + [ + ("FLASH_ATTN", True, ...
tests/kernels/attention/test_attention_selector.py
26
Python
0.857
suggestion
71
51
51
false
[Attn,KV-cache] Use per-head scales in the attention selector
34,281
vllm-project/vllm
71,895
Python
MatthewBonanni
eldarkurtic
if logging_config: dictConfig(logging_config) def init_logger(name: str) -> _VllmLogger: """The main purpose of this function is to ensure that loggers are retrieved in such a way that we can be sure the root vllm logger has already been configured.""" logger = logging.getLogger(name) ...
```suggestion def current_formatter_type(logger: Logger) -> Literal["color", "newline", None]: lgr = logger ``` This should keep the stricter type check at the call site, while still passing mypy internally
if logging_config: dictConfig(logging_config) def init_logger(name: str) -> _VllmLogger: """The main purpose of this function is to ensure that loggers are retrieved in such a way that we can be sure the root vllm logger has already been configured.""" logger = logging.getLogger(name) ...
@@ -225,7 +225,7 @@ def suppress_logging(level: int = logging.INFO) -> Generator[None, Any, None]: logging.disable(current_level) -def current_formatter_type(lgr: Logger) -> Literal["color", "newline", None]: +def current_formatter_type(lgr: Logger | None) -> Literal["color", "newline", None]:
vllm/logger.py
26
Python
1
suggestion
211
51
51
false
[CI] Enable mypy coverage for individual excluded files
34,292
vllm-project/vllm
71,895
Python
DarkLight1337
Lucaskabela
not self.compilation_config.cudagraph_mode.requires_piecewise_compilation() or self.compilation_config.is_attention_compiled_piecewise() ), ( "Compilation mode should be CompilationMode.VLLM_COMPILE when " "cudagraph_mode piecewise cudagraphs is used, " ...
Not sure whether this is proper, cc @LucasWilkinson
not self.compilation_config.cudagraph_mode.requires_piecewise_compilation() or self.compilation_config.is_attention_compiled_piecewise() ), ( "Compilation mode should be CompilationMode.VLLM_COMPILE when " "cudagraph_mode piecewise cudagraphs is used, " ...
@@ -71,6 +71,8 @@ def _compute_bs_to_padded_graph_size(self) -> None: """Pre-compute the mapping from batch size to padded graph size.""" max_size = self.compilation_config.max_cudagraph_capture_size capture_sizes = self.compilation_config.cudagraph_capture_sizes + if capture_sizes is ...
vllm/v1/cudagraph_dispatcher.py
26
Python
0.143
suggestion
52
51
51
false
[CI] Enable mypy coverage for individual excluded files
34,292
vllm-project/vllm
71,895
Python
DarkLight1337
Lucaskabela
] with RemoteOpenAIServer( MODEL_NAME, server_args, env_dict={"VLLM_AUDIO_FETCH_TIMEOUT": "30"}, ) as remote_server: client = remote_server.get_client() completion = client.chat.completions.create( model=MODEL_NAME, messages=messages, ...
Can we simply check logprobs instead of exact match and still fail if the logprobs differ too much?
*MISTRAL_FORMAT_ARGS, ] with RemoteOpenAIServer( MODEL_NAME, server_args, env_dict={"VLLM_AUDIO_FETCH_TIMEOUT": "30"}, ) as remote_server: client = remote_server.get_client() completion = client.chat.completions.create( model=MODEL_NAME, ...
@@ -86,30 +68,138 @@ def test_models_with_multiple_audios( ) -@pytest.mark.asyncio -async def test_online_serving(client, audio_assets: AudioTestAssets): - """Exercises online serving with/without chunked prefill enabled.""" +def test_online_serving(vllm_runner, audio_assets: AudioTestAssets): + """Two-l...
tests/models/multimodal/generation/test_voxtral.py
26
Python
0.357
bug
99
51
51
false
[CI] Heavy refactoring of Voxtral multimodal audio model tests
34,294
vllm-project/vllm
71,895
Python
DarkLight1337
AndreasKaratzas
intermediate_size_per_partition, 128 ) hidden_size = round_up(hidden_size, 128) elif current_platform.is_rocm(): pad_align = get_padding_alignment() intermediate_size_per_partition_after_pad = round_up( intermediate_size_per_partiti...
is `hidden_pad` ever passed in from somewhere? i'm updating #34285 to make sure conflicts are resolved but couldn't find where this is from
intermediate_size_per_partition_after_pad = round_up( intermediate_size_per_partition, 256 ) hidden_size = round_up(hidden_size, 256) elif ( self.mxfp4_backend == Mxfp4Backend.SM100_FI_MXFP4_MXFP8_CUTLASS or self.mxfp4_backend == Mxfp4B...
@@ -338,6 +347,10 @@ def create_weights( self.intermediate_size = intermediate_size_per_partition_after_pad self.hidden_size = hidden_size + self.hidden_pad = extra_weight_attrs.get("hidden_pad", 0)
vllm/model_executor/layers/quantization/mxfp4.py
26
Python
0.714
suggestion
139
51
51
false
[ROCm][Quantization] Add Composable Kernel (CK) backend support for M…
34,301
vllm-project/vllm
71,895
Python
BowenBao
dllehr-amd
"act_quant_fusion", "norm_rope_fusion", "attn_quant_fusion", "sequence_parallel", "async_tp", ] run_e2e_fusion_test( model_name, matches, model_kwargs, attn_backend, compilation_config, matches_check, tp_size=2, ...
We have to use list because in ROCm, we are using spawn processes, the data has to be able to be pickled. So it cannot be a generator.
"async_tp", ] run_e2e_fusion_test( model_name, matches, model_kwargs, attn_backend, compilation_config, matches_check, tp_size=2, ) @multi_gpu_test(num_gpus=2) @pytest.mark.parametrize( "model_name, matches_fn, model_kwargs, hf_overrides...
@@ -96,7 +106,7 @@ def test_tp2_async_tp_fp8_fusions( ) @pytest.mark.parametrize("attn_backend", [TRITON_ATTN]) @pytest.mark.parametrize("n_layers", [4]) -@pytest.mark.parametrize("custom_ops", custom_ops_combos("rms_norm")) +@pytest.mark.parametrize("custom_ops", list(custom_ops_combos("rms_norm")))
tests/compile/fusions_e2e/test_tp2_async_tp.py
26
Python
0.5
suggestion
134
51
51
false
[ROCm] [CI] Add new fusion test cases that are relevant to vLLM IR Ops
34,307
vllm-project/vllm
71,895
Python
tjtanaa
tjtanaa
# Fuse aiter fused_add_rms_norm + aiter dynamic group fp8 quant AiterFusedAddRMSFp8GroupQuantPattern( epsilon, FP8_DTYPE, GroupShape(1, 128) ).register(self.patterns) for match_aiter_quant in [True, False]: # Fuse aiter rms_norm + (aiter ...
Since the test is using regex to find out the number of ops being fused, and for aiter related fusion passes, they are stored in `vllm/compilation/passes/fusion/rocm_aiter_fusion.py` , so we have to add a new regex and matching key ``` "aiter_rms_quant_fusion": re.compile( r"RocmAiterRMSNormQuantFusionPass Repl...
# Fuse aiter fused_add_rms_norm + aiter dynamic group fp8 quant AiterFusedAddRMSFp8GroupQuantPattern( epsilon, FP8_DTYPE, GroupShape(1, 128) ).register(self.patterns) for match_aiter_quant in [True, False]: # Fuse aiter rms_norm + (aiter ...
@@ -312,7 +312,9 @@ def __init__(self, config: VllmConfig) -> None: @VllmInductorPass.time_and_log def __call__(self, graph: fx.Graph) -> None: self.matched_count = self.patterns.apply(graph) - logger.debug("Replaced %s patterns", self.matched_count) + logger.debug( + "%s Rep...
vllm/compilation/passes/fusion/rocm_aiter_fusion.py
26
Python
1
nitpick
515
51
51
false
[ROCm] [CI] Add new fusion test cases that are relevant to vLLM IR Ops
34,307
vllm-project/vllm
71,895
Python
tjtanaa
tjtanaa
ar_rms_fusion=0, # Not supported sequence_parallel=0, # Not supported async_tp=0, # Not supported ) ), ) qwen3_a3b_fp8 = ModelFusionInfo( model_name="Qwen/Qwen3-30B-A3B-FP8", matches=( lambda n_layers: Matches( rms_quant_fusion=n_layers, ...
This logic should live in the test
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import pytest from vllm._aiter_ops import is_aiter_found_and_supported from vllm.platforms import current_platform from vllm.utils.flashinfer import has_flashinfer from vllm.v1.attention.backends.registry import ...
@@ -66,45 +116,102 @@ llama4_scout_fp8 = ModelFusionInfo( model_name="nvidia/Llama-4-Scout-17B-16E-Instruct-FP8", hf_overrides=lambda n_layers: {"text_config": {"num_hidden_layers": n_layers}}, - matches=lambda n_layers: Matches( - rms_quant_fusion=n_layers, - attn_quant_fusion=n_layers, - ...
tests/compile/fusions_e2e/models.py
26
Python
0.286
suggestion
34
39
129
false
[ROCm] [CI] Add new fusion test cases that are relevant to vLLM IR Ops
34,307
vllm-project/vllm
71,895
Python
ProExpertProg
tjtanaa
AttentionBackendCase(backend=AttentionBackendEnum.ROCM_ATTN), id="ROCM_ATTN" ) ROCM_AITER_UNIFIED_ATTN = pytest.param( AttentionBackendCase(backend=AttentionBackendEnum.ROCM_AITER_UNIFIED_ATTN), id="ROCM_AITER_UNIFIED_ATTN", ) # Models llama3_8b = ModelFusionInfo( model_name="meta-llama/Llama-3.1-8B-I...
Can we unify these and just override them in the tests?
AttentionBackendCase(backend=AttentionBackendEnum.ROCM_ATTN), id="ROCM_ATTN", marks=pytest.mark.skipif( not current_platform.is_rocm(), reason="ROCm attention only for AMD", ), ) ROCM_AITER_UNIFIED_ATTN = pytest.param( AttentionBackendCase(backend=AttentionBackendEnum.ROCM_AITER_UNI...
@@ -24,37 +25,86 @@ AttentionBackendCase(backend=AttentionBackendEnum.TRITON_ATTN), id="TRITON_ATTN" ) +# ROCm backends +ROCM_ATTN = pytest.param( + AttentionBackendCase(backend=AttentionBackendEnum.ROCM_ATTN), id="ROCM_ATTN" +) + +ROCM_AITER_UNIFIED_ATTN = pytest.param( + AttentionBackendCase(backend=Att...
tests/compile/fusions_e2e/models.py
26
Python
0.143
question
55
51
51
false
[ROCm] [CI] Add new fusion test cases that are relevant to vLLM IR Ops
34,307
vllm-project/vllm
71,895
Python
ProExpertProg
tjtanaa
qwen3_a3b_fp8 = ModelFusionInfo( model_name="Qwen/Qwen3-30B-A3B-FP8", matches=( lambda n_layers: Matches( rms_quant_fusion=n_layers, norm_rope_fusion=n_layers, attn_quant_fusion=0, # attn + group quant not supported ar_rms_fusion=n_layers * 2 + 1, ...
@ProExpertProg We are thinking of opening a follow up PR to enable this fusion pass where we `fused two aiter ops into a vllm fused op`. Should we put this effort on hold till vLLM IR is ready or we can proceed?
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import pytest from vllm._aiter_ops import is_aiter_found_and_supported from vllm.platforms import current_platform from vllm.utils.flashinfer import has_flashinfer from vllm.v1.attention.backends.registry import ...
@@ -66,45 +116,102 @@ llama4_scout_fp8 = ModelFusionInfo( model_name="nvidia/Llama-4-Scout-17B-16E-Instruct-FP8", hf_overrides=lambda n_layers: {"text_config": {"num_hidden_layers": n_layers}}, - matches=lambda n_layers: Matches( - rms_quant_fusion=n_layers, - attn_quant_fusion=n_layers, - ...
tests/compile/fusions_e2e/models.py
26
Python
0.786
question
211
33
129
false
[ROCm] [CI] Add new fusion test cases that are relevant to vLLM IR Ops
34,307
vllm-project/vllm
71,895
Python
tjtanaa
tjtanaa
llama3_8b_fp8, llama4_scout_fp4, llama4_scout_fp8, qwen3_a3b_fp8, ) @pytest.mark.parametrize( "model_name, matches_fn, model_kwargs, hf_overrides, use_deepgemm", [ (*llama3_8b_fp8, False), (*qwen3_a3b_fp8, False), ] + ( [ (*llama4_scout_fp8, False), ...
Let's add this to the pytest param's skip function?
llama3_8b_fp4, llama3_8b_fp8, llama4_scout_fp4, llama4_scout_fp8, qwen3_a3b_fp8, ) @pytest.mark.parametrize( "model_name, matches_fn, model_kwargs, hf_overrides, use_deepgemm", [ (*llama3_8b_fp8, False), (*qwen3_a3b_fp8, False), pytest.param( *llama4_sco...
@@ -28,12 +31,23 @@ "model_name, matches_fn, model_kwargs, hf_overrides, use_deepgemm", [ (*llama3_8b_fp8, False), - (*llama4_scout_fp8, False), (*qwen3_a3b_fp8, False), - (*qwen3_a3b_fp8, True), - ], + ] + + ( + [ + (*llama4_scout_fp8, False), + ...
tests/compile/fusions_e2e/test_tp1_quant.py
26
Python
0.143
question
51
51
51
false
[ROCm] [CI] Add new fusion test cases that are relevant to vLLM IR Ops
34,307
vllm-project/vllm
71,895
Python
ProExpertProg
tjtanaa
model_kwargs["hf_overrides"] = hf_overrides(n_layers) model_kwargs["load_format"] = "dummy" model_kwargs["max_model_len"] = 1024 compilation_config = dict( use_inductor_graph_partition=inductor_graph_partition, custom_ops=custom_ops.split(","), pass_config=PassConfig( ...
Can we just replace `"rms_quant_fusion"` with `"aiter_rms_quant_fusion"`? ```suggestion matches_check[0] = "aiter_rms_quant_fusion" ```
# be fused with other ops. pytest.skip("FlashInfer block FP8 GEMM not supported") if use_deepgemm and is_blackwell(): # TODO(luka) DeepGEMM uses different quants, matching not supported # - on Blackwell, uses a special quant fp8, currently not supported pytest.skip("DeepGEMM...
@@ -78,13 +92,18 @@ def test_tp1_fp8_fusions( ), ) + use_aiter = current_platform.is_rocm() and ("qwen" in model_name.lower()) + matches_check = [ "rms_quant_fusion", "act_quant_fusion", "norm_rope_fusion", "attn_quant_fusion", ] + if use_aiter: + ...
tests/compile/fusions_e2e/test_tp1_quant.py
26
Python
1
question
144
51
51
false
[ROCm] [CI] Add new fusion test cases that are relevant to vLLM IR Ops
34,307
vllm-project/vllm
71,895
Python
ProExpertProg
tjtanaa
def ops_in_model_after(self): return [torch.ops.vllm.rocm_aiter_act_mul_and_fp8_group_quant] ROCM_KERNELS = [ROCmFP8ScaledMMLinearKernel, PerTensorTorchFP8ScaledMMLinearKernel] CUDA_KERNELS = [ FlashInferFP8ScaledMMLinearKernel, CutlassFP8ScaledMMLinearKernel, PerTensorTorchFP8ScaledMMLinearK...
```suggestion pytest.param(TestSiluMulGroupFp8QuantModel, False, None, skipif=not current_platform.is_cuda()) # GroupFP8Quant fusion only works with AITER on ROCm. # and the enable_quant_fp8_custom_op must be True. pytest.param(TestSiluMulGroupFp8QuantModel, True, None, skipif=not curren...
CutlassFP8ScaledMMLinearKernel, PerTensorTorchFP8ScaledMMLinearKernel, ] TEST_KERNELS = ROCM_KERNELS if current_platform.is_rocm() else CUDA_KERNELS @pytest.mark.parametrize("num_tokens", [32, 64]) @pytest.mark.parametrize("hidden_size", [128, 256]) @pytest.mark.parametrize("dtype", [torch.bfloat16, torch.flo...
@@ -191,7 +191,9 @@ def ops_in_model_after(self): list(itertools.product([TestSiluMulFp8QuantModel], [True, False], TEST_KERNELS)) + [ (TestSiluMulNvfp4QuantModel, False, None), - (TestSiluMulGroupFp8QuantModel, False, None), + # GroupFP8Quant fusion only works with AITER on ROCm. + ...
tests/compile/passes/test_silu_mul_quant_fusion.py
26
Python
1
suggestion
345
51
51
false
[ROCm] [CI] Add new fusion test cases that are relevant to vLLM IR Ops
34,307
vllm-project/vllm
71,895
Python
ProExpertProg
tjtanaa
compilation_config = get_current_vllm_config().compilation_config if prefix in compilation_config.static_forward_context: raise ValueError(f"Duplicate layer name: {prefix}") compilation_config.static_forward_context[prefix] = self self.kv_cache = [ torch.tensor([...
Can we do this in a separate PR? Or is it related?
compilation_config = get_current_vllm_config().compilation_config if prefix in compilation_config.static_forward_context: raise ValueError(f"Duplicate layer name: {prefix}") compilation_config.static_forward_context[prefix] = self self.kv_cache = [ torch.tensor([...
@@ -404,6 +404,7 @@ def __init__( self.is_aiter_triton_fp4_bmm_enabled = ( rocm_aiter_ops.is_fp4bmm_enabled() and self.kv_b_proj.weight.dtype == torch.bfloat16 + and current_platform.has_device_capability(95) # gfx950 and above
vllm/model_executor/layers/attention/mla_attention.py
26
Python
0.143
question
50
51
51
false
[ROCm] [CI] Add new fusion test cases that are relevant to vLLM IR Ops
34,307
vllm-project/vllm
71,895
Python
ProExpertProg
tjtanaa
model_kwargs["max_model_len"] = 1024 compilation_config = dict( use_inductor_graph_partition=inductor_graph_partition, custom_ops=custom_ops.split(","), pass_config=PassConfig( fuse_norm_quant=True, fuse_act_quant=True, fuse_attn_quant=True, ...
@ProExpertProg I moved the logic into the test as suggested.
use_aiter = current_platform.is_rocm() and ("qwen" in model_name.lower()) matches_check = [ "rms_quant_fusion", "act_quant_fusion", "norm_rope_fusion", "attn_quant_fusion", ] if use_aiter: matches_check[0] = "aiter_rms_quant_fusion" matches = matches._r...
@@ -78,13 +118,27 @@ def test_tp1_fp8_fusions( ), ) + use_aiter = current_platform.is_rocm() and ("qwen" in model_name.lower()) + matches_check = [ "rms_quant_fusion", "act_quant_fusion", "norm_rope_fusion", "attn_quant_fusion", ] + if use_aiter: + ...
tests/compile/fusions_e2e/test_tp1_quant.py
26
Python
0.357
suggestion
60
51
51
false
[ROCm] [CI] Add new fusion test cases that are relevant to vLLM IR Ops
34,307
vllm-project/vllm
71,895
Python
tjtanaa
tjtanaa
lambda n_layers: Matches( rms_quant_fusion=n_layers * 2, act_quant_fusion=n_layers, attn_quant_fusion=n_layers, ar_rms_fusion=0, # Not supported sequence_parallel=0, # Not supported async_tp=0, # Not supported ) ), ) llama3_...
Do we need to specify the ROCm match values for the nvidia FP4/FP8/MXFP4 models? Those should never be run on AMD anyway
# Also, for MoEs, gemm+collective fusion only happens for dense GEMMs (o_proj/qkv proj) llama4_scout_fp8 = ModelFusionInfo( model_name="nvidia/Llama-4-Scout-17B-16E-Instruct-FP8", hf_overrides=lambda n_layers: {"text_config": {"num_hidden_layers": n_layers}}, matches=lambda n_layers: Matches( rms_q...
@@ -24,37 +26,94 @@ AttentionBackendCase(backend=AttentionBackendEnum.TRITON_ATTN), id="TRITON_ATTN" ) +ROCM_ATTN = pytest.param( + AttentionBackendCase(backend=AttentionBackendEnum.ROCM_ATTN), + id="ROCM_ATTN", + marks=pytest.mark.skipif( + not current_platform.is_rocm(), + reason="ROCm ...
tests/compile/fusions_e2e/models.py
26
Python
0.5
question
120
51
47
false
[ROCm] [CI] Add new fusion test cases that are relevant to vLLM IR Ops
34,307
vllm-project/vllm
71,895
Python
Rohan138
tjtanaa
@pytest.mark.parametrize( "model_name, matches_fn, model_kwargs, hf_overrides, use_deepgemm", [ (*llama3_8b_fp8, False), (*qwen3_a3b_fp8, False), pytest.param( *llama4_scout_fp8, False, marks=pytest.mark.skipif( not current_platform.i...
you can add `attn_backend` to the parametrize list for the model, or have the model list and backends be set according to the platform e.g. https://github.com/vllm-project/vllm/blob/main/tests/compile/passes/test_fusion_attn.py#L223
) @pytest.mark.parametrize( "model_name, matches_fn, model_kwargs, hf_overrides, use_deepgemm", [ (*llama3_8b_fp8, False), (*qwen3_a3b_fp8, False), pytest.param( *llama4_scout_fp8, False, marks=pytest.mark.skipif( not current_platform...
@@ -28,12 +31,33 @@ "model_name, matches_fn, model_kwargs, hf_overrides, use_deepgemm", [ (*llama3_8b_fp8, False), - (*llama4_scout_fp8, False), (*qwen3_a3b_fp8, False), - (*qwen3_a3b_fp8, True), + pytest.param( + *llama4_scout_fp8, + False, + ...
tests/compile/fusions_e2e/test_tp1_quant.py
26
Python
0.571
suggestion
232
51
51
false
[ROCm] [CI] Add new fusion test cases that are relevant to vLLM IR Ops
34,307
vllm-project/vllm
71,895
Python
Rohan138
tjtanaa
matches = matches_fn(n_layers) if "qwen" in model_name.lower() and "-quant_fp8" in custom_ops: # This is why config forces +quant_fp8 by default pytest.skip("native QuantFP8 matching not supported for group quant") # Reduce size of model and skip weight loading time model_kwargs["hf_ov...
@ProExpertProg We have modified so that we override the values in the tests.
# TODO(luka) DeepGEMM uses different quants, matching not supported # - on Blackwell, uses a special quant fp8, currently not supported pytest.skip("DeepGEMM & quant matching not currently supported") matches = matches_fn(n_layers) if "qwen" in model_name.lower() and "-quant_fp8" in c...
@@ -78,13 +102,34 @@ def test_tp1_fp8_fusions( ), ) + use_aiter = current_platform.is_rocm() and ("qwen" in model_name.lower()) + + if not current_platform.is_cuda(): + matches = matches._replace(ar_rms_fusion=0, sequence_parallel=0, async_tp=0)
tests/compile/fusions_e2e/test_tp1_quant.py
26
Python
0.143
suggestion
76
51
51
false
[ROCm] [CI] Add new fusion test cases that are relevant to vLLM IR Ops
34,307
vllm-project/vllm
71,895
Python
tjtanaa
tjtanaa
matches = matches_fn(n_layers) if "qwen" in model_name.lower() and "-quant_fp8" in custom_ops: # This is why config forces +quant_fp8 by default pytest.skip("native QuantFP8 matching not supported for group quant") # Reduce size of model and skip weight loading time model_kwargs["hf_o...
Not needed - not used for tp1 ```suggestion ```
matches = matches_fn(n_layers) if "qwen" in model_name.lower() and "-quant_fp8" in custom_ops: # This is why config forces +quant_fp8 by default pytest.skip("native QuantFP8 matching not supported for group quant") # Reduce size of model and skip weight loading time model_kwargs["hf_o...
@@ -81,13 +105,34 @@ def test_tp1_fp8_fusions( ), ) + use_aiter = current_platform.is_rocm() and ("qwen" in model_name.lower()) + + if not current_platform.is_cuda(): + matches = matches._replace(ar_rms_fusion=0, sequence_parallel=0, async_tp=0)
tests/compile/fusions_e2e/test_tp1_quant.py
26
Python
0.786
suggestion
47
51
51
false
[ROCm] [CI] Add new fusion test cases that are relevant to vLLM IR Ops
34,307
vllm-project/vllm
71,895
Python
ProExpertProg
tjtanaa
# Reduce size of model and skip weight loading time model_kwargs["hf_overrides"] = hf_overrides(n_layers) model_kwargs["load_format"] = "dummy" model_kwargs["max_model_len"] = 1024 compilation_config = dict( use_inductor_graph_partition=inductor_graph_partition, custom_ops=custom_ops...
```suggestion matches_check[0] = "aiter_rms_quant_fusion" matches_check.remove("norm_rope_fusion") ```
# Reduce size of model and skip weight loading time model_kwargs["hf_overrides"] = hf_overrides(n_layers) model_kwargs["load_format"] = "dummy" model_kwargs["max_model_len"] = 1024 compilation_config = dict( use_inductor_graph_partition=inductor_graph_partition, custom_ops=custom_ops...
@@ -81,13 +105,34 @@ def test_tp1_fp8_fusions( ), ) + use_aiter = current_platform.is_rocm() and ("qwen" in model_name.lower()) + + if not current_platform.is_cuda(): + matches = matches._replace(ar_rms_fusion=0, sequence_parallel=0, async_tp=0) + if "qwen" in model_name.lower(): + ...
tests/compile/fusions_e2e/test_tp1_quant.py
26
Python
1
suggestion
118
51
51
false
[ROCm] [CI] Add new fusion test cases that are relevant to vLLM IR Ops
34,307
vllm-project/vllm
71,895
Python
ProExpertProg
tjtanaa
fuse_norm_quant=True, fuse_act_quant=True, fuse_attn_quant=True, enable_qk_norm_rope_fusion=True, ), ) use_aiter = current_platform.is_rocm() and ("qwen" in model_name.lower()) matches_check = [ "rms_quant_fusion", "act_quant_fusion",...
I think this is redundant, because we're already under `use_aiter` here
fuse_norm_quant=True, fuse_act_quant=True, fuse_attn_quant=True, enable_qk_norm_rope_fusion=True, ), ) use_aiter = current_platform.is_rocm() and ("qwen" in model_name.lower()) matches_check = [ "rms_quant_fusion", "act_quant_fusion",...
@@ -81,13 +105,27 @@ def test_tp1_fp8_fusions( ), ) + use_aiter = current_platform.is_rocm() and ("qwen" in model_name.lower()) + matches_check = [ "rms_quant_fusion", "act_quant_fusion", "norm_rope_fusion", "attn_quant_fusion", ] + if use_aiter: + ...
tests/compile/fusions_e2e/test_tp1_quant.py
26
Python
0.571
suggestion
71
51
51
false
[ROCm] [CI] Add new fusion test cases that are relevant to vLLM IR Ops
34,307
vllm-project/vllm
71,895
Python
ProExpertProg
tjtanaa
return [ SILU_MUL_OP if self.enable_silu_mul_custom_op else torch.ops.aten.mul, ] def ops_in_model_after(self): return [torch.ops.vllm.rocm_aiter_act_mul_and_fp8_group_quant] ROCM_KERNELS = [ROCmFP8ScaledMMLinearKernel, PerTensorTorchFP8ScaledMMLinearKernel] CUDA_KERNELS = [ ...
I think this was added for ROCm, we don't have this for CUDA: https://github.com/vllm-project/vllm/pull/25693
return [ SILU_MUL_OP if self.enable_silu_mul_custom_op else torch.ops.aten.mul, ] def ops_in_model_after(self): return [torch.ops.vllm.rocm_aiter_act_mul_and_fp8_group_quant] ROCM_KERNELS = [ROCmFP8ScaledMMLinearKernel, PerTensorTorchFP8ScaledMMLinearKernel] CUDA_KERNELS = [ ...
@@ -183,7 +183,24 @@ def ops_in_model_after(self): list(itertools.product([TestSiluMulFp8QuantModel], [True, False], TEST_KERNELS)) + [ (TestSiluMulNvfp4QuantModel, False, None), - (TestSiluMulGroupFp8QuantModel, False, None), + pytest.param(
tests/compile/passes/test_silu_mul_quant_fusion.py
26
Python
0.286
suggestion
109
51
51
false
[ROCm] [CI] Add new fusion test cases that are relevant to vLLM IR Ops
34,307
vllm-project/vllm
71,895
Python
ProExpertProg
tjtanaa
x = torch.rand(num_tokens, hidden_size * 2) # Reshape pass is needed for the fusion pass to work custom_ops = ["none"] if enable_silu_mul_custom_op: custom_ops.append("+silu_and_mul") if enable_quant_fp8_custom_op: custom_ops.append("+quant_fp8") config = VllmConfig( com...
This is a bit ugly, can we just do monkeypatch.setenv() at the start of the test?
# Reshape pass is needed for the fusion pass to work custom_ops = ["none"] if enable_silu_mul_custom_op: custom_ops.append("+silu_and_mul") if enable_quant_fp8_custom_op: custom_ops.append("+quant_fp8") config = VllmConfig( compilation_config=CompilationConfig( m...
@@ -227,13 +245,16 @@ def test_fusion_silu_and_mul_quant( ), ) - with set_current_vllm_config(config): + with set_current_vllm_config(config), monkeypatch.context() as m: fusion_passes = [ActivationQuantFusionPass(config)] - if IS_AITER_FOUND: + if IS_AITER_FOUND and model_c...
tests/compile/passes/test_silu_mul_quant_fusion.py
26
Python
0.143
question
81
51
51
false
[ROCm] [CI] Add new fusion test cases that are relevant to vLLM IR Ops
34,307
vllm-project/vllm
71,895
Python
ProExpertProg
tjtanaa
self.moe_config.sp_size, moe_dp_chunk_size_per_rank, chunk_idx ): process_chunk( chunk_start, chunk_end, skip_result_store=chunk_start_ >= num_tokens ) if self.shared_experts is None: return full_fused_final_hidden_stat...
Can you try putting this in `_moe_forward` and `_moe_forward_shared` instead?
) num_tokens = full_hidden_states.size(0) for chunk_idx, chunk_start_ in enumerate( range(0, max_tokens_across_dispatchers, moe_dp_chunk_size_per_rank) ): chunk_start = chunk_start_ chunk_end = min( chunk_start + moe_dp_chunk_size_...
@@ -561,6 +561,13 @@ def forward_impl( ) -> torch.Tensor | tuple[torch.Tensor, torch.Tensor]: assert self.quant_method is not None + # Ensure moe_quant_config is initialized. This is needed because + # forward_native (which also calls ensure_moe_quant_config_init) + # is compiled by...
vllm/model_executor/layers/fused_moe/runner/default_moe_runner.py
26
Python
0.571
question
77
51
51
false
[Bugfix] Add regression test for MoE quant_config under torch.compile
34,335
vllm-project/vllm
71,895
Python
bnellnm
mgehre-amd
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project # imports for structured outputs tests import asyncio import io import json import librosa import numpy as np import openai import pytest import pytest_asyncio import soundfile as sf from ...utils import Remote...
why are we dropping the turbo model, is there some issue with lang token pred for this model?
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project # imports for structured outputs tests import asyncio import io import json import librosa import numpy as np import openai import pytest import pytest_asyncio import soundfile as sf from ...utils import Remote...
@@ -15,7 +15,7 @@ from ...utils import RemoteOpenAIServer -MODEL_NAME = "openai/whisper-large-v3-turbo" +MODEL_NAME = "openai/whisper-large-v3"
tests/entrypoints/openai/test_transcription_validation_whisper.py
18
Python
0.143
question
93
43
43
false
[Frontend] Add automatic language detection for Whisper transcription
34,342
vllm-project/vllm
71,895
Python
NickLucche
spacecheck
language="en", response_format="text", temperature=0.0, extra_body={"max_completion_tokens": int(1e6)}, ) out = json.loads(transcription) out_text = out["text"] out_tokens = tok(out_text, add_special_tokens=False)["input_ids"] assert len(out_tokens) < 450 # ~Whisper ...
let's merge these tests into a single one with parametrization
language="en", response_format="text", temperature=0.0, extra_body={"max_completion_tokens": int(1e6)}, ) out = json.loads(transcription) out_text = out["text"] out_tokens = tok(out_text, add_special_tokens=False)["input_ids"] assert len(out_tokens) < 450 # ~Whisper ...
@@ -273,3 +273,33 @@ async def test_audio_with_max_tokens(whisper_client, mary_had_lamb): out_text = out["text"] out_tokens = tok(out_text, add_special_tokens=False)["input_ids"] assert len(out_tokens) < 450 # ~Whisper max output len + + +@pytest.mark.asyncio +async def test_language_auto_detect_english...
tests/entrypoints/openai/test_transcription_validation_whisper.py
26
Python
0.143
suggestion
62
40
37
false
[Frontend] Add automatic language detection for Whisper transcription
34,342
vllm-project/vllm
71,895
Python
NickLucche
spacecheck
""" Map from audio duration to number of audio tokens produced by the ASR model, without running a forward pass. This is used for estimating the amount of processing for this audio. """ return None @classmethod def post_process_output(cls, text: str) -> str: ...
have you considered mergin methods below and have this class be a class attribute to SupportsTranscription similar to `supports_transcription_only`?
"""Get the speech to text config for the ASR model.""" ... @classmethod def get_num_audio_tokens( cls, audio_duration_s: float, stt_config: SpeechToTextConfig, model_config: ModelConfig, ) -> int | None: """ Map from audio duration to number o...
@@ -1203,6 +1203,27 @@ def post_process_output(cls, text: str) -> str: return text +@runtime_checkable +class SupportsExplicitLanguageDetection(Protocol):
vllm/model_executor/models/interfaces.py
26
Python
0.714
question
148
51
51
false
[Frontend] Add automatic language detection for Whisper transcription
34,342
vllm-project/vllm
71,895
Python
NickLucche
spacecheck
logger.info("Input processor warmup completed in %.2fs", warmup_elapsed) except Exception: # Don't fail initialization if warmup fails - log warning and continue logger.exception( "Input processor warmup failed (non-fatal): %s. " "First request...
don't have a strong opinion on fallback to en, but I've seen cases where failing was the preferred policy as it would "signal" to provide language tag manually. We can also address this in a separate PR.
model_cls = get_model_cls(self.model_config) return cast(type[SupportsTranscription], model_cls) async def _detect_language( self, audio_chunk: np.ndarray, request_id: str, ) -> str: """Auto-detect the spoken language from an audio chunk. Delegates prom...
@@ -253,10 +256,76 @@ def model_cls(self) -> type[SupportsTranscription]: model_cls = get_model_cls(self.model_config) return cast(type[SupportsTranscription], model_cls) + async def _detect_language( + self, + audio_chunk: np.ndarray, + request_id: str, + ) -> str: + ...
vllm/entrypoints/openai/speech_to_text/speech_to_text.py
26
Python
0.571
bug
205
51
51
false
[Frontend] Add automatic language detection for Whisper transcription
34,342
vllm-project/vllm
71,895
Python
NickLucche
spacecheck