text
stringlengths
14
100k
source
stringclasses
1 value
repo
stringclasses
810 values
language
stringclasses
13 values
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM projec<|fim_suffix|>loading on a dense model. """ compare_two_settings( "meta-llama/Llama-3.2-1B-Instruct", [ # Prefetch offloading configuration "--offload-gr...
fim
vllm-project/vllm
python
<|fim_suffix|>md(["vllm", "serve"]) assert "--max-tokens" in cmd def test_nested_key_preserves_suffix(self): """Test that nested keys preserve the suffix format.""" # The suffix after the dot should preserve underscores item = ParameterSweepItem.from_record( {"compilatio...
fim
vllm-project/vllm
python
<|fim_suffix|>ys( monkeypatch: pytest.MonkeyPatch, ) -> None: monkeypatch.setattr(request_func_module.aiohttp, "FormData", _FakeFormData) session = _FakeSession() request_input = RequestFuncInput( prompt="", api_url="http://localhost:8000/v1/audio/transcriptions", prompt_len=1, ...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import subpr<|fim_suffix|>cess import pytest @pytest.mark.benchmark def test_bench_startup(): command = [ "vllm", "bench", "startup", ] result = subprocess.run(...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import argparse import json from pathlib import Path from unittest.mock import MagicMock, patch import pytest from transformers import AutoTokenizer, PreTrainedTokenizerBase from vllm.benchmarks.da...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import argparse import json from pathlib import Path import pytest from vllm.benchmarks.datasets import get_samples class _RecordingTokenizer: """Minimal tokenizer stub that records the kwarg...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import argparse import json from pathlib import Path import pytest from transformers import AutoTokenizer, PreTrainedTokenizerBase from vllm.benchmarks.datasets import get_samples @pytest.fixture...
fim
vllm-project/vllm
python
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import json from argparse import Namespace from io import BytesIO from pathlib import Path from typing import Any import pybase64 as base64 import pytest from PIL import Image import vllm.benchmarks.datasets.dat...
fim
vllm-project/vllm
python
<|fim_suffix|>, "--load-format", "dummy", ] result = subprocess.run(command, capture_output=True, text=True) print(result.stdout) print(result.stderr) assert result.returncode == 0, f"Benchmark failed: {result.stderr}" <|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # <|fim_midd...
fim
vllm-project/vllm
python
<|fim_suffix|>bj = PlotLessThan("request_rate", target) result = filter_obj.apply(self.df_numeric) assert len(result) == expected_count @pytest.mark.parametrize( "target,expected_count", [ ("10.0", 3), # 1.0, 5.0, 10.0 ("5.0", 2), # 1.0, 5.0 ], ...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import random from typing import Any, NamedTuple, cast import numpy as np import pytest from transformers import AutoTokenizer, PreTrainedTokenizerBase from vllm.benchmarks.datasets import ( Ra...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import os from tempfile import NamedTemporaryFile from typing import Any, cast import cv2 import pybase64 as base64 import pytest from transformers import AutoTokenizer, PreTrainedTokenizerBase fr...
fim
vllm-project/vllm
python
<|fim_suffix|>, 256, 64, tok) b = get_sampling_params(np.random.default_rng(1), 50, rr, 256, 64, tok) # Extremely unlikely all three arrays match with different seeds assert not all(np.array_equal(arr_a, arr_b) for arr_a, arr_b in zip(a, b)) # -- validation / error paths -- @pytest.mar...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import subprocess import tempfile import time from pathlib import Path import pytest import requests import urllib3 from ..utils import RemoteOpenAIServer MODEL_NAME = "meta-llama/Llama-3.2-1B-Ins...
fim
vllm-project/vllm
python
<|fim_suffix|>e == 0, f"Benchmark failed: {result.stderr}" <|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import subprocess import pytest MODEL_NAME = "meta-llama/Llama-3.2-1B-Instruct" @pytest.mark.benchmark def test_bench_throughput(): ...
fim
vllm-project/vllm
python
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import json from pathlib import Path import pytest from transformers import AutoTokenizer, PreTrainedTokenizerBase from vllm.benchmarks.datasets import CustomDataset from vllm.benchmarks.datasets.create_txt_slic...
fim
vllm-project/vllm
python
<|fim_suffix|>name in environment_variables: return environment_variables[name]() raise AttributeError(f"module {__name__!r} has no attribute {name!r}") def __dir__(): return list(environment_variables.keys()) def is_set(name: str): """Check if an environment variable is explicitly set.""" i...
fim
vllm-project/vllm
python
<|fim_suffix|>stom_passes: pass_(graph) VllmInductorPass.dump_prefix += 1 VllmInductorPass.dump_prefix = None self.graph_post_pass = deepcopy(graph) lazy_format_graph_code("graph_post_pass", graph.owning_module) # assign by reference, will reflect the final stat...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project from contextlib import contextmanager from unittest.mock import MagicMock, patch import pytest from vllm.platforms.interface import DeviceCapabilit<|fim_suffix|>ocked CUDA platforms. Usage: ...
fim
vllm-project/vllm
python
<|fim_suffix|> = { "mode": CompilationMode.VLLM_COMPILE, "compile_sizes": [2, 4, 8], "splitting_ops": [], "pass_config": {"fuse_gemm_comms": async_tp_enabled}, } async_tp_args = [ *common_args, "--tensor-parallel-size", str(tp_size), "--distribute...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """ WARNING: This test runs in both single-node (4 GPUs) and multi-node (2 node with 2 GPUs each) modes. If the test only uses 2 GPUs, it is important to set the distributed backend to "mp" to avoi...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import dataclasses import pytest from vllm.config import CompilationMode from vllm.platforms import current_platform from ...utils import compare_all_settings ATTN_BACKEND = "FLASH_ATTN" if not c...
fim
vllm-project/vllm
python
<|fim_suffix|> GC yield weakref.proxy(full), weakref.proxy(piecewise) del full del piecewise wait_for_gpu_memory_to_clear( devices=[0], threshold_ratio=0.1, ) @pytest.mark.parametrize( "llm_pair", [ pytest.param((model, backend_config, use_inductor_graph_partition)...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import tempfile from pathlib import Path from typing import Any import pytest import torch from tests.quantization.utils import is_quant_method_supported from vllm import LLM, SamplingParams from ...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import pytest from vllm.compilation.counter import compilation_counter from vllm.config import VllmConfig from vllm.config.compilation import CompilationMode from vllm.platforms import current_platf...
fim
vllm-project/vllm
python
<|fim_suffix|>+") outputs = [] # vllmcompile compile vllm_config = VllmConfig( compilation_config=CompilationConfig( mode=CompilationMode.VLLM_COMPILE, cudagraph_mode=CUDAGraphMode.PIECEWISE, splitting_ops=["silly::attention"], cudagraph_capture_size...
fim
vllm-project/vllm
python
<|fim_suffix|>ng with set_forward_context( None, vllm_config=vllm_config, cudagraph_runtime_mode=CUDAGraphMode.PIECEWISE, batch_descriptor=BatchDescriptor( num_tokens=2, ), ): model(torch.randn(2).cuda()) wit...
fim
vllm-project/vllm
python
<|fim_suffix|>eze(1) * 2 + 3 hidden_states = (residual + 1) ** 2 # following layers for _ in range(config.num_layers - 1): hidden_states = hidden_states + residual residual = hidden_states * 4 + positions.unsqueeze(1) * 2 + 3 hidden_states = (residual + 1) ** 2 return hidden_st...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import itertools from collections.abc import Callable, Iterable from typing import Any, NamedTuple import pytest import regex as re from vllm.platforms import current_platform from vllm.v1.attentio...
fim
vllm-project/vllm
python
<|fim_suffix|> {log_matches}" ) assert sum(m == 0 for m in log_matches) == tp_size * ( num_ranges_activated - 1 ), ( f"Expecting 0 ar_rms on " f"{tp_size * (num_ranges_activated - 1)} large-range " ...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import pytest from vllm._aiter_ops import is_aiter_found_and_supported from vllm.platforms import current_platform from vllm.utils.flashinfer import has_flashinfer from vllm.v1.attention.backends.re...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project from collections.abc import Callable import pytest from vllm.config import PassConfig from vllm.platforms import current_platform from vllm.utils.flashinfer import is_flashinfer_fp8_blockscale_gemm...
fim
vllm-project/vllm
python
<|fim_suffix|>config=PassConfig( fuse_norm_quant=True, fuse_act_quant=True, fuse_attn_quant=True, enable_qk_norm_rope_fusion=True, fuse_allreduce_rms=True, ), ) matches_check = [ "rms_quant_fusion", "act_quant_fusion", ...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project from collections.abc import Callable import pytest from vllm.config import PassConfig from vllm.platforms import current_platform from ...utils import multi_gpu_test from .common import ( INDU...
fim
vllm-project/vllm
python
<|fim_suffix|>s_cold_start: expected_saved = spec.cold_artifacts_saved expected_loaded = 0 else: expected_saved = spec.warm_artifacts_saved expected_loaded = spec.warm_artifacts_loaded assert saved == expected_saved, f"{start_type.lower()}_artifacts_saved: got {saved}" asser...
fim
vllm-project/vllm
python
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import pytest import torch import vllm.envs as envs from tests.compile.backend import TestBackend from tests.utils import ( multi_gpu_test, ) from vllm.compilation.passes.fusion.collective_fusion import Asy...
fim
vllm-project/vllm
python
<|fim_suffix|> ), pytest.param( TestAllReduceRMSNormStaticQuantFP8Model, False, False, marks=pytest.mark.skipif( current_platform.is_rocm(), reason="Not supported on ROCm platform", ), ), pytest.para...
fim
vllm-project/vllm
python
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import pytest import torch import vllm.envs as envs from tests.compile.backend import TestBackend from tests.utils import TestFP8Layer, multi_gpu_test from vllm.compilation.passes.fusion.rms_quant_fusion import ...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """ Comprehensive tests for UnsafeCloneEliminationPass. This test suite exercises all possible valid FX graph patterns involving clones: 1. Clone with no users (dead code) 2. Clone with read-only us...
fim
vllm-project/vllm
python
<|fim_suffix|>= VllmBackend(vllm_config) model = TransformerBlockWithSplits() x = torch.randn(8, 32, dtype=torch.bfloat16) # Reference output ref_output = with_dyn_arg(model, 0, 0)(x.clone()) # Compile with piecewise compilation (graph will split at split_marker) compiled_model = torch.compil...
fim
vllm-project/vllm
python
<|fim_suffix|> model = Model() x = torch.randn(8, 16, dtype=torch.bfloat16) with ( ops.rms_norm.set_priority([rms_provider, "native"]), ir.enable_torch_wrap(True), ): compiled_model = torch.compile(model, backend=backend, fullgraph=True) compiled_unlowered_model = torch....
fim
vllm-project/vllm
python
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """ Unit tests for the DoubleQuant fan-out variants registered by ``RocmAiterRMSNormQuantFusionPass``. Both variants target a 1-to-2 fan-out where one ``rms_norm`` output feeds two distinct ``rocm_aiter_group_fp8...
fim
vllm-project/vllm
python
<|fim_suffix|>nput view = hidden_states.reshape(-1, self.hidden_size) # matrix multiplication permute = self.gate_proj.permute(1, 0) mm = torch.mm(view, permute) # layer normalization norm_output, residual_output = self.norm(mm, residual) if TEST_FP8: ...
fim
vllm-project/vllm
python
<|fim_suffix|>ilationConfig( mode=CompilationMode.VLLM_COMPILE, custom_ops=["+rms_norm"], pass_config=PassConfig(fuse_act_padding=True, eliminate_noops=True), ), ) with vllm.config.set_current_vllm_config(vllm_config), monkeypatch.context() as m: from vllm.co...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """ Unit test for the MLADualRMSNormFusionPass. The pass fuses paired q/kv RMS norms in MLA attention into a single fused_mla_dual_rms_norm op backed by AITER's fused_qk_rmsnorm kernel. """ import ...
fim
vllm-project/vllm
python
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import pytest import torch import vllm.config import vllm.ir.ops import vllm.plugins from tests.compile.backend import TestBackend from tests.utils import TestFP8Layer from vllm._aiter_ops import IS_AITER_FOUND...
fim
vllm-project/vllm
python
<|fim_suffix|>bled compiled_fused = torch.compile( model_fused, backend=test_backend, fullgraph=True ) assert compiled_fused.attn._o_scale_float is None result_fused = compiled_fused(q, k, v) if backend == AttentionBackendEnum.FLASHINFER: # With the Flas...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import copy import pytest import torch._dynamo from tests.compile.backend import LazyInitPass, TestBackend from tests.utils import TestFP8Layer, flat_product from tests.v1.attention.utils import Ba...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import pytest import torch import vllm.config from tests.compile.backend import TestBackend from tests.v1.attention.utils import BatchSpec, create_common_attn_metadata from vllm._aiter_ops import i...
fim
vllm-project/vllm
python
<|fim_suffix|> assert backend.op_count(torch.ops.aten.slice.Tensor) == 1 assert backend.op_count(torch.ops.aten.slice_scatter.default) == 1 <|fim_prefix|># SPDX-License-Identifie<|fim_middle|>r: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import pytest import torch ...
fim
vllm-project/vllm
python
<|fim_suffix|> config = VllmConfig(model_config=ModelConfig(dtype=torch.bfloat16)) pass_manager = PostGradPassManager() pass_manager.configure(config) # Check that UUID is different if the same pass is added 2x pass_manager.add(callable) uuid1 = pass_manager.uuid() pa...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import pytest import torch from torch._ops import OpOverload, OpOverloadPacket from tests.compile.backend import TestBackend from vllm.compilation.passes.fusion.matcher_utils import ( FLASHINFE...
fim
vllm-project/vllm
python
<|fim_suffix|>used_rope_and_unified_kv_cache_update.default ) == 0 ) if dtype == torch.float16: ATOL, RTOL = (2e-3, 2e-3) else: ATOL, RTOL = (1e-2, 1e-2) # TODO(charlifu): switch back to ATOL, RTOL after aiter fix is merged. ...
fim
vllm-project/vllm
python
<|fim_suffix|>, head_size, dtype) T = 5 qkv = torch.randn( T, num_heads * head_size + 2 * num_kv_heads * head_size, dtype=dtype ) pos = torch.arange(T, dtype=torch.long) qkv_eager = qkv.clone() pos_eager = pos.clone() result_eager = model(qkv_eager, ...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import itertools from functools import partial import pytest import torch import vllm.envs as envs from tests.compile.backend import TestBackend from tests.kernels.quantization.nvfp4_utils import q...
fim
vllm-project/vllm
python
<|fim_suffix|> torch._dynamo.mark_dynamic(qkv, 0) result_eager = model(qkv) model_compiled = torch.compile(model, backend=backend) result_compiled = model_compiled(qkv) ATOL, RTOL = (2e-3, 2e-3) for eager, compiled in zip(result_eager, result_compiled): torch.test...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLL<|fim_suffix|>_platform.is_cuda_alike(), reason="Requires CUDA") def test_register_tracks_patterns(vllm_config): """register() appends each VllmPatternReplacement to _pattern_replacements.""" with vllm...
fim
vllm-project/vllm
python
<|fim_suffix|> return # Register the unified attention operation direct_register_custom_op( op_name="attention", op_func=silly_attention, mutates_args=["out"], fake_impl=silly_attention_fake, target_lib=silly_lib, ) <|fim_prefix|># SPDX-License-Identifier: Ap<|fim_middle|>ache-2.0 # SPDX-FileC...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import hashlib import os import pickle import tempfile from contextlib import contextmanager from pathlib import Path from unittest.mock import Mock, patch import pytest import torch import vllm.e...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """Tests for vllm.compilation.codegen — execution code generation. Each test runs a real Python function through the same pipeline vLLM uses in production: ``make_fx`` to obtain an aten-level fx gra...
fim
vllm-project/vllm
python
<|fim_suffix|> batch_sizes = [1, 4, 16, 24, 48, 64, 8192] with compilation_counter.expect( num_graphs_seen=1, num_piecewise_graphs_seen=1, num_backend_compilations=6, ): run_model(vllm_config, model, batch_sizes) assert post_grad_range_checker...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import copy from contextlib import nullcontext from unittest.mock import MagicMock, patch import pytest import torch from pydantic import ValidationError from vllm.compilation.counter import compil...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apac<|fim_suffix|>.expect( num_graphs_seen=2, num_piecewise_graphs_seen=expected_num_piecewise_graphs_seen, # 3 piecewise graphs per instance of B() num_piecewise_capturable_graphs_seen=expected_num_piecewise_capturable_graphs_seen, num_ba...
fim
vllm-project/vllm
python
<|fim_suffix|>nit__(self, **kwargs): super().__init__() def forward(self, x: torch.Tensor): # This will cause specialization - torch.compile will guard on # sx.shape[0] if x.shape[0] >= 10: return x * 10 else: return x ...
fim
vllm-project/vllm
python
<|fim_suffix|>d graph symint_placeholders = [ node for node in captured_graph.graph.nodes if node.op == "placeholder" and isinstance(node.meta.get("example_value"), torch.SymInt) ] assert len(symint_placeholders) > 0, ( "Captured graph should have SymInt placeholders ...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """Tests for the Inductor FALLBACK_ALLOW_LIST patch in env_override.py. The patch wraps ``torch._inductor.lowering.FALLBACK_ALLOW_LIST`` in a thin proxy that auto-allows any custom op in the ``vllm:...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import pytest import torch import vllm.envs as envs from vllm.compilation.decorators import support_torch_compile from vllm.config import ( CompilationConfig, ModelConfig, VllmConfig, ...
fim
vllm-project/vllm
python
<|fim_suffix|>lt = get_sequence_parallelism_threshold( hidden_size=SP_MIN_HIDDEN_SIZE[90], tp_size=2, element_size=2, ) assert result is not None <|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors t...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project from unittest.mock import patch import pytest import regex as re import torch from torch import nn import tests.compile.silly_attention # noqa from vllm.compilation.decorators import support_torch...
fim
vllm-project/vllm
python
<|fim_suffix|>{expected2}, got {result2}" ) # without the wrapper result would be different. result3 = mod(x2) expected3 = torch.tensor([100, 200, 300]) assert torch.allclose(result3, expected3), ( f"Expected {result3}, got {expected3}" ) # with STOCK_T...
fim
vllm-project/vllm
python
<|fim_suffix|>or # is raised when an unrecognized vLLM environment variable is set monkeypatch.setenv("VLLM_UNRECOGNIZED_ENV_VAR", "some_value") engine_args = EngineArgs( fail_on_environ_validation=True, ) with pytest.raises(ValueError, match="Unknown vLLM environment variable detected"): ...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project from dataclasses import dataclass from enum import Enum import pytest from vllm.config.utils import get_hash_factors, hash_factors, normalize_value # Helpers def endswith_fqname(obj, suffix: st...
fim
vllm-project/vllm
python
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """Tests for ModelArchitectureConfig and its integration with ModelConfig.""" import json from pathlib import Path import pytest from vllm.config import ModelConfig, ParallelConfig, SpeculativeConfig from vllm....
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import sys from unittest.mock import patch from vllm.config import VllmConfig from vllm.engine.arg_utils import AsyncEngineArgs from vllm.v1.engine.async_llm import AsyncLLM def test_mp_reducer():...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import pytest from vllm.config.model import ModelConfig from vllm.config.multimodal import MultiModalConfig from vllm.v1.attention.backends.registry import AttentionBackendEnum def test_mm_encode...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import contextlib import pathlib from copy import deepcopy from tblib import pickling_support # ruff: noqa # Install support for pickling exceptions so that we can nicely propagate # failures from...
fim
vllm-project/vllm
python
<|fim_suffix|>ailable assert count == 1, f"device_count()={count}, expected 1" print("OK") <|fim_prefix|>#!/usr/bin/env python3 # SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """Check that device_count respects CUDA_VISIBLE_DEVICES after platform import.""" ...
fim
vllm-project/vllm
python
#!/usr/bin/env python3 # SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """Check that vllm.platforms import does not initialize CUDA.""" import os for key in ["CUDA_VISIBLE_DEVICES", "HIP_VISIBLE_DEVICES", "ROCR_VISIBLE_DEVICES"]: os.environ.pop(key, None)...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """Tests for CUDA forward compatibility path logic in env_override.py. Verifies the opt-in LD_LIBRARY_PATH manipulation for CUDA compat libs, including env var parsing, path detection, and deduplica...
fim
vllm-project/vllm
python
<|fim_suffix|>after, device_id = check_cuda_context() if not valid_after: return False, "CUDA context should be valid after set_cuda_context" if device_id != expected_device_id: return False, f"Expected device {expected_device_id}, got {device_id}" return True, "Success"...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """ Test that platform imports do not prematurely initialize CUDA. This is critical for Ray-based multi-GPU setups where workers need to set CUDA_VISIBLE_DEVICES after importing vLLM but before CUDA...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import pytest from vllm.entrypoints.llm import LLM from vllm.sampling_params import SamplingParams @pytest.mark.parametrize("model", ["distilbert/distilgpt2"]) def test_computed_prefix_blocks(mod...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import pytest from transformers import AutoTokenizer from vllm import SamplingParams from vllm.v1.engine import EngineCoreRequest from vllm.v1.engine.detokenizer import FastIncrementalDetokenizer ...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """Test the different finish_reason="stop" situations during<|fim_suffix|>son == "stop" and output.stop_reason is None ) <|fim_middle|> generation: 1. One of the provided stop strings ...
fim
vllm-project/vllm
python
<|fim_suffix|> finished=True. # (Buffering only applies during streaming when finished=False.) assert detok.get_next_output_text(finished=True, delta=False) == expected_text <|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import pytest f...
fim
vllm-project/vllm
python
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project from typing import Any import pytest from vllm import LLM, SamplingParams MODEL = "meta-llama/llama-2-7b-hf" MAX_TOKENS = 200 def _test_stopping( llm: LLM, expected_output: str, expected_reason: ...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import os import random import msgspec import msgspec.msgpack import pytest import zmq from vllm.config.kv_events import KVEventsConfig from vllm.distributed.kv_events import EventPublisherFactory ...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import atexit import os import random import pytest import torch import torch.multiprocessing as mp from vllm.config import VllmConfig, set_current_vllm_config from vllm.distributed.parallel_state...
fim
vllm-project/vllm
python
<|fim_suffix|>ank} verified all buffers") dist.barrier() torch.accelerator.synchronize() CustomAllreduce.free_shared_buffer(pointers) <|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project # can only run on machines with p2p access across GPUs # can o...
fim
vllm-project/vllm
python
<|fim_suffix|>recv) g = _make_group_for_unit_test(rank_in_group=0, world_size=2) # 2 tensors so we can catch late-binding bugs in postprocess closures. metadata_list = [ ("a", TensorMetadata("cpu", torch.int32, torch.Size([4]))), ("b", TensorMetadata("cpu", torch.int32, torch.Size([4]))), ...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """ WARNING: This test runs in both single-node (4 GPUs) and multi-node (2 node with 2 GPUs each) modes. If the test only uses 2 GPUs, it is important to set the distributed backend to "mp" to avoi...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import random import pytest import ray import torch import torch.distributed as dist from vllm.distributed.communication_op import tensor_model_parallel_all_reduce # noqa from vllm.distributed.pa...
fim
vllm-project/vllm
python
<|fim_suffix|>.""" from vllm.v1.attention.ops.dcp_alltoall import _lse_weighted_combine outputs = torch.tensor( [ [[[1.0, 2.0]]], [[[3.0, 4.0]]], ] ) lses = torch.tensor( [ [[1.0]], [[2.0...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifie<|fim_suffix|>un_and_test_dummy_opt_api_server(dummy_opt_path, tp=2) <|fim_middle|>r: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project from tests.plugins_tests.test_oot_registration_online import ( run_and_test_dummy_opt_api_server, ) def test_...
fim
vllm-project/vllm
python
<|fim_suffix|>ial_accuracy:+.3f})" ) print( f" Scale down: {scale_down_accuracy:.3f} " f"(diff: {scale_down_accuracy - initial_accuracy:+.3f})" ) print(f" Tolerance: {ACCURACY_TOL:.3f}") @multi_gpu_test(num_gpus=4) def test_elastic_ep_scaling_uneven(): ""...
fim
vllm-project/vllm
python
<|fim_suffix|> # GPU1 -> [0, 1, 2, 3] # GPU2 -> [0, 1, 2, 3] # New mapping decides to use one expert on 2 GPUs and shuffles # experts on the third GPU, # GPU0 new -> [0, 0, 0, 0] # GPU1 new -> [0, 0, 0, 0] # GPU2 new -> [1, 2, 3, 0] ...
fim
vllm-project/vllm
python
<|fim_suffix|>eam) t.join(timeout=5.0) assert not event._recorded.is_set() def test_reuse_across_multiple_cycles(): wrapper = CpuGpuEvent() record_stream = torch.cuda.Stream() wait_stream = torch.cuda.Stream() NUM_CYCLES = 8 completed_cycles = [] barriers = [threading.Barrier(2) for _...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import random import pytest import torch import torch.distributed from vllm.config import VllmConfig, set_current_vllm_config from vllm.distributed.eplb.eplb_communicator import ( create_eplb_...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project # Test that the interaction between EPLB and FusedMoE Layer is okay from dataclasses import dataclass import pytest import torch from vllm.config import VllmConfig, set_current_vllm_config from v...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project # Test that the interaction between EPLB and FusedMoE Layer is okay for DP w/ NVFP4 from dataclasses import dataclass import pytest import torch from tests.kernels.moe.utils import make_test_quan...
fim
vllm-project/vllm
python