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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
w = tl.load(W + w_offsets, mask=w_mask, other=0.0).to(tl.float32)
if HAS_BIAS:
b = tl.load(B + w_offsets, mask=w_mask, other=0.0).to(tl.float32)
# Normalize and apply linear transformation
if not IS_RMS_NORM:
x_hat = (x - mean[:, None]) * rstd[:, None]
else:
x_hat = x * rst... | Remove this method now and replace usages with `platform_utils.num_compute_units`? | if HAS_BIAS:
b = tl.load(B + w_offsets, mask=w_mask, other=0.0).to(tl.float32)
# Normalize and apply linear transformation
if not IS_RMS_NORM:
x_hat = (x - mean[:, None]) * rstd[:, None]
else:
x_hat = x * rstd[:, None]
y = x_hat * w[None, :] + b[None, :] if HAS_BIAS else x_... | @@ -165,8 +166,7 @@ def layer_norm_fwd_kernel(
@lru_cache
def _get_sm_count(device: torch.device) -> int:
"""Get and cache the SM count for a given device."""
- props = torch.cuda.get_device_properties(device)
- return props.multi_processor_count
+ return num_compute_units(device.index) | vllm/model_executor/layers/fla/ops/layernorm_guard.py | 26 | Python | 0.571 | refactor | 82 | 51 | 51 | false | [Platform] Add current_platform.num_compute_units interface | 35,042 | vllm-project/vllm | 71,895 | Python | njhill | jikunshang |
hf_quant_config = getattr(hf_text_config, "quantization_config", None)
if hf_quant_config is None:
# compressed-tensors uses a compressions_config
hf_quant_config = getattr(model_config.hf_config, "compression_config", None)
# Pipe information about heads to enable TP-aware loading of a... | Is this the plan for future too? I was of the opinion that Modelopt would switch out of using hf_quant_config.json? | quant_cls = get_quantization_config(model_config.quantization)
# GGUF doesn't have config file
if model_config.quantization == "gguf":
return quant_cls()
# Read the quantization config from the HF model config, if available.
hf_quant_config = getattr(model_config.hf_config, "quantization_c... | @@ -286,7 +275,9 @@ def get_quant_config(
n_kv_heads if n_kv_heads is not None else n_heads
)
- if hf_quant_config is not None:
+ if hf_quant_config is not None and model_config.quantization != "modelopt_mixed":
+ # ModelOpt mixed-precision needs the per-layer quantized_layers map
+... | vllm/model_executor/model_loader/weight_utils.py | 26 | Python | 0.286 | question | 115 | 51 | 51 | false | add mixed precision support for modelopt | 35,047 | vllm-project/vllm | 71,895 | Python | pavanimajety | sychen52 |
exclude_modules: list[str],
quantized_layers: dict[str, dict[str, Any]],
fp8_config: ModelOptFp8Config,
nvfp4_config: ModelOptNvFp4Config,
) -> None:
super().__init__(exclude_modules)
self.kv_cache_quant_method = kv_cache_quant_method
self.quantized_layers = q... | In this function we can extract the shared logic among all Config class into a helper on the base class. | def __init__(
self,
kv_cache_quant_method: str | None,
exclude_modules: list[str],
quantized_layers: dict[str, dict[str, Any]],
fp8_config: ModelOptFp8Config,
nvfp4_config: ModelOptNvFp4Config,
) -> None:
super().__init__(exclude_modules)
self.kv_c... | @@ -1801,3 +1803,208 @@ def apply(
# Register the method classes for ModelOptMxFp8Config
ModelOptMxFp8Config.LinearMethodCls = ModelOptMxFp8LinearMethod
ModelOptMxFp8Config.KVCacheMethodCls = ModelOptFp8KVCacheMethod
+
+
+class ModelOptMixedPrecisionConfig(ModelOptQuantConfigBase):
+ """Config class for ModelOpt ... | vllm/model_executor/layers/quantization/modelopt.py | 26 | Python | 0.5 | refactor | 105 | 51 | 51 | false | add mixed precision support for modelopt | 35,047 | vllm-project/vllm | 71,895 | Python | Edwardf0t1 | sychen52 |
if key.startswith(prefix_dot):
return info["quant_algo"].upper()
return None
def get_quant_method(
self, layer: torch.nn.Module, prefix: str
) -> "QuantizeMethodBase | None":
"""Return quantize-method based on layer."""
# KV-cache quantization
... | This seems like a hack? Do you not have the vision modules in the exclude list on the checkpoint? | if key.startswith(prefix_dot):
return info["quant_algo"].upper()
return None
def get_quant_method(
self, layer: torch.nn.Module, prefix: str
) -> "QuantizeMethodBase | None":
"""Return quantize-method based on layer."""
# KV-cache quantization
... | @@ -1841,3 +1805,194 @@ def apply(
# Register the method classes for ModelOptMxFp8Config
ModelOptMxFp8Config.LinearMethodCls = ModelOptMxFp8LinearMethod
ModelOptMxFp8Config.KVCacheMethodCls = ModelOptFp8KVCacheMethod
+
+
+class ModelOptMixedPrecisionConfig(ModelOptQuantConfigBase):
+ """Config class for ModelOpt ... | vllm/model_executor/layers/quantization/modelopt.py | 26 | Python | 0.143 | question | 97 | 51 | 51 | false | add mixed precision support for modelopt | 35,047 | vllm-project/vllm | 71,895 | Python | mgoin | sychen52 |
f"{algos}. All shards must use the same quantization."
)
# 3. Prefix-based lookup (for FusedMoE / parent modules)
prefix_dot = prefix + "."
for key, info in self.quantized_layers.items():
if key.startswith(prefix_dot):
return info[... | If you are just going to return None for the non-linear case, where you could return UnquantizedFusedMoEMethod/etc, you could just return None for all cases I think | f"{algos}. All shards must use the same quantization."
)
# 3. Prefix-based lookup (for FusedMoE / parent modules)
prefix_dot = prefix + "."
for key, info in self.quantized_layers.items():
if key.startswith(prefix_dot):
return info[... | @@ -1841,3 +1805,194 @@ def apply(
# Register the method classes for ModelOptMxFp8Config
ModelOptMxFp8Config.LinearMethodCls = ModelOptMxFp8LinearMethod
ModelOptMxFp8Config.KVCacheMethodCls = ModelOptFp8KVCacheMethod
+
+
+class ModelOptMixedPrecisionConfig(ModelOptQuantConfigBase):
+ """Config class for ModelOpt ... | vllm/model_executor/layers/quantization/modelopt.py | 26 | Python | 0.5 | suggestion | 164 | 51 | 51 | false | add mixed precision support for modelopt | 35,047 | vllm-project/vllm | 71,895 | Python | mgoin | sychen52 |
output_size=sum(output_sizes),
bias=bias,
gather_output=gather_output,
skip_bias_add=skip_bias_add,
params_dtype=params_dtype,
quant_config=quant_config,
prefix=prefix,
return_bias=return_bias,
disable_tp=disable... | ```suggestion
if any(
b - a != 1
for a, b in zip(loaded_shard_id[:-1], loaded_shard_id[1:])
):
```
| output_size=sum(output_sizes),
bias=bias,
gather_output=gather_output,
skip_bias_add=skip_bias_add,
params_dtype=params_dtype,
quant_config=quant_config,
prefix=prefix,
return_bias=return_bias,
disable_tp=disable... | @@ -681,12 +697,43 @@ def __init__(
disable_tp=disable_tp,
)
+ def validate_shard_id(self, loaded_shard_id: int | tuple[int, ...] | None):
+ if loaded_shard_id is None:
+ return
+ if isinstance(loaded_shard_id, tuple):
+ for idx in loaded_shard_id:
+ ... | vllm/model_executor/layers/linear.py | 26 | Python | 1 | suggestion | 171 | 51 | 51 | false | [Misc] Add shard_id validation for MergedColumnLinear | 35,055 | vllm-project/vllm | 71,895 | Python | DarkLight1337 | Isotr0py |
# import custom ops, trigger op registration
try:
import vllm._rocm_C # noqa: F401
except ImportError as e:
logger.warning("Failed to import from vllm._rocm_C with %r", e)
# Models not supported by ROCm.
_ROCM_UNSUPPORTED_MODELS: list[str] = []
# Models partially supported by ROCm.
# Architecture -> Reason.
... | This same logic has been implemented as a function `_sync_visible_devices_env_vars` ins `system_utils.py`. Can we reuse that? | # import custom ops, trigger op registration
try:
import vllm._rocm_C # noqa: F401
except ImportError as e:
logger.warning("Failed to import from vllm._rocm_C with %r", e)
# Models not supported by ROCm.
_ROCM_UNSUPPORTED_MODELS: list[str] = []
# Models partially supported by ROCm.
# Architecture -> Reason.
... | @@ -62,12 +63,21 @@
}
# Prevent use of clashing `{CUDA/HIP}_VISIBLE_DEVICES`
-if "HIP_VISIBLE_DEVICES" in os.environ:
- val = os.environ["HIP_VISIBLE_DEVICES"]
- if cuda_val := os.environ.get("CUDA_VISIBLE_DEVICES", None):
- assert val == cuda_val
- else:
- os.environ["CUDA_VISIBLE_DEVICES"] ... | vllm/platforms/rocm.py | 26 | Python | 0.714 | question | 125 | 51 | 51 | false | [ROCm] Derive device capability from GCN arch string without CUDA init | 35,069 | vllm-project/vllm | 71,895 | Python | tjtanaa | AndreasKaratzas |
}
# Prevent use of clashing `{CUDA/HIP}_VISIBLE_DEVICES`
if "HIP_VISIBLE_DEVICES" in os.environ:
val = os.environ["HIP_VISIBLE_DEVICES"]
if cuda_val := os.environ.get("CUDA_VISIBLE_DEVICES", None):
assert val == cuda_val
else:
os.environ["CUDA_VISIBLE_DEVICES"] = val
# AMDSMI utils
# Note ... | This is being called unconditionally on all platforms and will set HIP_VISIBLE_DEVICES. You shouldn't do that | "0x744c": "AMD_Radeon_RX7900XTX",
}
def _sync_hip_cuda_env_vars():
"""Ensure HIP_VISIBLE_DEVICES and CUDA_VISIBLE_DEVICES are consistent.
Treats empty string as unset. Raises on genuine conflicts."""
hip_val = os.environ.get("HIP_VISIBLE_DEVICES") or None
cuda_val = os.environ.get("CUDA_VISIBLE_DE... | @@ -61,13 +62,29 @@
"0x744c": "AMD_Radeon_RX7900XTX",
}
-# Prevent use of clashing `{CUDA/HIP}_VISIBLE_DEVICES`
-if "HIP_VISIBLE_DEVICES" in os.environ:
- val = os.environ["HIP_VISIBLE_DEVICES"]
- if cuda_val := os.environ.get("CUDA_VISIBLE_DEVICES", None):
- assert val == cuda_val
- else:
- ... | vllm/platforms/rocm.py | 26 | Python | 0.5 | suggestion | 109 | 51 | 51 | false | [ROCm] Derive device capability from GCN arch string without CUDA init | 35,069 | vllm-project/vllm | 71,895 | Python | gshtras | AndreasKaratzas |
def on_gfx1x() -> bool:
return _ON_GFX1X
def on_mi3xx() -> bool:
return _ON_MI3XX
def on_gfx9() -> bool:
return _ON_GFX9
def on_gfx942() -> bool:
return _ON_GFX942
def on_gfx950() -> bool:
return _ON_GFX950
@cache
def use_rocm_custom_paged_attention(
qtype: torch.dtype,
head_size... | gfx are **not** numbers. The spec explicitly says so, and gfx90a is an example | "This will initialize CUDA and may cause "
"issues if CUDA_VISIBLE_DEVICES is not set yet."
)
# Ultimate fallback: use torch.cuda (will initialize CUDA)
return torch.cuda.get_device_properties("cuda").gcnArchName
# Resolve once at module load. Uses amdsmi (no CUDA init) so Ray ... | @@ -131,6 +148,77 @@ def _get_gcn_arch() -> str:
_ON_GFX950 = "gfx950" in _GCN_ARCH
+def _capability_from_gcn_arch(gcn_arch: str) -> tuple[int, int] | None:
+ """
+ Parse (major, minor) from a GCN arch string, mirroring how
+ HIP derives hipDeviceProp_t.major / .minor.
+
+ Format: gfx<MAJOR><MINOR><STE... | vllm/platforms/rocm.py | 26 | Python | 0.143 | suggestion | 78 | 51 | 51 | false | [ROCm] Derive device capability from GCN arch string without CUDA init | 35,069 | vllm-project/vllm | 71,895 | Python | gshtras | AndreasKaratzas |
)
return
element_size = torch.tensor([], dtype=self.model_dtype).element_size()
self.max_token_num = max_size // (self.hidden_dim * element_size)
# take the min to save workspace size and we'll never use more
# than max_num_batched_tokens anyways
self.max_... | Can we be a bit more specific about the error we're catching here? | )
return
element_size = torch.tensor([], dtype=self.model_dtype).element_size()
self.max_token_num = max_size // (self.hidden_dim * element_size)
# take the min to save workspace size and we'll never use more
# than max_num_batched_tokens anyways
self.max_... | @@ -729,14 +729,24 @@ def __init__(self, config: VllmConfig) -> None:
scope="global",
)
- self.workspace = flashinfer_comm.create_allreduce_fusion_workspace(
- backend="trtllm",
- world_size=self.tp_size,
- rank=rank,
- max_token_num=self.max_to... | vllm/compilation/passes/fusion/allreduce_rms_fusion.py | 26 | Python | 0.429 | question | 67 | 51 | 51 | false | [Bugfix] Gracefully disable AllReduceFusionPass on GPUs without multicast support | 35,085 | vllm-project/vllm | 71,895 | Python | ProExpertProg | haosdent |
"second_per_grid_ts",
"audio_feature_lengths",
"use_audio_in_video",
},
)
if any(
v
for k, v in kwargs.items()
if k not in {"image_grid_thw", "mm_token_type_ids"}
):
raise NotImplementedEr... | I don't understand this comment.
Will `mm_token_type_ids` only exist in v5 and we keep `kwargs` empty otherwise because `get_rope_index` would error in v4 if we explicitly passed the `None` value? | "video_grid_thw",
"mm_token_type_ids",
"second_per_grid_ts",
"audio_feature_lengths",
"use_audio_in_video",
},
)
if any(
v
for k, v in kwargs.items()
if k not in {"image_grid_t... | @@ -472,10 +468,16 @@ def get_mrope_input_positions(
video_grid_thw
)
+ # In v4 this utility didn't accept any `kwargs`, thus we filter | vllm/model_executor/models/transformers/multimodal.py | 26 | Python | 1 | question | 197 | 42 | 45 | false | [BugFix] Fix 3D rope in transformers backend | 35,097 | vllm-project/vllm | 71,895 | Python | hmellor | zucchini-nlp |
)
for i in range(n)
]
else:
num_samples = int(video_processor.max_duration * video_processor.fps)
if num_samples >= meta_frames:
frame_indices = list(range(meta_frames))
else:
... | Is this change also necessary for GLM4.1V? I remember GLM4.1V use int for timestamp while GLM4.6V is float with decimal seconds:
```
<|end_of_image|>0<|end_of_video|>
```
```
<|end_of_image|>0.0 seconds<|end_of_video|>
``` | return max(max_frames_per_video, 1)
def _get_video_second_idx_glm4v(
self, metadata: dict[str, Any], total_frames: int
) -> list[int]:
video_processor = self.get_video_processor()
video_fps = metadata.get("fps", video_processor.fps)
meta_frames = metadata.get("total_num... | @@ -1011,7 +990,7 @@ def _get_video_second_idx_glm4v(
uniq.append(uniq[-1])
frame_indices = uniq
- full_second_idxs = [int(idx / video_fps) for idx in frame_indices]
+ full_second_idxs = [idx / video_fps for idx in frame_indices] | vllm/model_executor/models/glm4_1v.py | 26 | Python | 1 | question | 222 | 51 | 51 | false | [BugFix] Fix 3D rope in transformers backend | 35,097 | vllm-project/vllm | 71,895 | Python | Isotr0py | zucchini-nlp |
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
from collections.abc import Iterable
from dataclasses import asdict, dataclass
import numpy as np
import torch
import torch.nn as nn
from transformers import ParakeetEncoder as HFParakeetEncoder
from transforme... | We prefer moving these configs under `vllm.transformers_utils.configs` | # SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
"""
Modules below used for the audio encoder component in: models/nano_nemotron_vl.py
"""
from collections.abc import Iterable
from dataclasses import asdict
import numpy as np
import torch
import torch.nn as nn... | @@ -0,0 +1,190 @@
+# SPDX-License-Identifier: Apache-2.0
+# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
+
+
+from collections.abc import Iterable
+from dataclasses import asdict, dataclass
+
+import numpy as np
+import torch
+import torch.nn as nn
+from transformers import ParakeetEncoder as HFPa... | vllm/model_executor/models/parakeet.py | 22 | Python | 0.571 | suggestion | 70 | 47 | 47 | false | Support parakeet as audio encoder for nemotron-nano-vl | 35,100 | vllm-project/vllm | 71,895 | Python | DarkLight1337 | netanel-haber |
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
from collections.abc import Iterable
from dataclasses import asdict
import numpy as np
import torch
import torch.nn as nn
from transformers import ParakeetEncoder as HFParakeetEncoder
from transformers import P... | Can we add a header here to indicate this module is intended to be used for Nemetron-nano-vl? | # SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
"""
Modules below used for the audio encoder component in: models/nano_nemotron_vl.py
"""
from collections.abc import Iterable
from dataclasses import asdict
import numpy as np
import torch
import torch.nn as nn... | @@ -0,0 +1,143 @@
+# SPDX-License-Identifier: Apache-2.0
+# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
+
+ | vllm/model_executor/models/parakeet.py | 6 | Python | 0.357 | question | 93 | 31 | 31 | false | Support parakeet as audio encoder for nemotron-nano-vl | 35,100 | vllm-project/vllm | 71,895 | Python | ywang96 | netanel-haber |
"""
if self.out_dtype is not None:
raise ValueError("out_dtype has already been set")
self.out_dtype = out_dtype
def forward(
self, x: torch.Tensor
) -> torch.Tensor | tuple[torch.Tensor, Parameter | None]:
import vllm._custom_ops as ops
# Tier 1: DS... | nit: we could do all these checks AOT in the constructor except for `x.dtype == torch.bfloat16`. side note: if we are including bias, should we just fall back to "Tier 3: F.linear (ReplicatedLinear)" since it is unfused? | self.allow_specialized_router_gemm
and output_size in self.DSV3_SUPPORTED_NUM_EXPERTS
and input_size in self.DSV3_SUPPORTED_HIDDEN_SIZES
)
# cuBLAS bf16→fp32 eligibility
self.allow_cublas_router_gemm = (
self.allow_specialized_router_gemm
... | @@ -0,0 +1,98 @@
+# SPDX-License-Identifier: Apache-2.0
+# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
+import torch
+from torch.nn.parameter import Parameter
+
+from vllm.model_executor.custom_op import PluggableLayer
+from vllm.model_executor.layers.linear import ReplicatedLinear
+from vllm.pla... | vllm/model_executor/layers/fused_moe/router/gate_linear.py | 26 | Python | 1 | question | 220 | 37 | 51 | false | [Performance] Cublas Bf16 Gate with Fp32 Output | 35,121 | vllm-project/vllm | 71,895 | Python | mgoin | roikoren755 |
from vllm.platforms import current_platform
@PluggableLayer.register("gate_linear")
class GateLinear(ReplicatedLinear):
"""MoE gate linear layer with three-tier GEMM dispatch:
1. DSV3 specialized kernel (SM90+, batch<=16, supported dims)
2. cuBLAS bf16×bf16→fp32 (any CUDA + bf16 + fp32 out_dtype)
3. ... | I'm not sure the default out_dtype should be set or float32. I feel this should be opt-in to change the out_dtype from the input/weights. This would also make more sense for replacing in all models with gate layers | from vllm.platforms import current_platform
@PluggableLayer.register("gate_linear")
class GateLinear(ReplicatedLinear):
"""MoE gate linear layer with three-tier GEMM dispatch:
1. DSV3 specialized kernel (SM90+, batch<=16, supported dims)
2. cuBLAS bf16×bf16→fp32 (SM90+ + bf16 + fp32 out_dtype)
3. F.l... | @@ -0,0 +1,98 @@
+# SPDX-License-Identifier: Apache-2.0
+# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
+import torch
+from torch.nn.parameter import Parameter
+
+from vllm.model_executor.custom_op import PluggableLayer
+from vllm.model_executor.layers.linear import ReplicatedLinear
+from vllm.pla... | vllm/model_executor/layers/fused_moe/router/gate_linear.py | 26 | Python | 0.857 | suggestion | 214 | 51 | 51 | false | [Performance] Cublas Bf16 Gate with Fp32 Output | 35,121 | vllm-project/vllm | 71,895 | Python | mgoin | roikoren755 |
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
import torch
from torch.nn.parameter import Parameter
from vllm.model_executor.custom_op import PluggableLayer
from vllm.model_executor.layers.linear import ReplicatedLinear
from vllm.platforms import current_pla... | If this is going to run across all batch sizes and CUDA arches, can we validate with some performance sweeps? I don't want this to potentially break some consumer GPUs like sm80 or sm121 |
if (
not self.allow_cublas_router_gemm
and self.allow_specialized_router_gemm
and out_dtype == torch.float32
):
self.allow_cublas_router_gemm = self.weight.dtype == torch.bfloat16
def forward(
self, x: torch.Tensor
) -> torch.Tensor | tup... | @@ -0,0 +1,98 @@
+# SPDX-License-Identifier: Apache-2.0
+# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
+import torch
+from torch.nn.parameter import Parameter
+
+from vllm.model_executor.custom_op import PluggableLayer
+from vllm.model_executor.layers.linear import ReplicatedLinear
+from vllm.pla... | vllm/model_executor/layers/fused_moe/router/gate_linear.py | 26 | Python | 0.571 | performance | 186 | 99 | 35 | false | [Performance] Cublas Bf16 Gate with Fp32 Output | 35,121 | vllm-project/vllm | 71,895 | Python | mgoin | roikoren755 |
def profile(self, is_start: bool = True, profile_prefix: str | None = None):
# Check if profiling is enabled
if self.profiler_config is None or self.profiler_config.profiler is None:
raise RuntimeError(
"Profiling is not enabled. Please set --profiler-config to enable "
... | This is just fixing some unrelated linting errors. | def profile(self, is_start: bool = True, profile_prefix: str | None = None):
# Check if profiling is enabled
if self.profiler_config is None or self.profiler_config.profiler is None:
raise RuntimeError(
"Profiling is not enabled. Please set --profiler-config to enable "
... | @@ -744,7 +748,8 @@ def profile(self, is_start: bool = True, profile_prefix: str | None = None):
# Create the profiler wrapper only on the first start call
if self.profiler is None:
- if self.profiler_config.profiler == "torch":
+ profiler_type = self.profiler_c... | vllm/v1/worker/gpu_worker.py | 26 | Python | 0.429 | style | 50 | 51 | 51 | false | [Model Runner V2] Warmup kernels | 35,172 | vllm-project/vllm | 71,895 | Python | njhill | njhill |
from vllm.utils.flashinfer import has_flashinfer
return (
cfg.parallel_config.tensor_parallel_size > 1
and current_platform.is_cuda()
and has_flashinfer()
and (
current_platform.is_device_capability(100)
or current_platform.is_device_capability(90)
... | So are you guys using inductor graph partition on rocm by default? Otherwise we should also return true here I'd dynamo partition and kv cache op not in splitting ops | from vllm.utils.flashinfer import has_flashinfer
return (
cfg.parallel_config.tensor_parallel_size > 1
and current_platform.is_cuda()
and has_flashinfer()
and (
current_platform.is_device_capability(100)
or current_platform.is_device_capability(90)
... | @@ -126,14 +126,27 @@ def enable_allreduce_rms_fusion(cfg: "VllmConfig") -> bool:
)
+def enable_rope_kvcache_fusion(cfg: "VllmConfig") -> bool:
+ """Enable if rotary embedding custom op is active and
+ use_inductor_graph_partition is enabled.
+ """
+ from vllm._aiter_ops import rocm_aiter_ops
+
+ ... | vllm/config/vllm.py | 26 | Python | 0.5 | performance | 166 | 51 | 51 | false | [ROCm]: Enable customop and rope+kvcache fusion for AITER RoPE | 35,180 | vllm-project/vllm | 71,895 | Python | ProExpertProg | Rohan138 |
def test_extract_allowed_tools_filters_non_mcp(self):
"""Test that non-MCP tools are ignored during extraction."""
tools = [
Mcp(
type="mcp",
server_label="server1",
allowed_tools=["tool1"],
),
LocalShell(type="loca... | can you make this an E2E test in test_simple.py instead? similar to how we use pairs_of_event_types in test_streaming_types inside test_harmony.py. this way harmony / simpleContext have consistent testing logic | server_label="server2",
allowed_tools=["tool2"],
),
]
result = _extract_allowed_tools_from_mcp_requests(tools)
# Non-MCP tools should be ignored
assert result == {
"server1": ["tool1"],
"server2": ["tool2"],
}
... | @@ -439,3 +454,141 @@ def test_extract_allowed_tools_filters_non_mcp(self):
"server1": ["tool1"],
"server2": ["tool2"],
}
+
+
+@pytest.mark.asyncio
+async def test_simple_streaming_emits_reasoning_part_events(monkeypatch): | tests/entrypoints/openai/test_serving_responses.py | 26 | Python | 0.857 | suggestion | 210 | 51 | 51 | false | [Bugfix] Emit reasoning_part events in simple streaming path for Resp… | 35,184 | vllm-project/vllm | 71,895 | Python | qandrew | daniel-salib |
torch::Tensor& output_sf,
torch::Tensor& input, // [..., 2 * d]
torch::Tensor& input_sf) {
int32_t m = input.size(0);
int32_t n = input.size(1) / 2;
TORCH_CHECK(n % 16 == 0, "The N dimension must be mu... | I think this name is misleading now, it should be `num_packed_cols` like in `nvfp4_quant_kernels.cu`, right? |
void silu_and_mul_nvfp4_quant_sm1xxa(torch::Tensor& output, // [..., d]
torch::Tensor& output_sf,
torch::Tensor& input, // [..., 2 * d]
torch::Tensor& input_sf) {
int32_t m = input.size(0);
int32_t n = ... | @@ -140,7 +142,7 @@ void silu_and_mul_nvfp4_quant_sm1xxa(torch::Tensor& output, // [..., d]
int const numBlocksPerSM =
vllm_runtime_blocks_per_sm(static_cast<int>(block.x));
- int sf_n_unpadded = int(n / CVT_FP4_SF_VEC_SIZE);
+ int sf_n_unpadded = int(n / CVT_FP4_ELTS_PER_THREAD); | csrc/quantization/fp4/activation_nvfp4_quant_fusion_kernels.cu | 26 | CUDA | 0.714 | question | 108 | 41 | 43 | false | [BugFix] Fix fp4 quant kernel on CUDA 12.8 | 35,210 | vllm-project/vllm | 71,895 | Python | mgoin | LopezCastroRoberto |
"Please remove the --request-rate argument."
)
if args.ramp_up_start_rps is None or args.ramp_up_end_rps is None:
raise ValueError(
"When using --ramp-up-strategy, both --ramp-up-start-rps and "
"--ramp-up-end-rps must be specified"
... | ```suggestion
parser.add_argument(
"--plot-timeline",
action="store_true",
help="Generate an HTML timeline plot showing request execution. "
"The plot will be saved alongside the results JSON file.",
)
parser.add_argument(
"--timeline-itl-thresholds",
type=fl... | "connecting to servers with self-signed certificates.",
)
parser.add_argument(
"--plot-timeline",
action="store_true",
help="Generate an HTML timeline plot showing request execution. "
"The plot will be saved alongside the results JSON file.",
)
parser.add_argume... | @@ -1534,6 +1534,31 @@ def add_cli_args(parser: argparse.ArgumentParser):
help="Disable SSL certificate verification. Use this option when "
"connecting to servers with self-signed certificates.",
)
+ parser.add_argument(
+ "--plot-timeline",
+ action="store_true",
+ help=... | vllm/benchmarks/serve.py | 26 | Python | 1 | suggestion | 999 | 51 | 51 | false | [Benchmarks] Plot benchmark timeline and requests statistics | 35,220 | vllm-project/vllm | 71,895 | Python | DarkLight1337 | sducouedic |
file_name = os.path.join(args.result_dir, file_name)
# Generate timeline plot if requested
if args.plot_timeline:
try:
from pathlib import Path
from vllm.benchmarks.plot import generate_timeline_plot
# Prepare per-request data for timeline
p... | Can you factor this out into a separate function? | if args.metadata:
for item in args.metadata:
if "=" in item:
kvstring = item.split("=", 1)
result_json[kvstring[0].strip()] = kvstring[1].strip()
else:
raise ValueError(
"Invalid metadata format. Please use KEY=VALUE... | @@ -1770,6 +1795,119 @@ async def main_async(args: argparse.Namespace) -> dict[str, Any]:
# Merge with benchmark result
result_json = {**result_json, **benchmark_result}
+ # Compute file_name once before using it for plots or saving results | vllm/benchmarks/serve.py | 26 | Python | 0.071 | question | 49 | 51 | 51 | false | [Benchmarks] Plot benchmark timeline and requests statistics | 35,220 | vllm-project/vllm | 71,895 | Python | DarkLight1337 | sducouedic |
timeline_path = Path(file_name).with_suffix(".timeline.html")
# Convert thresholds from milliseconds to seconds
itl_thresholds_sec = [t / 1000.0 for t in args.timeline_itl_thresholds]
generate_timeline_plot(
per_request_data, timeline_... | Move `pathlib` import to global level | timeline_path = Path(file_name).with_suffix(".timeline.html")
# Convert thresholds from milliseconds to seconds
itl_thresholds_sec = [t / 1000.0 for t in args.timeline_itl_thresholds]
generate_timeline_plot(
per_request_data, timeline_p... | @@ -1770,6 +1837,102 @@ async def main_async(args: argparse.Namespace) -> dict[str, Any]:
# Merge with benchmark result
result_json = {**result_json, **benchmark_result}
+ # Compute file_name once before using it for plots or saving results
+ file_name = compute_result_filename(args, model_id, label, ... | vllm/benchmarks/serve.py | 26 | Python | 0.5 | suggestion | 37 | 51 | 51 | false | [Benchmarks] Plot benchmark timeline and requests statistics | 35,220 | vllm-project/vllm | 71,895 | Python | DarkLight1337 | sducouedic |
from vllm.benchmarks.plot import generate_dataset_stats_plot
# Prepare per-request data for dataset stats
per_request_data = []
input_lens = benchmark_result.get("input_lens", [])
output_lens = benchmark_result.get("output_lens", [])
if input_len... | I think we should just raise the exception outright | per_request_data.append(
{
"prompt_len": req_input_len,
"output_tokens": req_output_len,
}
)
stats_path = Path(file_name).with_suffix(".dataset_stats.png")
... | @@ -1770,6 +1837,102 @@ async def main_async(args: argparse.Namespace) -> dict[str, Any]:
# Merge with benchmark result
result_json = {**result_json, **benchmark_result}
+ # Compute file_name once before using it for plots or saving results
+ file_name = compute_result_filename(args, model_id, label, ... | vllm/benchmarks/serve.py | 26 | Python | 0.643 | suggestion | 51 | 51 | 50 | false | [Benchmarks] Plot benchmark timeline and requests statistics | 35,220 | vllm-project/vllm | 71,895 | Python | DarkLight1337 | sducouedic |
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
"""Custom normalization layers."""
import torch
import torch.nn as nn
import torch.nn.functional as F
from vllm._aiter_ops import rocm_aiter_ops
from vllm.model_executor.custom_op import CustomOp
from vllm.model... | Is there a reference implementation I can compare this against? | self.reset_parameters()
def reset_parameters(self):
torch.nn.init.ones_(self.weight)
def forward_native(
self, x: torch.Tensor, z: torch.Tensor | None = None
) -> torch.Tensor:
"""
Native PyTorch implementation of RMS normalization with gating.
Args:
... | @@ -399,6 +399,11 @@ def forward_native(
- norm_before_gate=True: out = norm(x) * silu(z)
- norm_before_gate=False: out = norm(x * silu(z))
"""
+ orig_dtype = x.dtype
+ x = x.float()
+ weight = self.weight.float()
+ z = z.float() if z is not None else None | vllm/model_executor/layers/layernorm.py | 26 | Python | 0.143 | question | 63 | 464 | 51 | false | [Bugfix] Fix dtype mismatch in RMSNormGated.forward_native() during torch.compile | 35,256 | vllm-project/vllm | 71,895 | Python | zou3519 | haosdent |
if "Llama-4-Scout" in model_setup[1] and attn_backend == "FLASH_ATTN":
if current_platform.is_rocm():
print(
"FLASH_ATTN for spec_decode not supported on "
"ROCm currently. Changing to FLEX_ATTENTION backend."
)
attention_config = {"backend... | @AndreasKaratzas iirc the `ROCM_AITER_MLA` supports MTP as well. Is it possible we use `ROCM_AITER_MLA` instead since this code path is AITER path (`if attn_backend == "ROCM_AITER_FA"`)? | ),
],
ids=["deepseek_eagle"],
)
@pytest.mark.parametrize("attn_backend", get_attn_backend_list_based_on_platform())
def test_eagle_correctness_light(
monkeypatch: pytest.MonkeyPatch,
sampling_config: SamplingParams,
model_setup: tuple[str, str, str, int],
mm_enabled: bool,
expected_a... | @@ -489,7 +493,9 @@ def test_eagle_correctness(
if attn_backend == "ROCM_AITER_FA" and current_platform.is_rocm():
if "deepseek" in model_setup[1].lower():
- pytest.skip("ROCM_AITER_FA for deepseek not supported on ROCm platform")
+ m.setenv("VLLM_ROCM_USE_AITER", "... | tests/v1/e2e/test_spec_decode.py | 26 | Python | 0.714 | question | 186 | 51 | 51 | false | [ROCm][CI] Extending attention backend coverage for Eagle spec decode tests | 35,265 | vllm-project/vllm | 71,895 | Python | tjtanaa | AndreasKaratzas |
flush=True,
)
print("--> Installing from cache, skipping all source builds.", flush=True)
install_command = [sys.executable, "-m", "pip", "install", cached_wheel]
run_command(install_command)
print("\n--- Installation from cache complete. ---", flush=True)
ret... | I feel this file should not only for xpu. we'd better make this commit a env var. | flush=True,
)
print("--> Installing from cache, skipping all source builds.", flush=True)
install_command = [sys.executable, "-m", "pip", "install", cached_wheel]
run_command(install_command)
print("\n--- Installation from cache complete. ---", flush=True)
ret... | @@ -139,7 +139,8 @@ def build_and_install_prerequisites(args):
if not os.path.exists(UCX_DIR):
run_command(["git", "clone", UCX_REPO_URL, UCX_DIR])
ucx_source_path = os.path.abspath(UCX_DIR)
- run_command(["git", "checkout", "v1.19.x"], cwd=ucx_source_path)
+ # Pin UCX to commit e5d9887 for XPU... | tools/install_nixl_from_source_ubuntu.py | 26 | Python | 0.357 | suggestion | 82 | 51 | 51 | false | [XPU][NIXL] Add GPUDirect RDMA support for XPU | 35,270 | vllm-project/vllm | 71,895 | Python | jikunshang | zhenwei-intel |
@classmethod
def support_hybrid_kv_cache(cls) -> bool:
return True
@classmethod
def support_static_graph_mode(cls) -> bool:
return False
@classmethod
def is_pin_memory_available(cls):
return True
@classmethod
def get_current_memory_usage(
cls, device: ... | a minor concern is will this setting done before ucx initiliaztion? I think answer is yes since it works. | compilation_config.mode = CompilationMode.NONE
# check and update parallel config
parallel_config = vllm_config.parallel_config
# Only override worker_cls if it's still the default "auto"
# This allows custom workers (like vllm-omni workers) to be used on XPU
if paral... | @@ -224,13 +195,19 @@ def check_and_update_config(cls, vllm_config: VllmConfig) -> None:
vllm_config.scheduler_config.DEFAULT_MAX_NUM_BATCHED_TOKENS,
)
+ # In some cases, the internal memory type cache can misdetect GPU
+ # memory as host memory, also leading to invalid mem... | vllm/platforms/xpu.py | 26 | Python | 0.286 | nitpick | 105 | 51 | 51 | false | [XPU][NIXL] Add GPUDirect RDMA support for XPU | 35,270 | vllm-project/vllm | 71,895 | Python | jikunshang | zhenwei-intel |
self.host_xfer_buffers: dict[str, torch.Tensor] = {}
if self.device_type == "cpu":
self.use_host_buffer = False
else:
self.use_host_buffer = self.kv_buffer_device == "cpu"
# reserve different cores for start_load_kv() from model_forward()
if self.device_t... | You can use current_platform.get_nixl_memory_type() by `impl xpu.py::get_nixl_memory_type()`
So you don't need to update line 951. | self.host_xfer_buffers: dict[str, torch.Tensor] = {}
if self.device_type == "cpu":
self.use_host_buffer = False
else:
self.use_host_buffer = self.kv_buffer_device == "cpu"
# reserve different cores for start_load_kv() from model_forward()
if self.device_t... | @@ -945,10 +948,7 @@ def __init__(self, vllm_config: VllmConfig, engine_id: str):
# type based on kv_buffer_device
nixl_memory_type = current_platform.get_nixl_memory_type()
if nixl_memory_type is None:
- if self.kv_buffer_device == "cuda":
- nixl_memory_type = "VRAM... | vllm/distributed/kv_transfer/kv_connector/v1/nixl_connector.py | 26 | Python | 1 | suggestion | 130 | 51 | 51 | false | [XPU][NIXL] Add GPUDirect RDMA support for XPU | 35,270 | vllm-project/vllm | 71,895 | Python | xuechendi | zhenwei-intel |
self.host_xfer_buffers: dict[str, torch.Tensor] = {}
if self.device_type == "cpu":
self.use_host_buffer = False
else:
self.use_host_buffer = self.kv_buffer_device == "cpu"
# reserve different cores for start_load_kv() from model_forward()
if self.device_t... | mm I guess that's ok if you wanna use xpu instead of cuda.. although at this point I could really just define a buffer and as long as it's not "cpu" whatever string will map to VRAM..
eg "xpu": ("cpu", "pippo"),
would have the same semantics | self.host_xfer_buffers: dict[str, torch.Tensor] = {}
if self.device_type == "cpu":
self.use_host_buffer = False
else:
self.use_host_buffer = self.kv_buffer_device == "cpu"
# reserve different cores for start_load_kv() from model_forward()
if self.device_t... | @@ -945,10 +948,7 @@ def __init__(self, vllm_config: VllmConfig, engine_id: str):
# type based on kv_buffer_device
nixl_memory_type = current_platform.get_nixl_memory_type()
if nixl_memory_type is None:
- if self.kv_buffer_device == "cuda":
- nixl_memory_type = "VRAM... | vllm/distributed/kv_transfer/kv_connector/v1/nixl_connector.py | 26 | Python | 0.571 | suggestion | 242 | 51 | 51 | false | [XPU][NIXL] Add GPUDirect RDMA support for XPU | 35,270 | vllm-project/vllm | 71,895 | Python | NickLucche | zhenwei-intel |
slot_mapping,
quant_block_size,
scale_fmt,
)
topk_indices_buffer[: hidden_states.shape[0]] = -1
if has_prefill:
prefill_metadata = attn_metadata.prefill
# Get the full shared workspace buffers once (will allocate on first use)
workspace_manager = current_wor... | I think use is_deep_gemm_supported is better, because has_deep_gemm would be true if the package is installed, even if sm80 does not support gemm. | quant_block_size,
scale_fmt,
)
topk_indices_buffer[: hidden_states.shape[0]] = -1
if has_prefill:
prefill_metadata = attn_metadata.prefill
# Get the full shared workspace buffers once (will allocate on first use)
workspace_manager = current_workspace_manager()
... | @@ -102,15 +108,23 @@ def sparse_attn_indexer(
chunk.block_table,
chunk.cu_seq_lens,
)
-
- logits = fp8_mqa_logits(
- q_fp8[chunk.token_start : chunk.token_end],
- (k_fp8, k_scale.view(torch.float32).flatten()),
- wei... | vllm/model_executor/layers/sparse_attn_indexer.py | 26 | Python | 0.5 | suggestion | 146 | 51 | 51 | false | [Feat] Add CUDA torch fallbacks for fp8_mqa_logits/fp8_paged_mqa_logits_torch function | 35,271 | vllm-project/vllm | 71,895 | Python | haosdent | chaunceyjiang |
`custom_ops` in `CompilationConfig` to enable the platform specific path.
"""
def __init__(
self,
k_cache,
quant_block_size: int,
scale_fmt: str,
topk_tokens: int,
head_dim: int,
max_model_len: int,
max_total_seq_len: int,
topk_indices... | Should we update the warning as well? Because in A100, even deep_gemm is installed, it would not work. | `custom_ops` in `CompilationConfig` to enable the platform specific path.
"""
def __init__(
self,
k_cache,
quant_block_size: int,
scale_fmt: str,
topk_tokens: int,
head_dim: int,
max_model_len: int,
max_total_seq_len: int,
topk_indices... | @@ -278,9 +299,11 @@ def __init__(
self.max_model_len = max_model_len
self.max_total_seq_len = max_total_seq_len
self.topk_indices_buffer = topk_indices_buffer
- if current_platform.is_cuda() and not has_deep_gemm():
- raise RuntimeError(
- "Sparse Attention I... | vllm/model_executor/layers/sparse_attn_indexer.py | 26 | Python | 0.5 | question | 102 | 51 | 51 | false | [Feat] Add CUDA torch fallbacks for fp8_mqa_logits/fp8_paged_mqa_logits_torch function | 35,271 | vllm-project/vllm | 71,895 | Python | haosdent | chaunceyjiang |
"""Compute FP8 MQA logits for a single sequence without KV paging (CUDA fallback).
This is a pure PyTorch fallback for CUDA when DeepGEMM is not available.
Args:
q: Query tensor of shape [M, H, D]. Casted to
`torch.float8_e4m3fn` by caller.
kv: Tuple `(k_fp8, k_scales)` where `... | May use `device=q.device` instead of `device="cuda"` | """Compute FP8 MQA logits for a single sequence without KV paging (CUDA fallback).
This is a pure PyTorch fallback for CUDA when DeepGEMM is not available.
Args:
q: Query tensor of shape [M, H, D]. Casted to
`torch.float8_e4m3fn` by caller.
kv: Tuple `(k_fp8, k_scales)` where `... | @@ -418,14 +418,135 @@ def should_use_deepgemm_for_fp8_linear(
)
+def fp8_mqa_logits_torch(
+ q: torch.Tensor,
+ kv: tuple[torch.Tensor, torch.Tensor],
+ weights: torch.Tensor,
+ cu_seqlen_ks: torch.Tensor,
+ cu_seqlen_ke: torch.Tensor,
+) -> torch.Tensor:
+ """Compute FP8 MQA logits for a si... | vllm/utils/deep_gemm.py | 26 | Python | 0.571 | suggestion | 52 | 51 | 51 | false | [Feat] Add CUDA torch fallbacks for fp8_mqa_logits/fp8_paged_mqa_logits_torch function | 35,271 | vllm-project/vllm | 71,895 | Python | haosdent | chaunceyjiang |
)
]
)
result = OpenAIServingChat._create_remaining_args_delta(
original_delta, '{"data": "value"}', 0
)
assert len(result.tool_calls) == 1
tc = result.tool_calls[0]
assert tc.index == 0
assert tc.id == "call_nofunc"
... | Can we just use the same server as the existing one in this file? | # SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
import asyncio
from contextlib import suppress
from dataclasses import dataclass, field
from typing import Any
from unittest.mock import AsyncMock, MagicMock
import pytest
import pytest_asyncio
from openai import... | @@ -1872,3 +1872,231 @@ def test_function_is_none(self):
assert tc.type == "function"
assert tc.function.name is None
assert tc.function.arguments == '{"data": "value"}'
+
+
+# Test n parameter for chat completions
+# Tests that the n parameter works correctly for regular sampling
+# (non-bea... | tests/entrypoints/openai/test_serving_chat.py | 26 | Python | 0.357 | question | 65 | 51 | 1,875 | false | [Test] Add tests for n parameter in chat completions API | 35,283 | vllm-project/vllm | 71,895 | Python | DarkLight1337 | KrxGu |
"""Test that n parameter is correctly passed to SamplingParams."""
from vllm.entrypoints.openai.chat_completion.protocol import (
ChatCompletionRequest,
)
from vllm.sampling_params import SamplingParams
# Test with n=3
request = ChatCompletionRequest(
model="test-model",
... | Can you move these imports to the top? | """Test that n parameter is correctly passed to SamplingParams."""
# Test with n=3
request = ChatCompletionRequest(
model="test-model",
messages=[{"role": "user", "content": "Hello"}],
n=3,
max_tokens=10,
)
sampling_params = request.to_sampling_params(
max_to... | @@ -815,3 +815,222 @@ async def test_invocations(server: RemoteOpenAIServer, client: openai.AsyncOpenA
assert chat_output.keys() == invocation_output.keys()
assert chat_output["choices"] == invocation_output["choices"]
+
+
+# Test n parameter for chat completions
+# Tests that the n parameter works correctl... | tests/entrypoints/openai/test_chat.py | 26 | Python | 0.286 | question | 38 | 51 | 51 | false | [Test] Add tests for n parameter in chat completions API | 35,283 | vllm-project/vllm | 71,895 | Python | DarkLight1337 | KrxGu |
*,
image_width: int,
image_height: int,
image_processor: BaseImageProcessor,
mm_kwargs: Mapping[str, object],
) -> int:
hf_config = self.get_hf_config()
vision_config = hf_config.vision_config
patch_size = vision_config.patch_size
merge_size = ... | Based on the logic above, the keys in the `size` dictionary are updated as `shortest_edge` and `longest_edge`. So we should access them accordingly here:
```
min_pixels=size["shortest_edge"],
max_pixels=size["longest_edge"],
``` | *,
image_width: int,
image_height: int,
image_processor: BaseImageProcessor,
mm_kwargs: Mapping[str, object],
) -> int:
hf_config = self.get_hf_config()
vision_config = hf_config.vision_config
patch_size = vision_config.patch_size
merge_size = ... | vllm/model_executor/models/paddleocr_vl.py | 26 | Python | 1 | suggestion | 228 | 51 | 51 | false | [Misc] Standardize handling of `mm_processor_kwargs.size` | 35,284 | vllm-project/vllm | 71,895 | Python | zhang-prog | DarkLight1337 | |
self,
*,
image_width: int,
image_height: int,
image_processor: BaseImageProcessor,
mm_kwargs: Mapping[str, object],
) -> int:
hf_config = self.get_hf_config()
vision_config = hf_config.vision_config
patch_size = vision_config.patch_size
... | `min_pixels` -> `shortest_edge`, or else it has no effect. | self,
*,
image_width: int,
image_height: int,
image_processor: BaseImageProcessor,
mm_kwargs: Mapping[str, object],
) -> int:
hf_config = self.get_hf_config()
vision_config = hf_config.vision_config
patch_size = vision_config.patch_size
... | @@ -156,7 +156,13 @@ def get_num_image_tokens(
merge_size = vision_config.spatial_merge_size
mm_kwargs = self.ctx.get_merged_mm_kwargs(mm_kwargs)
- size = mm_kwargs.get("size", image_processor.size)
+ size = image_processor.size
+ if override_size := mm_kwargs.get("size"):
+ ... | vllm/model_executor/models/paddleocr_vl.py | 26 | Python | 0.357 | suggestion | 59 | 51 | 51 | false | [Misc] Standardize handling of `mm_processor_kwargs.size` | 35,284 | vllm-project/vllm | 71,895 | Python | zhang-prog | DarkLight1337 |
image_width: int,
image_height: int,
image_processor: BaseImageProcessor,
mm_kwargs: Mapping[str, object],
) -> int:
hf_config = self.get_hf_config()
vision_config = hf_config.vision_config
patch_size = vision_config.patch_size
merge_size = vision_conf... | same, `max_pixels` -> `longest_edge` | image_width: int,
image_height: int,
image_processor: BaseImageProcessor,
mm_kwargs: Mapping[str, object],
) -> int:
hf_config = self.get_hf_config()
vision_config = hf_config.vision_config
patch_size = vision_config.patch_size
merge_size = vision_conf... | @@ -156,7 +156,13 @@ def get_num_image_tokens(
merge_size = vision_config.spatial_merge_size
mm_kwargs = self.ctx.get_merged_mm_kwargs(mm_kwargs)
- size = mm_kwargs.get("size", image_processor.size)
+ size = image_processor.size
+ if override_size := mm_kwargs.get("size"):
+ ... | vllm/model_executor/models/paddleocr_vl.py | 26 | Python | 0.286 | suggestion | 36 | 51 | 51 | false | [Misc] Standardize handling of `mm_processor_kwargs.size` | 35,284 | vllm-project/vllm | 71,895 | Python | zhang-prog | DarkLight1337 |
*,
image_width: int,
image_height: int,
image_processor: BaseImageProcessor,
mm_kwargs: Mapping[str, object],
) -> int:
hf_config = self.get_hf_config()
vision_config = hf_config.vision_config
patch_size = vision_config.patch_size
merge_size = ... | maybe it can works and pass the v4 tests:
```suggestion
if (override_min_pixels := mm_kwargs.get("shortest_edge")) is not None:
size = size | {"min_pixels": override_min_pixels}
if (override_max_pixels := mm_kwargs.get("longest_edge")) is not None:
size = size | {"max_pixe... | *,
image_width: int,
image_height: int,
image_processor: BaseImageProcessor,
mm_kwargs: Mapping[str, object],
) -> int:
hf_config = self.get_hf_config()
vision_config = hf_config.vision_config
patch_size = vision_config.patch_size
merge_size = ... | @@ -156,14 +156,20 @@ def get_num_image_tokens(
merge_size = vision_config.spatial_merge_size
mm_kwargs = self.ctx.get_merged_mm_kwargs(mm_kwargs)
- size = mm_kwargs.get("size", image_processor.size)
+ size = image_processor.size
+ if override_size := mm_kwargs.get("size"):
+ ... | vllm/model_executor/models/paddleocr_vl.py | 26 | Python | 1 | suggestion | 606 | 51 | 51 | false | [Misc] Standardize handling of `mm_processor_kwargs.size` | 35,284 | vllm-project/vllm | 71,895 | Python | zhang-prog | DarkLight1337 |
from vllm.assets.image import ImageAsset
from vllm.lora.request import LoRARequest
from vllm.sampling_params import BeamSearchParams
@dataclass
class TestConfig:
model_path: str
lora_path: str
max_num_seqs: int = 2
max_loras: int = 2
max_lora_rank: int = 32
enable_tower_connector_lora: bool = ... | Was there a PR in 5.2 which changed these names or have the names been changed since 5.0? | from transformers import __version__ as TRANSFORMERS_VERSION
import vllm
from vllm.assets.image import ImageAsset
from vllm.lora.request import LoRARequest
from vllm.sampling_params import BeamSearchParams
@dataclass
class TestConfig:
model_path: str
lora_path: str
max_num_seqs: int = 2
max_loras: in... | @@ -18,15 +21,25 @@ class TestConfig:
enable_tower_connector_lora: bool = False
max_model_len: int = 8192
gpu_memory_utilization: float = 0.85
- mm_processor_kwargs: dict[str, int] | None = None
+ mm_processor_kwargs: dict[str, object] | None = None
mm_processor_cache_gb: float = 4
def ... | tests/lora/test_qwenvl.py | 26 | Python | 0.357 | question | 89 | 51 | 51 | false | [Misc] Standardize handling of `mm_processor_kwargs.size` | 35,284 | vllm-project/vllm | 71,895 | Python | hmellor | DarkLight1337 |
input_dim=1,
output_dim=0,
weight_loader=patched_weight_loader,
)
_copy_missing_attrs(layer.weight, weight)
layer.register_parameter("weight", weight)
del layer._load_device
# refresh... | Can you add a FIXME here to note that this part should be reverted after `weight_loader` supports tuple shard_id? | input_dim=1,
output_dim=0,
weight_loader=patched_weight_loader,
)
_copy_missing_attrs(layer.weight, weight)
layer.register_parameter("weight", weight)
del layer._load_device
# refresh... | @@ -569,10 +569,23 @@ def patched_weight_loader(param, loaded_weight, *args, **kwargs):
# materialization
param = layer.weight
- # load the current weight chunk
+ # Shard id with multiple indices (tuple) is only supported by
+ # weight_loader_v2; use it so we... | vllm/model_executor/layers/quantization/fp8.py | 26 | Python | 0.714 | question | 113 | 51 | 51 | false | [Bugfix] [Qwen3.5]Fix Qwen3.5 FP8 quantization: tuple shard_id weight loading | 35,289 | vllm-project/vllm | 71,895 | Python | Isotr0py | Alibaba-HZY |
shard_size=shard_size, shard_offset=shard_offset
)
loaded_weight_shard = loaded_weight.narrow(
param.output_dim, shard_offset, shard_size
)
self.weight_loader_v2(param, loaded_weight_shard, shard_id)
def weight_loader_v2(
... | Is this change necessary for online quantization fix? I think fp8 online quantization can still work without this change. | current_shard_offset += output_size
for shard_id, shard_offset, shard_size in shard_offsets:
# Special case for Quantization.
# If quantized, we need to adjust the offset and size to account
# for the packing.
if (
isinstance(param, (P... | @@ -924,7 +924,13 @@ def weight_loader_v2(
if isinstance(param, PerTensorScaleParameter):
param.load_merged_column_weight(loaded_weight=loaded_weight, shard_id=0)
return
- elif type(param) in (RowvLLMParameter, BasevLLMParameter):
+ # For tuple shard_... | vllm/model_executor/layers/linear.py | 26 | Python | 0.5 | question | 121 | 51 | 51 | false | [Bugfix] [Qwen3.5]Fix Qwen3.5 FP8 quantization: tuple shard_id weight loading | 35,289 | vllm-project/vllm | 71,895 | Python | Isotr0py | Alibaba-HZY |
if aux_hidden_states:
assert self.method == "eagle3"
hidden_states = self.model.combine_hidden_states(
torch.cat(aux_hidden_states, dim=-1)
)
else:
hidden_states = last_hidden_states
num_tokens = input_batch.num_tokens_after_padding... | I'm curious, why is it necessary to set `num_tokens_across_dp` if it's None here. Wouldn't it being None mean that DP=1, and `make_num_tokens_across_dp` would just return None again? | if aux_hidden_states:
assert self.method == "eagle3"
hidden_states = self.model.combine_hidden_states(
torch.cat(aux_hidden_states, dim=-1)
)
else:
hidden_states = last_hidden_states
num_tokens = input_batch.num_tokens_after_padding... | @@ -229,11 +241,15 @@ def propose(
# Prefill: Run the eagle speculator with eager mode.
# TODO(woosuk): Support CUDA graph for prefill.
+ if num_tokens_across_dp is None:
+ num_tokens_across_dp = make_num_tokens_across_dp(
+ self.dp_size, num_tokens, self.dp_rank, ne... | vllm/v1/worker/gpu/spec_decode/eagle/speculator.py | 26 | Python | 0.5 | question | 182 | 51 | 51 | false | [Model Runner V2] support dp & ep for spec decoding | 35,294 | vllm-project/vllm | 71,895 | Python | TheEpicDolphin | izhuhaoran |
#!/bin/bash
# This script build the CPU docker image and run the offline inference inside the container.
# It serves a sanity check for compilation and basic model usage.
set -exuo pipefail
# Try building the docker image
image_name="hpu/upstream-vllm-ci:${BUILDKITE_COMMIT}"
container_name="hpu-upstream-vllm-ci-${BUI... | This file doesn't seem to exist | #!/bin/bash
# This script builds the HPU docker image and runs the offline inference inside the container.
# It serves a sanity check for compilation and basic model usage.
#
# vllm-gaudi compatibility pinning:
# The vllm-gaudi plugin is installed on top of the vllm upstream checkout used by this CI job.
# When up... | @@ -1,9 +1,27 @@
#!/bin/bash
-# This script build the CPU docker image and run the offline inference inside the container.
+# This script builds the HPU docker image and runs the offline inference inside the container.
# It serves a sanity check for compilation and basic model usage.
+#
+# vllm-gaudi compatibility ... | .buildkite/scripts/hardware_ci/run-hpu-test.sh | 20 | Shell | 0.071 | suggestion | 31 | 45 | 45 | false | [CI][HPU] Pin vllm commit compatible with vllm-gaudi - HPU tests | 35,307 | vllm-project/vllm | 71,895 | Python | DarkLight1337 | PatrykWo |
token_scores = torch.matmul(q_emb, d_emb.T)
# Max over document tokens, sum over query tokens
return token_scores.amax(dim=-1).sum()
class ScoreMultiModalParam(TypedDict, total=False):
"""
A specialized parameter type for scoring multimodal content
The reasons why don't reuse `CustomChatCompl... | I don't think you should be using `torch.cuda.is_available()` directly. You should use `current_platform.is_cuda()` at least | token_scores = torch.matmul(q_emb, d_emb.T)
# Max over document tokens, sum over query tokens
return token_scores.amax(dim=-1).sum()
def compute_maxsim_scores(
q_embs: Sequence[torch.Tensor],
d_embs: Sequence[torch.Tensor],
max_batch_size: int = 16,
max_score_matrix_elements: int = 16_000_... | @@ -53,6 +53,82 @@ def compute_maxsim_score(q_emb: torch.Tensor, d_emb: torch.Tensor) -> torch.Tens
return token_scores.amax(dim=-1).sum()
+def compute_maxsim_scores(
+ q_embs: Sequence[torch.Tensor],
+ d_embs: Sequence[torch.Tensor],
+ max_batch_size: int = 16,
+ max_score_matrix_elements: int = 1... | vllm/entrypoints/pooling/score/utils.py | 26 | Python | 0.714 | suggestion | 124 | 51 | 51 | false | [Perf] Optimize maxsim scores computation for pooling models, 13.9% E2E throughput improvement | 35,330 | vllm-project/vllm | 71,895 | Python | mgoin | yewentao256 |
# select and check capture function
assert capture_cg_mode in [CUDAGraphMode.PIECEWISE, CUDAGraphMode.FULL], (
f"Invalid capture_cudagraph_mode for capture: {capture_cg_mode}"
)
if capture_cg_mode == CUDAGraphMode.PIECEWISE:
capture_fn = self._capture_piecewise_gr... | possible alternative
```suggestion
**model_state.prepare_dummy_inputs(num_reqs, num_tokens),
}
``` | # select and check capture function
assert capture_cg_mode in [CUDAGraphMode.PIECEWISE, CUDAGraphMode.FULL], (
f"Invalid capture_cudagraph_mode for capture: {capture_cg_mode}"
)
if capture_cg_mode == CUDAGraphMode.PIECEWISE:
capture_fn = self._capture_piecewise_gr... | @@ -113,13 +112,17 @@ def capture_graph(
)
else:
num_reqs = min(num_tokens, self.max_num_reqs)
- input_ids = input_buffers.input_ids[:num_tokens]
- positions = input_buffers.positions[:num_tokens]
- if self.uses_mrope:
- assert mrope_positions is not No... | vllm/v1/worker/gpu/cudagraph_utils.py | 26 | Python | 1 | suggestion | 118 | 51 | 51 | false | [Model Runner V2] Add model states [1/N] | 35,350 | vllm-project/vllm | 71,895 | Python | njhill | WoosukKwon |
input_batch.inputs_embeds = inputs_embeds[
: input_batch.num_tokens_after_padding
]
else:
# No actual tokens to run. A dummy run for DP or memory profiling.
num_reqs = min(num_tokens_after_padding, self.max_num_reqs)
input_b... | Again just a simplification suggestion
```suggestion
model_inputs = {
"input_ids": input_batch.input_ids,
"positions": input_batch.positions,
"inputs_embeds": input_batch.inputs_embeds,
# Values returned by prepare_inputs will override the above defaults.
... | )
inputs_embeds = self.encoder_runner.get_inputs_embeds(
self.model, input_batch.input_ids, mm_embeds, is_mm_embed
)
input_batch.inputs_embeds = inputs_embeds[
: input_batch.num_tokens_after_padding
]... | @@ -955,14 +924,26 @@ def execute_model(
input_buffers=self.input_buffers,
device=self.device,
)
- if self.uses_mrope:
- input_batch.mrope_positions = self.mrope_states.mrope_positions[
- :, :num_tokens_after_padding
- ... | vllm/v1/worker/gpu/model_runner.py | 26 | Python | 1 | performance | 402 | 51 | 51 | false | [Model Runner V2] Add model states [1/N] | 35,350 | vllm-project/vllm | 71,895 | Python | njhill | WoosukKwon |
model_config=self.vllm_config.model_config,
)
if self.lora_config:
self.model = self.load_lora_model(
self.model, self.vllm_config, self.device
)
if self.use_aux_hidden_state_outputs:
assert self.spe... | Just an idea: Instead of `set_model`, could have model in the `ModelState` constructor and construct it here rather than in model runner constructor. So then init of `ModelState` itself is more atomic/complete. | self.model = model_loader.load_model(
vllm_config=self.vllm_config,
model_config=self.vllm_config.model_config,
)
if self.lora_config:
self.model = self.load_lora_model(
self.model, self.vllm_config, self.device
... | @@ -268,6 +260,8 @@ def load_model(self, *args, **kwargs) -> None:
if self.speculator is not None:
prepare_communication_buffer_for_model(self.speculator)
+ self.model_state.set_model(self.model) | vllm/v1/worker/gpu/model_runner.py | 26 | Python | 0.786 | suggestion | 210 | 51 | 51 | false | [Model Runner V2] Add model states [1/N] | 35,350 | vllm-project/vllm | 71,895 | Python | njhill | WoosukKwon |
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
import torch
import torch.nn as nn
from vllm.config import VllmConfig
from vllm.v1.core.sched.output import NewRequestData
from vllm.v1.worker.gpu.input_batch import InputBatch
from vllm.v1.worker.gpu.mm.mrope_ut... | suggestion: use `self.mrope_states: MRopeState | None` rather than separate bool field? | # SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
import torch
import torch.nn as nn
from vllm.config import VllmConfig
from vllm.v1.core.sched.output import NewRequestData
from vllm.v1.worker.gpu.input_batch import InputBatch
from vllm.v1.worker.gpu.mm.mrope_ut... | @@ -0,0 +1,76 @@
+# SPDX-License-Identifier: Apache-2.0
+# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
+import torch
+import torch.nn as nn
+
+from vllm.config import VllmConfig
+from vllm.v1.core.sched.output import NewRequestData
+from vllm.v1.worker.gpu.input_batch import InputBatch
+from vllm... | vllm/v1/worker/gpu/model_states.py | 26 | Python | 0.571 | question | 87 | 51 | 51 | false | [Model Runner V2] Add model states [1/N] | 35,350 | vllm-project/vllm | 71,895 | Python | njhill | WoosukKwon |
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
import torch
import torch.nn as nn
from vllm.config import VllmConfig
from vllm.v1.core.sched.output import NewRequestData
from vllm.v1.worker.gpu.input_batch import InputBatch
from vllm.v1.worker.gpu.mm.mrope_ut... | nit: naming inconsistency `states` vs `State` | # SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
import torch
import torch.nn as nn
from vllm.config import VllmConfig
from vllm.v1.core.sched.output import NewRequestData
from vllm.v1.worker.gpu.input_batch import InputBatch
from vllm.v1.worker.gpu.mm.mrope_ut... | @@ -0,0 +1,76 @@
+# SPDX-License-Identifier: Apache-2.0
+# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
+import torch
+import torch.nn as nn
+
+from vllm.config import VllmConfig
+from vllm.v1.core.sched.output import NewRequestData
+from vllm.v1.worker.gpu.input_batch import InputBatch
+from vllm... | vllm/v1/worker/gpu/model_states.py | 26 | Python | 0.286 | nitpick | 45 | 51 | 51 | false | [Model Runner V2] Add model states [1/N] | 35,350 | vllm-project/vllm | 71,895 | Python | njhill | WoosukKwon |
input_batch.inputs_embeds = inputs_embeds[
: input_batch.num_tokens_after_padding
]
else:
# No actual tokens to run. A dummy run for DP or memory profiling.
num_reqs = min(num_tokens_after_padding, self.max_num_reqs)
input_b... | do we need both? (above we only check this)
```suggestion
if not skip_attn_for_dummy_run:
``` | )
inputs_embeds = self.encoder_runner.get_inputs_embeds(
self.model, input_batch.input_ids, mm_embeds, is_mm_embed
)
input_batch.inputs_embeds = inputs_embeds[
: input_batch.num_tokens_after_padding
]... | @@ -955,14 +886,45 @@ def execute_model(
input_buffers=self.input_buffers,
device=self.device,
)
- if self.uses_mrope:
- input_batch.mrope_positions = self.mrope_states.mrope_positions[
- :, :num_tokens_after_padding
- ... | vllm/v1/worker/gpu/model_runner.py | 26 | Python | 1 | question | 101 | 51 | 51 | false | [Model Runner V2] Prepare attn metadata in ModelState [2/N] | 35,383 | vllm-project/vllm | 71,895 | Python | njhill | WoosukKwon |
"ModelRunnerOutput",
tuple["SchedulerOutput", "GrammarOutput", "IntermediateTensors"],
]:
# This method is used by Ray Compiled Graph to execute the model,
# and it needs a special logic of self.setup_device_if_necessary()
self.setup_device_if_necessar... | I think this makes sense but we probably want to update the comment here; `mm_features` are not raw images but rather preprocessed multimodal data. | "ModelRunnerOutput",
tuple["SchedulerOutput", "GrammarOutput", "IntermediateTensors"],
]:
# This method is used by Ray Compiled Graph to execute the model,
# and it needs a special logic of self.setup_device_if_necessary()
self.setup_device_if_necessar... | @@ -104,6 +104,15 @@ def execute_model_ray(
scheduler_output, intermediate_tensors
)
if self._is_intermediate_tensors(output):
+ if (
+ self.worker.model_runner.supports_mm_inputs
+ and get_pp_group().is_first_rank
+ ... | vllm/v1/executor/ray_utils.py | 26 | Python | 0.5 | suggestion | 147 | 51 | 51 | false | [Fix] Avoid sending image input to other PP ranks | 35,405 | vllm-project/vllm | 71,895 | Python | ywang96 | emricksini-h |
| tuple["SchedulerOutput", "GrammarOutput", "IntermediateTensors"],
) -> Union[
"ModelRunnerOutput",
tuple["SchedulerOutput", "GrammarOutput", "IntermediateTensors"],
]:
# This method is used by Ray Compiled Graph to execute the model,
# and it... | under what condition would scheduler_output not have `scheduled_new_reqs` attributes? shouldn't that be considered as a divergence from expectation (raise an error) instead of by passing the condition? | | tuple["SchedulerOutput", "GrammarOutput", "IntermediateTensors"],
) -> Union[
"ModelRunnerOutput",
tuple["SchedulerOutput", "GrammarOutput", "IntermediateTensors"],
]:
# This method is used by Ray Compiled Graph to execute the model,
# and it... | @@ -104,6 +104,16 @@ def execute_model_ray(
scheduler_output, intermediate_tensors
)
if self._is_intermediate_tensors(output):
+ if (
+ self.worker.model_runner.supports_mm_inputs
+ and get_pp_group().is_first_rank
+ ... | vllm/v1/executor/ray_utils.py | 26 | Python | 1 | question | 202 | 51 | 51 | false | [Fix] Avoid sending image input to other PP ranks | 35,405 | vllm-project/vllm | 71,895 | Python | kouroshHakha | emricksini-h |
)
tp_size = self.parallel_config.tensor_parallel_size
hidden_size = self.model_config.get_hidden_size()
element_size = self.model_config.dtype.itemsize
pass_config.sp_min_token_num = get_sequence_parallelism_threshold(
... | @ProExpertProg Is this the right part that you wanted removed? | )
tp_size = self.parallel_config.tensor_parallel_size
hidden_size = self.model_config.get_hidden_size()
element_size = self.model_config.dtype.itemsize
pass_config.sp_min_token_num = get_sequence_parallelism_threshold(
... | @@ -880,14 +880,6 @@ def has_blocked_weights():
self.compilation_config.pass_config.enable_sp = False
self.compilation_config.pass_config.fuse_gemm_comms = False
- if self.compilation_config.pass_config.enable_sp:
- if "-rms_norm" in self.compilation_config.... | vllm/config/vllm.py | 26 | Python | 0.357 | question | 63 | 51 | 51 | false | [compile] Cleanup: Remove unnecessary +rms_norm forcing for sequence parallelism | 35,410 | vllm-project/vllm | 71,895 | Python | jasonlizhengjian | jasonlizhengjian |
flatten_bn,
init_vllm_registered_model,
maybe_prefix,
)
from vllm.multimodal import MULTIMODAL_REGISTRY
from vllm.multimodal.inputs import (
MultiModalDataDict,
MultiModalFieldConfig,
MultiModalKwargsItems,
)
from vllm.multimodal.parse import ImageSize, MultiModalDataItems
from vllm.multimodal.p... | Changes in this file seem unrelated | flatten_bn,
init_vllm_registered_model,
maybe_prefix,
)
from vllm.multimodal import MULTIMODAL_REGISTRY
from vllm.multimodal.inputs import (
MultiModalDataDict,
MultiModalFieldConfig,
MultiModalKwargsItems,
)
from vllm.multimodal.parse import ImageSize, MultiModalDataItems
from vllm.multimodal.p... | @@ -43,12 +43,9 @@
from .interfaces import MultiModalEmbeddings, SupportsMultiModal, SupportsPP
IMAGE_TOKEN = "<image>"
-IMAGE_PLACEHOLDER_ID = 151669 | vllm/model_executor/models/ovis2_5.py | 26 | Python | 0.286 | suggestion | 35 | 51 | 51 | false | [Refactor] Remove dead code for attention benchmark script | 35,418 | vllm-project/vllm | 71,895 | Python | MatthewBonanni | yewentao256 |
original_save = cls.save
def _save(
self: Any, *, path: str, format: Literal["binary", "unpacked"] = "binary"
) -> None:
if format != "binary":
return original_save(self, path=path, format=format)
from torch._dynamo.utils import dynamo_timed
from torch._inductor.... | Let's logger.debug this (make it less verbose) | original_save = cls.save
def _save(
self: Any, *, path: str, format: Literal["binary", "unpacked"] = "binary"
) -> None:
if format != "binary":
return original_save(self, path=path, format=format)
from torch._dynamo.utils import dynamo_timed
from torch._inductor.... | @@ -184,6 +184,47 @@ def is_compile_cache_enabled(
)
+def _patch_standalone_compile_atomic_save() -> None:
+ """Backport of pytorch/pytorch#162432 for torch < 2.10.0.
+
+ Patches CompiledArtifact.save() to use write_atomic for binary format,
+ preventing corrupt cache files when multiple processes com... | vllm/compilation/compiler_interface.py | 26 | Python | 0.357 | bug | 46 | 51 | 51 | false | [Bugfix] Add monkeypatch to prevent race condition from writing | 35,420 | vllm-project/vllm | 71,895 | Python | zou3519 | Lucaskabela |
writer.write_bytes(torch_key())
writer.write_str(key)
writer.write_bytes(artifact_bytes)
write_atomic(path, writer.to_bytes())
_save._vllm_patched = True # type: ignore[attr-defined]
cls.save = _save # type: ignore[assignment]
logger.info("Patched %s.save f... | why would this function throw an exception? (I think we'd prefer to not have the try-except) | writer.write_bytes(torch_key())
writer.write_str(key)
writer.write_bytes(artifact_bytes)
write_atomic(path, writer.to_bytes())
_save._vllm_patched = True # type: ignore[attr-defined]
cls.save = _save # type: ignore[assignment]
logger.debug("Patched %s.save ... | @@ -197,6 +238,15 @@ class InductorStandaloneAdaptor(CompilerInterface):
name = "inductor_standalone"
def __init__(self, save_format: Literal["binary", "unpacked"]) -> None:
+ if not is_torch_equal_or_newer("2.10.0"):
+ try:
+ _patch_standalone_compile_atomic_save() | vllm/compilation/compiler_interface.py | 26 | Python | 0.643 | question | 92 | 51 | 51 | false | [Bugfix] Add monkeypatch to prevent race condition from writing | 35,420 | vllm-project/vllm | 71,895 | Python | zou3519 | Lucaskabela |
ChatCompletionContentPartImageParam
| ChatCompletionContentPartImageEmbedsParam
| ChatCompletionContentPartTextParam
| ChatCompletionContentPartVideoParam
)
def compute_maxsim_score(q_emb: torch.Tensor, d_emb: torch.Tensor) -> torch.Tensor:
"""
Compute ColBERT MaxSim score.
Args:
... | ```suggestion
return envs.VLLM_USE_GPU_FOR_POOLING_SCORE and not current_platform.is_cpu()
``` | | ChatCompletionContentPartImageEmbedsParam
| ChatCompletionContentPartTextParam
| ChatCompletionContentPartVideoParam
)
def compute_maxsim_score(q_emb: torch.Tensor, d_emb: torch.Tensor) -> torch.Tensor:
"""
Compute ColBERT MaxSim score.
Args:
q_emb: Query token embeddings [query_len... | @@ -53,6 +55,10 @@ def compute_maxsim_score(q_emb: torch.Tensor, d_emb: torch.Tensor) -> torch.Tens
return token_scores.amax(dim=-1).sum()
+def _should_use_gpu_for_maxsim() -> bool:
+ return envs.VLLM_USE_GPU_FOR_POOLING_SCORE and current_platform.is_cuda() | vllm/entrypoints/pooling/score/utils.py | 26 | Python | 1 | suggestion | 100 | 51 | 51 | false | [Refactor] Fix maxsim cuda platform and add cli to control it | 35,427 | vllm-project/vllm | 71,895 | Python | DarkLight1337 | yewentao256 |
def _should_use_gpu_for_maxsim() -> bool:
return envs.VLLM_USE_GPU_FOR_POOLING_SCORE and current_platform.is_cuda()
def compute_maxsim_scores(
q_embs: Sequence[torch.Tensor],
d_embs: Sequence[torch.Tensor],
max_batch_size: int = 16,
max_score_matrix_elements: int = 16_000_000,
) -> list[torch.Ten... | ```suggestion
compute_device = torch.device(current_platform.device_type if _should_use_gpu_for_maxsim() else "cpu")
```
I don't see why we can't enable this for other platforms as well | def _should_use_gpu_for_maxsim(use_gpu_for_pooling_score: bool) -> bool:
return use_gpu_for_pooling_score and not current_platform.is_cpu()
def compute_maxsim_scores(
q_embs: Sequence[torch.Tensor],
d_embs: Sequence[torch.Tensor],
max_batch_size: int = 16,
max_score_matrix_elements: int = 16_000_0... | @@ -73,7 +79,7 @@ def compute_maxsim_scores(
if q_emb.shape[1] != d_emb.shape[1]:
raise ValueError("Query and document embeddings must have same dim")
- compute_device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
+ compute_device = torch.device("cuda" if _should_use_gpu_f... | vllm/entrypoints/pooling/score/utils.py | 26 | Python | 1 | suggestion | 190 | 51 | 51 | false | [Refactor] Fix maxsim cuda platform and add cli to control it | 35,427 | vllm-project/vllm | 71,895 | Python | DarkLight1337 | yewentao256 |
import functools
import json
import logging
import os
import sys
import tempfile
import uuid
from collections.abc import Callable
from typing import TYPE_CHECKING, Any, Literal
if TYPE_CHECKING:
VLLM_HOST_IP: str = ""
VLLM_PORT: int | None = None
VLLM_RPC_BASE_PATH: str = tempfile.gettempdir()
VLLM_USE... | Make this a config variable in `FrontendArgs`, not env variable | import functools
import json
import logging
import os
import sys
import tempfile
import uuid
from collections.abc import Callable
from typing import TYPE_CHECKING, Any, Literal
if TYPE_CHECKING:
VLLM_HOST_IP: str = ""
VLLM_PORT: int | None = None
VLLM_RPC_BASE_PATH: str = tempfile.gettempdir()
VLLM_USE... | @@ -26,6 +26,7 @@
VLLM_ENGINE_READY_TIMEOUT_S: int = 600
VLLM_API_KEY: str | None = None
VLLM_DEBUG_LOG_API_SERVER_RESPONSE: bool = False
+ VLLM_USE_GPU_FOR_POOLING_SCORE: bool = False | vllm/envs.py | 26 | Python | 0.357 | suggestion | 63 | 51 | 51 | false | [Refactor] Fix maxsim cuda platform and add cli to control it | 35,427 | vllm-project/vllm | 71,895 | Python | DarkLight1337 | yewentao256 |
if len(priority) != num_requests:
raise ValueError(
f"The lengths of prompts ({num_requests}) "
f"and priority ({len(priority)}) must be the same."
)
return priority
return [0] * num_requests
def _add_completi... | No need to repeat this, just remove the unnecessary `zip` | if len(priority) != num_requests:
raise ValueError(
f"The lengths of prompts ({num_requests}) "
f"and priority ({len(priority)}) must be the same."
)
return priority
return [0] * num_requests
def _add_completi... | @@ -1771,13 +1745,7 @@ def _add_completion_requests(
seq_prompts = prompt_to_seq(prompts)
seq_params = self._params_to_seq(params, len(seq_prompts))
seq_lora_requests = self._lora_request_to_seq(lora_request, len(seq_prompts))
- seq_tok_kwargs = [
- merge_kwargs(
- ... | vllm/entrypoints/llm.py | 26 | Python | 0.571 | suggestion | 57 | 51 | 51 | false | [Deprecation] Deprecate code in 0.17 as scheduled | 35,441 | vllm-project/vllm | 71,895 | Python | DarkLight1337 | yewentao256 |
return priority
return [0] * num_requests
def _add_completion_requests(
self,
prompts: PromptType | Sequence[PromptType],
params: SamplingParams
| PoolingParams
| Sequence[SamplingParams | PoolingParams],
*,
use_tqdm: bool | Callable[...,... | ```suggestion
seq_prompts,
use_tqdm=use_tqdm,
desc="Rendering prompts",
```
Nit | return priority
return [0] * num_requests
def _add_completion_requests(
self,
prompts: PromptType | Sequence[PromptType],
params: SamplingParams
| PoolingParams
| Sequence[SamplingParams | PoolingParams],
*,
use_tqdm: bool | Callable[...,... | @@ -1771,23 +1745,13 @@ def _add_completion_requests(
seq_prompts = prompt_to_seq(prompts)
seq_params = self._params_to_seq(params, len(seq_prompts))
seq_lora_requests = self._lora_request_to_seq(lora_request, len(seq_prompts))
- seq_tok_kwargs = [
- merge_kwargs(
- ... | vllm/entrypoints/llm.py | 26 | Python | 1 | suggestion | 140 | 51 | 51 | false | [Deprecation] Deprecate code in 0.17 as scheduled | 35,441 | vllm-project/vllm | 71,895 | Python | DarkLight1337 | yewentao256 |
device=output_token_ids.device,
),
],
dim=1,
)
== -1
)
.int()
.argmax(-1)
)
if self.cache_config.mamba_cache_mode == "align":
for i,... | It's dangerous to write code like this. num_accepted_tokens is a temporary tensor that may be freed after this function call, so the free may happen before the non_blocking copy is ended. |
# Find the number of accepted tokens for each sequence.
num_reqs = output_token_ids.size(0)
self.num_accepted_tokens.gpu[:num_reqs] = (
(
torch.cat(
[
output_token_ids,
torch.full(
... | @@ -1212,6 +1212,10 @@ def _update_states_after_model_execute(
self.compilation_config.static_forward_context,
self.model.get_mamba_state_copy_func(),
)
+ else:
+ self.input_batch.num_accepted_tokens_cpu_tensor[:num_reqs].copy_(
+ num_accep... | vllm/v1/worker/gpu_model_runner.py | 26 | Python | 0.286 | suggestion | 187 | 51 | 51 | false | [Perf] [Hybrid] Copy num_accepted_tokens in non-blocking way when not using prefix caching | 35,442 | vllm-project/vllm | 71,895 | Python | heheda12345 | tdoublep |
_all_stop_token_ids: set[int] = msgspec.field(default_factory=set)
# Fields used to construct logits processors
structured_outputs: StructuredOutputsParams | None = None
"""Parameters for configuring structured outputs."""
logit_bias: dict[int, float] | None = None
"""If provided, the engine wi... | To reduce the number of fields in SamplingParams, could you use nested params (like for structured outputs)? | response. When set to -1, return all `vocab_size` log probabilities."""
prompt_logprobs: int | None = None
"""Number of log probabilities to return per prompt token.
When set to -1, return all `vocab_size` log probabilities."""
flat_logprobs: bool = False
"""Whether to return logprobs in flatten... | @@ -250,6 +250,22 @@ class SamplingParams(
skip_reading_prefix_cache: bool | None = None
+ # Sequence/N-gram repetition detection parameters | vllm/sampling_params.py | 26 | Python | 0.5 | question | 108 | 51 | 51 | false | [Core] Add optional flags to check for repetitive token patterns in engine output | 35,451 | vllm-project/vllm | 71,895 | Python | DarkLight1337 | aykoppol |
value=self.prompt_logprobs,
)
if self.truncate_prompt_tokens is not None and (
self.truncate_prompt_tokens == 0 or self.truncate_prompt_tokens < -1
):
raise VLLMValidationError(
f"truncate_prompt_tokens must be an integer >= 1 or -1, "
... | Move this validation into the nested params | )
if self.min_tokens < 0:
raise ValueError(
f"min_tokens must be greater than or equal to 0, got {self.min_tokens}."
)
if self.max_tokens is not None and self.min_tokens > self.max_tokens:
raise ValueError(
f"min_tokens must... | @@ -472,6 +494,23 @@ def _verify_args(self) -> None:
"Set detokenize=True to use stop."
)
+ if ( | vllm/sampling_params.py | 26 | Python | 0.286 | refactor | 43 | 51 | 51 | false | [Core] Add optional flags to check for repetitive token patterns in engine output | 35,451 | vllm-project/vllm | 71,895 | Python | DarkLight1337 | aykoppol |
if min_repetition_pattern_size <= 0:
min_repetition_pattern_size = 1
if (
max_repetition_pattern_size <= 0
or repetition_min_count < 2
or min_repetition_pattern_size > max_repetition_pattern_size
):
return False
for pattern_len in range(
min_repetition_p... | Factor out the inner loops into a separate function so you can use `return` instead of `break` | if token_ids[-(pattern_len * m + n)] != target_token:
return False
return True
def check_sequence_repetition(
token_ids: Sequence[int],
params: RepetitionDetectionParams,
) -> bool:
"""Check if a sequence of token IDs has a repetition pattern.
Args:
token_ids: L... | @@ -5,6 +5,54 @@
from vllm.v1.request import Request, RequestStatus
+def check_sequence_repetition(
+ token_ids: list[int],
+ max_repetition_pattern_size: int,
+ min_repetition_pattern_size: int,
+ repetition_min_count: int,
+) -> bool:
+ """Check if a sequence of token IDs has a repetition pattern.... | vllm/v1/core/sched/utils.py | 26 | Python | 0.571 | suggestion | 94 | 51 | 51 | false | [Core] Add optional flags to check for repetitive token patterns in engine output | 35,451 | vllm-project/vllm | 71,895 | Python | DarkLight1337 | aykoppol |
Returns:
True if a repetition pattern is found, False otherwise.
"""
if min_repetition_pattern_size <= 0:
min_repetition_pattern_size = 1
if (
max_repetition_pattern_size <= 0
or repetition_min_count < 2
or min_repetition_pattern_size > max_repetition_pattern_siz... | ```suggestion
target_token = token_ids[-n]
has_repetition = all(
token_ids[-(pattern_len * m + n)] == target_token
for m in range(1, repetition_min_count)
)
```
| for n in range(1, pattern_len + 1):
target_token = token_ids[-n]
for m in range(1, repetition_min_count):
if token_ids[-(pattern_len * m + n)] != target_token:
return False
return True
def check_sequence_repetition(
token_ids: Sequence[int],
params: Repetiti... | @@ -5,6 +5,54 @@
from vllm.v1.request import Request, RequestStatus
+def check_sequence_repetition(
+ token_ids: list[int],
+ max_repetition_pattern_size: int,
+ min_repetition_pattern_size: int,
+ repetition_min_count: int,
+) -> bool:
+ """Check if a sequence of token IDs has a repetition pattern.... | vllm/v1/core/sched/utils.py | 26 | Python | 1 | suggestion | 229 | 51 | 51 | false | [Core] Add optional flags to check for repetitive token patterns in engine output | 35,451 | vllm-project/vllm | 71,895 | Python | DarkLight1337 | aykoppol |
from vllm.v1.request import Request, RequestStatus
def _has_repeating_pattern(
token_ids: list[int],
pattern_len: int,
repetition_min_count: int,
) -> bool:
"""Check if the tail of token_ids contains a repeating pattern.
Compares the last pattern_len tokens against the preceding
(repetition_m... | Accept the nested params object |
from vllm.sampling_params import RepetitionDetectionParams
from vllm.v1.request import Request, RequestStatus
def _has_repeating_pattern(
token_ids: Sequence[int],
pattern_len: int,
repetition_min_count: int,
) -> bool:
"""Check if the tail of token_ids contains a repeating pattern.
Compares the... | @@ -5,6 +5,62 @@
from vllm.v1.request import Request, RequestStatus
+def _has_repeating_pattern(
+ token_ids: list[int],
+ pattern_len: int,
+ repetition_min_count: int,
+) -> bool:
+ """Check if the tail of token_ids contains a repeating pattern.
+
+ Compares the last pattern_len tokens against the... | vllm/v1/core/sched/utils.py | 26 | Python | 0.071 | suggestion | 32 | 51 | 51 | false | [Core] Add optional flags to check for repetitive token patterns in engine output | 35,451 | vllm-project/vllm | 71,895 | Python | DarkLight1337 | aykoppol |
sampling_params = request.sampling_params
assert sampling_params is not None
if request.num_output_tokens < sampling_params.min_tokens:
return False
last_token_id = request.output_token_ids[-1]
if last_token_id == sampling_params.eos_token_id:
request.status = RequestStatus.FINISHE... | If you make `check_sequence_repetition` accept `Sequence[int]`, then we don't need the list conversion |
sampling_params = request.sampling_params
assert sampling_params is not None
if request.num_output_tokens < sampling_params.min_tokens:
return False
last_token_id = request.output_token_ids[-1]
if last_token_id == sampling_params.eos_token_id:
request.status = RequestStatus.FINISH... | @@ -61,4 +114,16 @@ def check_stop(request: Request, max_model_len: int) -> bool:
):
request.status = RequestStatus.FINISHED_LENGTH_CAPPED
return True
+
+ repetition_detection = sampling_params.repetition_detection
+ if repetition_detection is not None and (
+ check_sequence_repetiti... | vllm/v1/core/sched/utils.py | 26 | Python | 0.5 | suggestion | 102 | 35 | 36 | false | [Core] Add optional flags to check for repetitive token patterns in engine output | 35,451 | vllm-project/vllm | 71,895 | Python | DarkLight1337 | aykoppol |
"If specified, the prefix cache will be salted with the provided "
"string to prevent an attacker to guess prompts in multi-user "
"environments. The salt should be random, protected from "
"access by 3rd parties, and long enough to be "
"unpredictable (e.g., ... | Can you mention that the request will be ended early if such a repetition is detected, and describe a scenario where this is useful? | "If specified, the prefix cache will be salted with the provided "
"string to prevent an attacker to guess prompts in multi-user "
"environments. The salt should be random, protected from "
"access by 3rd parties, and long enough to be "
"unpredictable (e.g., ... | @@ -166,6 +167,12 @@ class CompletionRequest(OpenAIBaseModel):
),
)
+ repetition_detection: RepetitionDetectionParams | None = Field(
+ default=None,
+ description="Parameters for detecting repetitive N-gram patterns "
+ "in output tokens.", | vllm/entrypoints/openai/completion/protocol.py | 26 | Python | 0.5 | question | 132 | 51 | 51 | false | [Core] Add optional flags to check for repetitive token patterns in engine output | 35,451 | vllm-project/vllm | 71,895 | Python | DarkLight1337 | aykoppol |
)
if (top_k := self.top_k) is None:
top_k = default_sampling_params.get(
"top_k", self._DEFAULT_SAMPLING_PARAMS["top_k"]
)
if (min_p := self.min_p) is None:
min_p = default_sampling_params.get(
"min_p", self._DEFAULT_SAMPLIN... | I think we should validate this via Pydantic before constructing the sampling params | )
if (top_k := self.top_k) is None:
top_k = default_sampling_params.get(
"top_k", self._DEFAULT_SAMPLING_PARAMS["top_k"]
)
if (min_p := self.min_p) is None:
min_p = default_sampling_params.get(
"min_p", self._DEFAULT_SAMPLIN... | @@ -255,17 +255,26 @@ def to_sampling_params(
structured_outputs_kwargs["json_object"] = True
elif response_format.type == "json_schema":
json_schema = response_format.json_schema
- assert json_schema is not None
+ if json_schema is None: | vllm/entrypoints/openai/completion/protocol.py | 26 | Python | 0.357 | suggestion | 84 | 51 | 51 | false | [Bugfix] Replace assert with ValueError for response_format validation in completions endpoint | 35,456 | vllm-project/vllm | 71,895 | Python | DarkLight1337 | umut-polat |
raise ValueError("Invalid type for tensors")
def get_accelerator_view_from_cpu_tensor(cpu_tensor: torch.Tensor) -> torch.Tensor:
"""
Get an accelerator view of a CPU tensor using Unified Virtual Addressing (UVA).
"""
from vllm.platforms import current_platform
if current_platform.is_xpu():
... | Nit: use the non-underscore version? | raise ValueError("Invalid type for tensors")
def get_accelerator_view_from_cpu_tensor(cpu_tensor: torch.Tensor) -> torch.Tensor:
"""
Get an accelerator view of a CPU tensor using Unified Virtual Addressing (UVA).
"""
from vllm.platforms import current_platform
if current_platform.is_xpu():
... | @@ -697,6 +697,54 @@ def _is_torch_equal_or_newer(torch_version: str, target: str) -> bool:
return version.parse(torch_version) >= version.parse(target)
| vllm/utils/torch_utils.py | 26 | Python | 0.286 | question | 37 | 51 | 51 | false | [torch.compile] Undo the fast_moe_cold_start hack in torch>=2.11 | 35,475 | vllm-project/vllm | 71,895 | Python | ProExpertProg | zou3519 |
direct_register_custom_op(
op_name="moe_forward",
op_func=_moe_forward,
mutates_args=["hidden_states"],
fake_impl=_moe_forward_fake,
tags=(torch.Tag.needs_fixed_stride_order,),
)
direct_register_custom_op(
op_name="moe_forward_shared",
op_func=_moe_forward_shared,
mutates_args=["hidd... | I hate to agree with Gemini but can we add a link to PyTorch issue/fix here |
direct_register_custom_op(
op_name="moe_forward",
op_func=_moe_forward,
mutates_args=["hidden_states"],
fake_impl=_moe_forward_fake,
tags=(torch.Tag.needs_fixed_stride_order,),
)
direct_register_custom_op(
op_name="moe_forward_shared",
op_func=_moe_forward_shared,
mutates_args=["hidd... | @@ -131,6 +146,40 @@ def _moe_forward_shared_fake(
tags=(torch.Tag.needs_fixed_stride_order,),
)
+if HAS_OPAQUE_TYPE:
+ # Patch the inductor's `constrain_to_fx_strides` to handle opaque
+ # (non-tensor) arguments. The original calls `.stride()` on every FX
+ # arg's meta value, which crashes on FakeSc... | vllm/model_executor/layers/fused_moe/runner/default_moe_runner.py | 26 | Python | 0.143 | suggestion | 75 | 51 | 51 | false | [torch.compile] Undo the fast_moe_cold_start hack in torch>=2.11 | 35,475 | vllm-project/vllm | 71,895 | Python | ProExpertProg | zou3519 |
fused_out = torch.empty_like(hidden_states)
if shared_experts_input is not None:
shared_out = torch.empty_like(shared_experts_input)
else:
shared_out = torch.empty_like(hidden_states)
return shared_out, fused_out
direct_register_custom_op(
op_name="moe_forward",
op_func=_moe_fo... | Should we put this in the file with other monkey patches instead? | fused_out = torch.empty_like(hidden_states)
if shared_experts_input is not None:
shared_out = torch.empty_like(shared_experts_input)
else:
shared_out = torch.empty_like(hidden_states)
return shared_out, fused_out
direct_register_custom_op(
op_name="moe_forward",
op_func=_moe_fo... | @@ -131,6 +146,40 @@ def _moe_forward_shared_fake(
tags=(torch.Tag.needs_fixed_stride_order,),
)
+if HAS_OPAQUE_TYPE: | vllm/model_executor/layers/fused_moe/runner/default_moe_runner.py | 26 | Python | 0.357 | question | 66 | 51 | 51 | false | [torch.compile] Undo the fast_moe_cold_start hack in torch>=2.11 | 35,475 | vllm-project/vllm | 71,895 | Python | ProExpertProg | zou3519 |
class ModuleName:
"""Wraps a module name string for use as a torch opaque type.
When torch >= 2.11, this is registered as a hoisted value-type opaque
object so that torch.compile lifts it as a graph input instead of baking
it as a constant. This avoids per-layer recompilation for MOE ops.
"""
... | Can we not do something like:
```suggestion
if HAS_OPAQUE_TYPE:
from torch._opaque_base import OpaqueBase
else:
OpaqueBase = object
``` | if HAS_OPAQUE_TYPE:
from torch._opaque_base import OpaqueBase
else:
OpaqueBase = object # type: ignore[misc, assignment]
class ModuleName(OpaqueBase): # type: ignore[misc]
"""Wraps a module name string for use as a torch opaque type.
When torch >= 2.11, this is registered as a hoisted value-type op... | @@ -740,6 +740,54 @@ def is_torch_equal(target: str) -> bool:
return Version(importlib.metadata.version("torch")) == Version(target)
+HAS_OPAQUE_TYPE = is_torch_equal_or_newer("2.11.0.dev")
+
+
+class ModuleName:
+ """Wraps a module name string for use as a torch opaque type.
+
+ When torch >= 2.11, ... | vllm/utils/torch_utils.py | 26 | Python | 1 | suggestion | 144 | 51 | 51 | false | [torch.compile] Undo the fast_moe_cold_start hack in torch>=2.11 | 35,475 | vllm-project/vllm | 71,895 | Python | ProExpertProg | zou3519 |
self.vllm_config = vllm_config
self.model_config = vllm_config.model_config
self.cache_config = vllm_config.cache_config
self.lora_config = vllm_config.lora_config
self.load_config = vllm_config.load_config
self.parallel_config = vllm_config.parallel_config
self.s... | I'm not comfortable with having a collective for the compilation time by default to the main process. This slows things down for the general case right? | self.vllm_config = vllm_config
self.model_config = vllm_config.model_config
self.cache_config = vllm_config.cache_config
self.lora_config = vllm_config.lora_config
self.load_config = vllm_config.load_config
self.parallel_config = vllm_config.parallel_config
self.s... | @@ -115,7 +115,15 @@ def initialize_from_config(self, kv_cache_configs: list[KVCacheConfig]) -> None:
underlying workers.
"""
self.collective_rpc("initialize_from_config", args=(kv_cache_configs,))
- self.collective_rpc("compile_or_warm_up_model")
+ compilation_times: list[float... | vllm/v1/executor/abstract.py | 26 | Python | 0.286 | performance | 152 | 51 | 51 | false | [Bugfix] Propagate compilation_time from workers to main process for TP>1 | 35,503 | vllm-project/vllm | 71,895 | Python | zou3519 | huydhn |
rank_suffix = get_worker_rank_suffix(global_rank=self.rank)
# Build the full trace name
if profile_prefix:
trace_name = f"{profile_prefix}_{rank_suffix}"
else:
trace_name = rank_suffix
# Create the profiler wrapper only on th... | ```suggestion
else:
# Config validation should prevent this code being reached
raise ValueError(f"Invalid value of {self.profiler_config.profiler=}")
``` | parallel_config.distributed_executor_backend != "external_launcher"
and not get_pp_group().is_last_rank
)
# launch non-blocking send of intermediate tensors
self._pp_send_work = get_pp_group().isend_tensor_dict(
output.tensors,
all_gather_group=ge... | @@ -757,11 +757,12 @@ def profile(self, is_start: bool = True, profile_prefix: str | None = None):
elif self.profiler_config.profiler == "cuda":
self.profiler = CudaProfilerWrapper(self.profiler_config)
logger.debug("Starting CUDA profiler")
- se... | vllm/v1/worker/gpu_worker.py | 26 | Python | 1 | suggestion | 209 | 51 | 51 | false | [MyPy][BugFix] Check profiler is assigned before calling start() on it | 35,505 | vllm-project/vllm | 71,895 | Python | hmellor | hickeyma |
rank_suffix = get_worker_rank_suffix(global_rank=self.rank)
# Build the full trace name
if profile_prefix:
trace_name = f"{profile_prefix}_{rank_suffix}"
else:
trace_name = rank_suffix
# Create the profiler wrapper only on the... | Can this be moved to an `else` block after `elif self.profiler_config.profiler == "cuda":`? And also have an error message instead of a bare `assert` | and not get_pp_group().is_last_rank
)
# launch non-blocking send of intermediate tensors
self._pp_send_work = get_pp_group().isend_tensor_dict(
output.tensors,
all_gather_group=get_tp_group(),
all_gather_tensors=all_gather_tensors,
)
... | @@ -757,11 +757,13 @@ def profile(self, is_start: bool = True, profile_prefix: str | None = None):
elif self.profiler_config.profiler == "cuda":
self.profiler = CudaProfilerWrapper(self.profiler_config)
logger.debug("Starting CUDA profiler")
- se... | vllm/v1/worker/gpu_worker.py | 26 | Python | 1 | suggestion | 149 | 51 | 51 | false | [CI] Fix mypy for vllm/device allocator | 35,518 | vllm-project/vllm | 71,895 | Python | hmellor | hickeyma |
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
# cumem-based pytorch pluggable allocator to implement sleep mode.
# other approaches tried but failed:
# - cuda-python package binding
# - custom libcuda driver ctypes wrapper
# both of them failed because of cu... | This is not used only for typing, at runtime `libcudart = CudaRTLibrary()` will fail | # SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
# cumem-based pytorch pluggable allocator to implement sleep mode.
# other approaches tried but failed:
# - cuda-python package binding
# - custom libcuda driver ctypes wrapper
# both of them failed because of cu... | @@ -11,27 +11,30 @@
import dataclasses
import gc
import os
-from collections.abc import Callable
+from collections.abc import Callable, Iterator
from contextlib import contextmanager
-from typing import Any
+from typing import TYPE_CHECKING, Any
import torch
from vllm.logger import init_logger
from vllm.util... | vllm/device_allocator/cumem.py | 25 | Python | 0.571 | bug | 84 | 50 | 50 | false | [CI] Fix mypy for vllm/device allocator | 35,518 | vllm-project/vllm | 71,895 | Python | hmellor | hickeyma |
class VideoMediaIO(MediaIO[tuple[npt.NDArray, dict[str, Any]]]):
def __init__(
self,
image_io: ImageMediaIO,
num_frames: int = 32,
**kwargs,
) -> None:
super().__init__()
self.image_io = image_io
self.num_frames = num_frames
# `kwargs` contains c... | I think we should define a backend for this model specifically to return the video bytes |
class VideoMediaIO(MediaIO[tuple[npt.NDArray, dict[str, Any]]]):
def __init__(
self,
image_io: ImageMediaIO,
num_frames: int = 32,
**kwargs,
) -> None:
super().__init__()
self.image_io = image_io
self.num_frames = num_frames
# `kwargs` contains c... | @@ -40,13 +40,19 @@ def __init__(
video_loader_backend = (
kwargs.pop("video_backend", None) or envs.VLLM_VIDEO_LOADER_BACKEND
)
+ self.keep_video_bytes = kwargs.pop("keep_video_bytes", False) | vllm/multimodal/media/video.py | 26 | Python | 0.357 | suggestion | 88 | 51 | 51 | false | Support Audio Extraction from MP4 Video for Nemotron Nano VL | 35,539 | vllm-project/vllm | 71,895 | Python | DarkLight1337 | askliar |
# Drop empty tool_calls to keep templates on the normal assistant path.
message.pop("tool_calls", None)
continue
for item in tool_calls:
# if arguments is None or empty string, set to {}
if content := item["function"].get("argu... | I think we don't need `mm_processor_kwargs` here anymore? So you can revert this file. Or did I miss something? | if len(tool_calls) == 0:
# Drop empty tool_calls to keep templates on the normal assistant path.
message.pop("tool_calls", None)
continue
for item in tool_calls:
# if arguments is None or empty string, set to {}
if ... | @@ -1522,13 +1529,16 @@ def parse_chat_messages(
messages: list[ChatCompletionMessageParam],
model_config: ModelConfig,
content_format: ChatTemplateContentFormat,
+ mm_processor_kwargs: dict[str, Any] | None = None,
) -> tuple[
list[ConversationMessage],
MultiModalDataDict | None,
Mult... | vllm/entrypoints/chat_utils.py | 26 | Python | 0.5 | question | 111 | 51 | 51 | false | Support Audio Extraction from MP4 Video for Nemotron Nano VL | 35,539 | vllm-project/vllm | 71,895 | Python | DarkLight1337 | askliar |
"GteNewModel": GteNewModelConfig,
"GteNewForSequenceClassification": GteNewModelConfig,
"Gemma3TextModel": Gemma3TextModelConfig,
"LlamaBidirectionalForSequenceClassification": LlamaBidirectionalConfig,
"LlamaBidirectionalModel": LlamaBidirectionalConfig,
"LlamaNemotronVLModel": LlamaNemotronVLC... | Please keep these in alphabetical order | @staticmethod
def verify_and_update_model_config(model_config: "ModelConfig") -> None:
model_config.hf_config.is_causal = False
model_config.hf_config.embedding_size = model_config.hf_config.num_labels
MODELS_CONFIG_MAP: dict[str, type[VerifyAndUpdateConfig]] = {
"GteModel": SnowflakeGteNe... | @@ -675,4 +684,5 @@ def verify_and_update_model_config(model_config: "ModelConfig") -> None:
"Qwen3_5ForConditionalGeneration": Qwen3_5ForConditionalGenerationConfig,
"Qwen3_5MoeForConditionalGeneration": Qwen3_5ForConditionalGenerationConfig,
"VoyageQwen3BidirectionalEmbedModel": VoyageQwen3Bidirectiona... | vllm/model_executor/models/config.py | 26 | Python | 0.071 | style | 39 | 28 | 38 | false | Support Audio Extraction from MP4 Video for Nemotron Nano VL | 35,539 | vllm-project/vllm | 71,895 | Python | DarkLight1337 | askliar |
def apply(
self,
processor_inputs: ProcessorInputs,
timing_ctx: TimingContext | None = None,
) -> MultiModalInputs:
if (hf_processor_mm_kwargs := processor_inputs.hf_processor_mm_kwargs) is None:
hf_processor_mm_kwargs = {}
use_audio_in_video = bool(
... | We will not support string inputs in a future release, so I suggest apply the prompt modification in terms of tokens here if possible | use_audio_in_video = bool(
hf_processor_mm_kwargs.get("use_audio_in_video", False)
)
hf_processor_mm_kwargs = {
k: v for k, v in hf_processor_mm_kwargs.items() if k != "use_audio_in_video"
}
processor_inputs.hf_processor_mm_kwargs = hf_processor_mm_kwarg... | @@ -1381,6 +1388,136 @@ class NanoNemotronVLMultiModalProcessor(
):
"""MultiModalProcessor extended for video support"""
+ def _extract_audio_from_videos(
+ self,
+ mm_items: MultiModalDataItems,
+ ) -> tuple[MultiModalDataItems, list[AudioItem]]:
+ """Extract audio tracks from video ... | vllm/model_executor/models/nano_nemotron_vl.py | 26 | Python | 0.5 | suggestion | 133 | 51 | 51 | false | Support Audio Extraction from MP4 Video for Nemotron Nano VL | 35,539 | vllm-project/vllm | 71,895 | Python | DarkLight1337 | askliar |
hf_text_config = vllm_config.model_config.hf_text_config
mamba_ssm_dtype = getattr(hf_text_config, "mamba_ssm_dtype", None)
if cache_config.mamba_ssm_cache_dtype == "auto":
if mamba_ssm_dtype is not None:
cache_config.mamba_ssm_cache_dtype = mamba_ssm_dtype
el... | Also move this to fit alphabetical order | @staticmethod
def verify_and_update_model_config(model_config: "ModelConfig") -> None:
mm_config = model_config.multimodal_config
if mm_config is not None:
video_kwargs = mm_config.media_io_kwargs.setdefault("video", {})
video_kwargs.setdefault("video_backend", "nemotron_... | @@ -656,11 +648,21 @@ def verify_and_update_model_config(model_config: "ModelConfig") -> None:
model_config.hf_config.embedding_size = model_config.hf_config.num_labels
+class NemotronHNanoVLV2Config(VerifyAndUpdateConfig): | vllm/model_executor/models/config.py | 26 | Python | 0.286 | refactor | 40 | 51 | 51 | false | Support Audio Extraction from MP4 Video for Nemotron Nano VL | 35,539 | vllm-project/vllm | 71,895 | Python | DarkLight1337 | askliar |
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
import base64
from io import BytesIO
from pathlib import Path
import av
import librosa
import numpy as np
import numpy.typing as npt
import pybase64
import soundfile
import torch
from vllm.utils.serial_utils imp... | Please revert the changes to the imports. Additional, `av` should use `PlaceholderModule` as it is an optional dependency. | # SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
import base64
from io import BytesIO
from pathlib import Path
import numpy as np
import numpy.typing as npt
import pybase64
import torch
from vllm.utils.import_utils import PlaceholderModule
from vllm.utils.seri... | @@ -4,24 +4,69 @@
from io import BytesIO
from pathlib import Path
+import av
+import librosa
+import numpy as np
import numpy.typing as npt
import pybase64
+import soundfile | vllm/multimodal/media/audio.py | 12 | Python | 0.714 | suggestion | 122 | 37 | 37 | false | Support Audio Extraction from MP4 Video for Nemotron Nano VL | 35,539 | vllm-project/vllm | 71,895 | Python | DarkLight1337 | askliar |
"stop": "end_turn",
"length": "max_tokens",
"tool_calls": "tool_use",
}
@staticmethod
def _convert_image_source_to_url(source: dict[str, Any]) -> str:
"""Convert an Anthropic image source to an OpenAI-compatible URL.
Anthropic supports two image sour... | ```suggestion
# Default to base64 processing if type is "base64"
# or missing, ensuring a proper data URI is always
# constructed for non-URL sources.
media_type = source.get("media_type", "image/jpeg")
data = source.get("data", "")
return f"data:{media_type};base64,{dat... | self.stop_reason_map = {
"stop": "end_turn",
"length": "max_tokens",
"tool_calls": "tool_use",
}
@staticmethod
def _convert_image_source_to_url(source: dict[str, Any]) -> str:
"""Convert an Anthropic image source to an OpenAI-compatible URL.
... | @@ -85,6 +85,28 @@ def __init__(
"tool_calls": "tool_use",
}
+ @staticmethod
+ def _convert_image_source_to_url(source: dict[str, Any]) -> str:
+ """Convert an Anthropic image source to an OpenAI-compatible URL.
+
+ Anthropic supports two image source types:
+ - base64... | vllm/entrypoints/anthropic/serving.py | 26 | Python | 1 | suggestion | 331 | 51 | 51 | false | [Bugfix] Fix Anthropic API base64 image handling in Messages endpoint | 35,557 | vllm-project/vllm | 71,895 | Python | DarkLight1337 | voipmonitor |
# Image blocks inside user messages
# ======================================================================
class TestImageContentBlocks:
def test_base64_image_in_user_message(self):
handler = _build_handler()
request = _make_request([
{
"role": "user",
... | Maybe make `_convert_anthropic_to_openai_request` a staticmethod or classmethod? Then we don't need to initialize the `AnthropicServingMessages` object | },
],
}
]
)
result = _convert(request)
user_msg = result.messages[0]
assert user_msg["role"] == "user"
parts = user_msg["content"]
assert len(parts) == 2
assert parts[0] == {"type": "text", ... | @@ -0,0 +1,341 @@
+# SPDX-License-Identifier: Apache-2.0
+# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
+"""Unit tests for Anthropic-to-OpenAI request conversion.
+
+Tests the image source handling and tool_result content parsing in
+AnthropicServingMessages._convert_anthropic_to_openai_request()... | tests/entrypoints/openai/test_anthropic_messages_conversion.py | 26 | Python | 0.5 | suggestion | 151 | 51 | 51 | false | [Bugfix] Fix Anthropic API base64 image handling in Messages endpoint | 35,557 | vllm-project/vllm | 71,895 | Python | DarkLight1337 | voipmonitor |
if self.uses_mrope:
self.mrope_state.apply_staged_writes()
def get_mm_embeddings(
self,
scheduled_encoder_inputs: dict[str, list[int]],
input_batch: InputBatch,
req_states: RequestState,
) -> torch.Tensor:
mm_hashes, mm_kwargs = self.encoder_runner.pr... | nit: I find this cleaner but feel free to dismiss :)
```suggestion
return inputs_embeds[: input_batch.num_tokens_after_padding]
``` | if self.uses_mrope:
self.mrope_state.apply_staged_writes()
def get_mm_embeddings(
self,
scheduled_encoder_inputs: dict[str, list[int]],
input_batch: InputBatch,
req_states: RequestState,
) -> torch.Tensor:
mm_hashes, mm_kwargs = self.encoder_runner.pr... | @@ -51,6 +72,30 @@ def apply_staged_writes(self) -> None:
if self.uses_mrope:
self.mrope_state.apply_staged_writes()
+ def get_mm_embeddings(
+ self,
+ scheduled_encoder_inputs: dict[str, list[int]],
+ input_batch: InputBatch,
+ req_states: RequestState,
+ ) -> ... | vllm/v1/worker/gpu/model_states.py | 26 | Python | 1 | performance | 139 | 51 | 51 | false | [Model Runner V2] Move MM encoder to Model States [3/N] | 35,564 | vllm-project/vllm | 71,895 | Python | njhill | WoosukKwon |
self.kv_cache_config,
)
inputs_embeds = None
if self.supports_mm_inputs and self.is_first_pp_rank and not dummy_run:
# Run MM encoder (if needed) and get multimodal embeddings.
# Only first PP rank prepares multimodal embeddings.
inputs_em... | minor suggestion, could remove `self.supports_mm_inputs` field/check here and have `get_mm_embeddings` return `None` | )
if not skip_attn_for_dummy_run:
block_tables, slot_mappings = self.prepare_dummy_attn(input_batch)
else:
block_tables = None
slot_mappings = None
# FIXME(woosuk): Fix warmup for LoRA.
attn_metadata = None
... | @@ -913,10 +873,20 @@ def execute_model(
self.kv_cache_config,
)
+ inputs_embeds = None
+ if self.supports_mm_inputs and self.is_first_pp_rank and not dummy_run: | vllm/v1/worker/gpu/model_runner.py | 26 | Python | 0.714 | suggestion | 116 | 51 | 51 | false | [Model Runner V2] Move MM encoder to Model States [3/N] | 35,564 | vllm-project/vllm | 71,895 | Python | njhill | WoosukKwon |
self.speculative_config = vllm_config.speculative_config
self.observability_config = vllm_config.observability_config
self.device = device
self.dtype = self.model_config.dtype
self.kv_cache_dtype = self.dtype
if self.cache_config.cache_dtype != "auto":
# Quan... | do we need EncoderCache on non-first PP rank? | self.load_config = vllm_config.load_config
self.parallel_config = vllm_config.parallel_config
self.scheduler_config = vllm_config.scheduler_config
self.speculative_config = vllm_config.speculative_config
self.observability_config = vllm_config.observability_config
self.d... | @@ -125,20 +125,15 @@ def __init__(
self.max_model_len = self.model_config.max_model_len
self.max_num_tokens = self.scheduler_config.max_num_batched_tokens
self.max_num_reqs = self.scheduler_config.max_num_seqs
- self.inputs_embeds_size = self.model_config.get_inputs_embeds_size()
... | vllm/v1/worker/gpu/model_runner.py | 26 | Python | 0.071 | performance | 45 | 51 | 51 | false | [Model Runner V2] Move MM encoder to Model States [3/N] | 35,564 | vllm-project/vllm | 71,895 | Python | njhill | WoosukKwon |
def model_post_init(self, __context):
if not self.id:
self.id = f"msg_{int(time.time() * 1000)}"
class AnthropicContextManagement(BaseModel):
"""Context management information for token counting."""
cache_creation_input_tokens: int | None = None
cache_read_input_tokens: int | None... | Some of these arguments are not used , is that intended? | content: list[AnthropicContentBlock]
model: str
stop_reason: (
Literal["end_turn", "max_tokens", "stop_sequence", "tool_use"] | None
) = None
stop_sequence: str | None = None
usage: AnthropicUsage | None = None
def model_post_init(self, __context):
if not self.id:
... | @@ -167,3 +167,41 @@ class AnthropicMessagesResponse(BaseModel):
def model_post_init(self, __context):
if not self.id:
self.id = f"msg_{int(time.time() * 1000)}"
+
+
+class AnthropicContextManagement(BaseModel):
+ """Context management information for token counting."""
+
+ cache_creati... | vllm/entrypoints/anthropic/protocol.py | 26 | Python | 0.357 | question | 56 | 42 | 42 | false | [Feat] Supports Anthropic Messages count_tokens API | 35,588 | vllm-project/vllm | 71,895 | Python | DarkLight1337 | chaunceyjiang |
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
from typing import Any
import torch
import torch.nn as nn
from vllm.config import VllmConfig
from vllm.v1.core.sched.output import NewRequestData
from vllm.v1.kv_cache_interface import KVCacheConfig
from vllm.v1... | I think it might be better to have the interface be named `ModelState`, and this class something like `DefaultModelState`. WDYT? | # SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
from typing import Any
import torch
import torch.nn as nn
from vllm.config import VllmConfig
from vllm.v1.core.sched.output import NewRequestData
from vllm.v1.kv_cache_interface import KVCacheConfig
from vllm.v1... | @@ -13,11 +13,12 @@
from vllm.v1.worker.gpu.mm.encoder_cache import EncoderCache
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.model_states.interface import ModelStateInterface
from vllm.v1.worker.gpu.states import Re... | vllm/v1/worker/gpu/model_states/default.py | 21 | Python | 0.714 | question | 128 | 46 | 46 | false | [Model Runner V2] Add ModelStateInterface [4/N] | 35,621 | vllm-project/vllm | 71,895 | Python | njhill | WoosukKwon |
ToolParserManager.register_lazy_module(
name="kimi_k2",
module_path="vllm.tool_parsers.kimi_k2_parser",
class_name="KimiK2ToolParser",
)
"""
cls.lazy_parsers[name] = (module_path, class_name)
@overload
@classmethod
def ... | What's the error mypy complains?
I am thinking if we have a simpler way to fix it. | name="kimi_k2",
module_path="vllm.tool_parsers.kimi_k2_parser",
class_name="KimiK2ToolParser",
)
"""
cls.lazy_parsers[name] = (module_path, class_name)
@classmethod
def register_module(
cls,
name: str | list[str] | None... | @@ -213,6 +214,25 @@ def register_lazy_module(cls, name: str, module_path: str, class_name: str) -> N
"""
cls.lazy_parsers[name] = (module_path, class_name)
+ @overload
+ @classmethod
+ def register_module(
+ cls,
+ name: str | list[str] | None = None,
+ force: bool = T... | vllm/tool_parsers/abstract_tool_parser.py | 26 | Python | 0.429 | question | 82 | 51 | 51 | false | [MISC] fixed tool_parser mypy errors | 35,640 | vllm-project/vllm | 71,895 | Python | yewentao256 | taneem-ibrahim |
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
"""Cold start and warm start tests for vLLM-compile.
Cold start runs in a forked child (must fork before CUDA init) which
populates on-disk caches and asserts cold-start counters. Warm start
then runs in the par... | Is this the only tiny model we have? Should we instead yuse a slightly-more mainstream one (maybe qwen-0.6B)? | # SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
"""Cold start and warm start tests for vLLM-compile.
Cold start runs in a forked child (must fork before CUDA init) which
populates on-disk caches and asserts cold-start counters. Warm start
then runs in the par... | @@ -0,0 +1,81 @@
+# SPDX-License-Identifier: Apache-2.0
+# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
+"""Cold start and warm start tests for vLLM-compile.
+
+Cold start runs in a forked child (must fork before CUDA init) which
+populates on-disk caches and asserts cold-start counters. Warm sta... | tests/compile/test_startup.py | 17 | Python | 0.5 | question | 109 | 42 | 42 | false | [torch.compile] Improve cold and warm start compile tests | 35,709 | vllm-project/vllm | 71,895 | Python | ProExpertProg | zou3519 |
MODEL = "microsoft/Phi-tiny-MoE-instruct"
def _run_vllm(vllm_runner):
with vllm_runner(
MODEL,
trust_remote_code=False,
max_model_len=256,
max_num_batched_tokens=1024,
load_format="dummy",
compilation_config=CompilationConfig(
mode=CompilationMode.VLLM_... | I think we already have a fixture for this |
def _run_vllm(vllm_runner):
with vllm_runner(
MODEL,
trust_remote_code=False,
max_model_len=256,
max_num_batched_tokens=1024,
load_format="dummy",
compilation_config=CompilationConfig(
mode=CompilationMode.VLLM_COMPILE,
cudagraph_mode=CUDAGra... | @@ -0,0 +1,81 @@
+# SPDX-License-Identifier: Apache-2.0
+# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
+"""Cold start and warm start tests for vLLM-compile.
+
+Cold start runs in a forked child (must fork before CUDA init) which
+populates on-disk caches and asserts cold-start counters. Warm sta... | tests/compile/test_startup.py | 26 | Python | 0.071 | suggestion | 42 | 51 | 51 | false | [torch.compile] Improve cold and warm start compile tests | 35,709 | vllm-project/vllm | 71,895 | Python | ProExpertProg | zou3519 |
def _run_vllm(vllm_runner):
with vllm_runner(
MODEL,
trust_remote_code=False,
max_model_len=256,
max_num_batched_tokens=1024,
load_format="dummy",
compilation_config=CompilationConfig(
mode=CompilationMode.VLLM_COMPILE,
cudagraph_mode=CUDAGraph... | Do we not have existing forking utilities? Can we at least use mp? Manual forking scares me | MODEL,
trust_remote_code=False,
max_model_len=256,
max_num_batched_tokens=1024,
load_format="dummy",
compilation_config=CompilationConfig(
mode=CompilationMode.VLLM_COMPILE,
cudagraph_mode=CUDAGraphMode.NONE,
),
num_gpu_blocks_overr... | @@ -0,0 +1,81 @@
+# SPDX-License-Identifier: Apache-2.0
+# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
+"""Cold start and warm start tests for vLLM-compile.
+
+Cold start runs in a forked child (must fork before CUDA init) which
+populates on-disk caches and asserts cold-start counters. Warm sta... | tests/compile/test_startup.py | 26 | Python | 0.357 | question | 91 | 51 | 51 | false | [torch.compile] Improve cold and warm start compile tests | 35,709 | vllm-project/vllm | 71,895 | Python | ProExpertProg | zou3519 |
q = q.view(-1, self.head_dim)
q_fp8, q_scale = per_token_group_quant_fp8(
q,
self.quant_block_size,
column_major_scales=False,
use_ue8m0=self.scale_fmt is not None,
)
q_fp8 = q_fp8.view(-1, self.n_head, self.head_dim)
q_scale = q_sc... | ```suggestion
This must be wrapped in a custom op because our torch.compile integration
does not support runtime dispatching on num_tokens.
``` | q = q.view(-1, self.head_dim)
q_fp8, q_scale = per_token_group_quant_fp8(
q,
self.quant_block_size,
column_major_scales=False,
use_ue8m0=self.scale_fmt is not None,
)
q_fp8 = q_fp8.view(-1, self.n_head, self.head_dim)
q_scale = q_sc... | @@ -717,6 +718,43 @@ def forward(
return self.indexer_op(hidden_states, q_fp8, k, weights)
+def _min_latency_fused_qkv_a_proj_impl(
+ input_: torch.Tensor,
+ weight: torch.Tensor,
+) -> torch.Tensor:
+ """
+ Dynamically run min-latency gemm if num_tokens <= 16.
+ This must be wrapped in a cu... | vllm/model_executor/models/deepseek_v2.py | 26 | Python | 1 | suggestion | 151 | 51 | 51 | false | [MoE][Perf] Wrap DSV3 QKVAProj GEMM in custom op for torch.compile | 35,751 | vllm-project/vllm | 71,895 | Python | ProExpertProg | robertgshaw2-redhat |
Verify that the model is compatible with BitsAndBytes quantization.
"""
if not hasattr(model, "load_weights"):
raise AttributeError(
"The required method 'load_weights' is not defined in class"
f" {type(model).__name__}."
)
if not ... | Wait, pre-quant means loading from pre-quantized checkpoint like `unsloth/Qwen3-0.6B-unsloth-bnb-4bit`. This change will totally disable tp support with BNB online quantization:
```
python examples/offline_inference/basic/generate.py --model /mnt/data0/LLM/Qwen3-0.6B --language-model-only --quantization bitsandbytes -t... | Verify that the model is compatible with BitsAndBytes quantization.
"""
if not hasattr(model, "load_weights"):
raise AttributeError(
"The required method 'load_weights' is not defined in class"
f" {type(model).__name__}."
)
if not ... | @@ -546,11 +546,11 @@ def _verify_model_compatibility(
f"BitsAndBytes loader does not support {quant_method} quantization"
)
- # The quant_states in pre_quantized models cannot work with a split
- # weight tensor. So TP does not work with pre_quantized bnb models.
-... | vllm/model_executor/model_loader/bitsandbytes_loader.py | 26 | Python | 1 | performance | 5,530 | 51 | 51 | false | Enable bnb for multiple indices weight | 35,838 | vllm-project/vllm | 71,895 | Python | Isotr0py | flutist |
def complete_load(self, block_hashes: Iterable[BlockHash]):
for block_hash in block_hashes:
block = self.blocks[block_hash]
assert block.ref_cnt > 0
block.ref_cnt -= 1
def prepare_store(
self, block_hashes: Iterable[BlockHash]
) -> PrepareStoreOutput | No... | Can we move this after `if num_blocks_to_evict > 0:` ?
Same comment for `arc_manager.py`. | def complete_load(self, block_hashes: Iterable[BlockHash]):
for block_hash in block_hashes:
block = self.blocks[block_hash]
assert block.ref_cnt > 0
block.ref_cnt -= 1
def prepare_store(
self, block_hashes: Iterable[BlockHash]
) -> PrepareStoreOutput | No... | @@ -57,20 +57,27 @@ def complete_load(self, block_hashes: Iterable[BlockHash]):
def prepare_store(
self, block_hashes: Iterable[BlockHash]
) -> PrepareStoreOutput | None:
+ block_hashes_list = list(block_hashes)
+
# filter out blocks that are already stored
block_hashes_to_st... | vllm/v1/kv_offload/lru_manager.py | 26 | Python | 0.571 | refactor | 89 | 51 | 51 | false | [Bugfix][CPUOffloadingManager] Prevent eviction of already-stored blocks in LRU/ARC `prepare_store()` | 35,846 | vllm-project/vllm | 71,895 | Python | orozery | ronensc |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.