text
stringlengths
14
100k
source
stringclasses
1 value
repo
stringclasses
810 values
language
stringclasses
13 values
<|fim_suffix|>ty_scheduler_output() # Invoke the no-forward path which uses the mixin context manager KVConnectorModelRunnerMixin.kv_connector_no_forward( scheduler_output, vllm_config ) # Verify clear_connector_metadata was called on the connector connector = get_k...
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 from unittest.mock import Mock import pytest from vllm.v1.core.sched.scheduler import Scheduler from vllm.v1.request import Request, RequestStatus from .utils...
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 MagicMock import pytest from vllm.distributed.kv_events import BlockStored from vllm.distributed.kv_transfer.kv_connector.v1.lmcache_connector import ( LMCacheConnecto...
fim
vllm-project/vllm
python
<|fim_suffix|> assumes(SchedulerOutput, "finished_req_ids") assumes(SchedulerOutput, "scheduled_new_reqs", is_instance_of=list) assumes(SchedulerOutput, "num_scheduled_tokens", is_instance_of=dict) assumes(SchedulerOutput, "scheduled_cached_reqs") from vllm.v1.core.sched.output import CachedRequestData...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import asyncio import contextlib import time from unittest.mock import AsyncMock, MagicMock, patch import pytest import torch import zmq.asyncio from vllm.config import set_current_vllm_config fro...
fim
vllm-project/vllm
python
<|fim_suffix|>local_block_ids) == 2 assert req_meta.local_block_ids[0] == fa_blocks assert req_meta.local_block_ids[1] == sw_blocks # Test send path metadata.add_new_req( request_id="send-req", local_block_ids=[fa_blocks, sw_blocks], kv_transfer_params={ "transfer_id...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import threading from unittest.mock import MagicMock from vllm.distributed.kv_transfer.kv_connector.v1.mooncake.mooncake_connector import ( MooncakeConnector, MooncakeConnectorWorker, S...
fim
vllm-project/vllm
python
<|fim_suffix|>s[1], "big") == 128 def test_lookup_key_client_reset_uses_typed_protocol(): """LookupKeyClient.reset() sends RESET_MSG and parses RESP_OK / RESP_ERR.""" vllm_config = _make_vllm_config() with patch( "vllm.distributed.kv_transfer.kv_connector.v1.mooncake.store." "worker.make_...
fim
vllm-project/vllm
python
<|fim_suffix|> {(0, bytes(h)) for h in hs} exists |= {(1, bytes(bh)) for bh in big_hashes} cmap = ExternalCachedBlockPool(exists) _masks, hit = coord.find_longest_cache_hit( hs, max_length=64, cached_block_pool=cmap ) assert hit == 64 assert hit % 32 == 0 # ----- store_mask ----- def...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """End-to-end save->lookup test for MooncakeStoreConnector on a hybrid (SWA + Full) attention config, using a dict-backed mock store.""" import sys import threading import types from unittest.mock i...
fim
vllm-project/vllm
python
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project from types import SimpleNamespace from vllm.distributed.kv_transfer.kv_connector.v1.mooncake.store.data import ( LoadSpec, ReqMeta, RequestTracker, ) from vllm.distributed.kv_transfer.kv_connector.v1...
fim
vllm-project/vllm
python
<|fim_suffix|>up returns full prefix even though the pre-window blocks are absent.""" from vllm.v1.kv_cache_interface import KVCacheGroupSpec, SlidingWindowSpec worker = _make_bare_worker(block_size=16) swa = SlidingWindowSpec( block_size=16, num_kv_heads=8, head_size=64, dtype=None, sliding_wi...
fim
vllm-project/vllm
python
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import importlib.util import uuid from unittest.mock import MagicMock, patch import msgspec import pytest import torch import zmq from tests.conftest import _find_free_port from vllm.config import ( CacheCon...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import filecmp import shutil import tempfile from pathlib import Path from typing import Any from unittest.mock import MagicMock import pytest import torch from tests.v1.kv_connector.unit.utils imp...
fim
vllm-project/vllm
python
<|fim_suffix|> block_size_ratio=None, physical_blocks_per_logical=ratio, ) expected = [3, 7, 403, 407, 801, 802, 901, 902, 1001, 1002, 1101, 1102] assert list(result) == expected, f"Expected {expected}, got {list(result)}" @pytest.mark.cpu_test def test_nixl_metadata_hybrid_ssm_block_ids(): ...
fim
vllm-project/vllm
python
<|fim_suffix|>=================================== # Scheduler: on_new_request # =================================================================== def test_on_new_request_tracks_and_groups(): """Add two reqs to same engine, one to another; verify grouping.""" s = _sched() s.on_new_request(_req(1)) s....
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """Unit tests for NixlPushConnector (scheduler + worker). These tests cover the end-to-end mechanics of the push design without requiring a real NIXL agent or network: * Scheduler stages D registra...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """Unit tests for MultiConnector wrapping NixlConnector + SimpleCPUOffloadConnector. Verifies scheduler-level behavior: HMA support detection, load delegation (first-wins), store-to-all, and connect...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import socket import time import msgspec import msgspec.msgpack import prometheus_client import pytest import zmq from tqdm import tqdm from vllm import LLM, SamplingParams, TokensPrompt from vllm....
fim
vllm-project/vllm
python
<|fim_suffix|>=2) output1 = DummyModelRunnerOutput() output2 = DummyModelRunnerOutput() aggregated = aggregator.aggregate([output1, output2]) assert aggregated is output1 aggregated = aggregated.kv_connector_output assert aggregated.finished_sending is None assert aggregated.finished_recv...
fim
vllm-project/vllm
python
<|fim_suffix|> ) scheduler.add_request(request_remote) scheduler_output = scheduler.schedule() model_runner_output = create_model_runner_output(reqs=[request_remote]) eco = scheduler.update_from_output(scheduler_output, model_runner_output) kv_transfer_params = eco[0].outputs[0].kv_transfer_params...
fim
vllm-project/vllm
python
<|fim_suffix|>ndle no schedule KV block transfer due to not enough remaining KV blocks. """ # NOTE: the KVCacheManager will use 1 null block. # So there are 5 total working blocks. TOTAL_NUM_BLOCKS = 6 vllm_config = create_vllm_config() scheduler = create_scheduler(vllm_config, num_blocks=T...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """Verify that GPU memory is fully released after RixlConnector shutdown on ROCm. Regression test for ROCm/ucx#33: UCX rocm_ipc transport permanently pinned GPU memory via hsa_amd_ipc<|fim_suffix|>y...
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 MagicMock, patch import pytest import<|fim_suffix|>r_metadata assert isinstance(meta, DummyConnectorMetadata) assert len(meta.block_hashes_by_req) == 3 for re...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """Tests for TP mapping and transfer plan utilities. These tests verify that TP mapping produces correct outputs (source ranks, split handles, desc IDs). No GPU or NIXL required. """ from __future_...
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.distributed.kv_transfer.kv_connector.utils import ( EngineTransferInfo, TransferTopology, ) pytestmark = pytest.mark.cpu_test class _FakeAttentionBackend: @st...
fim
vllm-project/vllm
python
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import tempfile from collections import defaultdict from collections.abc import Callable from dataclasses import dataclass from itertools import chain, count from typing import Any, Literal import torch from vll...
fim
vllm-project/vllm
python
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import random import time import uuid import pytest import torch from vllm.platforms import current_platform from vllm.utils.math_utils import round_up from vllm.utils.torch_utils import set_random_seed from vll...
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 Iterable from dataclasses import dataclass import numpy as np import pytest from vllm.v1.kv_offload.base import ( LoadStoreSpec, OffloadingEvent, OffloadKey,...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """Unit tests for SharedOffloadRegion.""" import contextlib import mmap import os import threading import time import uuid import pytest from vllm.utils.system_utils import get_mp_context from vll...
fim
vllm-project/vllm
python
<|fim_suffix|> # kernel copied the source bytes verbatim <|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """Unit test for the Triton ``swap_blocks_batch`` fast-path kernel.""" import pytest import torch from vllm.platforms import current_platfo...
fim
vllm-project/vllm
python
<|fim_suffix|> dtype=torch.float32, sliding_window=128, ), ) def test_parallel_agnostic_enabled_for_single_full_attention(): # tp/rank are collapsed out of the namespace so the cache is shared # across tensor-parallel sizes. fm = make_mapper_from_offloading_spec( t...
fim
vllm-project/vllm
python
<|fim_suffix|>3, (src3, dst3)) # 4th transfer 1->2 (success) src4 = LoadStoreSpec1() dst4 = LoadStoreSpec2() worker.transfer_async(4, (src4, dst4)) assert set(handler1to2.transfers.keys()) == {3, 4} # 5th transfer 2->1 src5 = LoadStoreSpec2() dst5 = LoadStoreSpec1() worker.transfer...
fim
vllm-project/vllm
python
<|fim_suffix|>key(1) in mgr._lookup_state mgr.cleanup("req_b") assert _key(1) not in mgr._lookup_state mgr.shutdown() def test_flush_no_queue_post_when_empty(self): mgr = InMemoryLookupManager() mgr.flush() assert mgr._lookup_queue.empty() mgr.shutdown() ...
fim
vllm-project/vllm
python
<|fim_suffix|>shift : shift + num_bytes] return t.view(dtype).view(num_blocks, block_elements) def _page_aligned_rand_tensor( num_blocks: int, block_elements: int, dtype: torch.dtype = _DTYPE ) -> torch.Tensor: rand_tensor = _page_aligned_zero_tensor(num_blocks, block_elements) rand_tensor[:] = torch....
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """ Mock-based unit tests for ObjectStoreSecondaryTierManager. These tests replace the NIXL backend with an in-memory mock so they run without S3 credentials or a live object store. They verify the ...
fim
vllm-project/vllm
python
<|fim_suffix|> # Both see None (in-flight), but promotion is only queued once assert result_a is None assert result_b is None self._simulate_on_schedule_end() # Only one submit_load call despite two lookups self.secondary_tier1.submit_load.assert_called_once() job_m...
fim
vllm-project/vllm
python
<|fim_suffix|>or_metadata( persistent_batch: list[LogitsProcsRequestParams], pad_len: int ) -> list[list[int]]: """Per-batch-slot output token ids aligned with ``SamplingMetadata`` rows.""" rows: list[list[int]] = [[] for _ in range(pad_len)] for i, req in enumerate(persistent_batch): if i < pad...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project from typing import Any import pytest from tests.utils import create_new_process_for_each_test, set_random_seed from tests.v1.logits_processors.utils import ( DUMMY_LOGITPROC_ARG, DUMMY_LOGI...
fim
vllm-project/vllm
python
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import os import random import sys from typing import Any import openai import pytest import pytest_asyncio from tests.utils import RemoteOpenAIServerCustom from tests.v1.logits_processors.utils import ( DU...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import os import tempfile from enum import Enum, auto from pathlib import Path from typing import Any import torch from tests.utils import requires_spawn_multiprocessing from vllm.config import Vl...
fim
vllm-project/vllm
python
<|fim_suffix|>dition to a list of custom stat loggers. """ # Create engine_args with disable_log_stats=True for this test disabled_log_engine_args = copy.deepcopy(log_stats_enabled_engine_args) disabled_log_engine_args.disable_log_stats = True # Disable default loggers; pass custom stat logger to t...
fim
vllm-project/vllm
python
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import prometheus_client import pytest from vllm.v1.metrics.reader import ( Counter, Gauge, Histogram, Vector, get_metrics_snapshot, ) pytestmark = pytest.mark.cpu_test @pytest.fixture(aut...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """ Tests for the analytic estimators in metrics/flops.py. """ import types from types import SimpleNamespace import pytest from transformers.models.deepseek_v3.configuration_deepseek_v3 import Dee...
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 MagicMock import pytest import ray from vllm.config.model import ModelDType from vllm.sampling_params import SamplingParams from vllm.v1.engine.async_llm import AsyncEngi...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project from vllm.v1.engine import FinishReason from vllm.v1.metrics.stats import ( IterationStats, PrefillStats, PromptTokenStats, RequestStateStats, ) def test_iteration_stats_repr(): ...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """Test that batched_count_greater_than does not trigger 0/1 specialization recompiles when batch_size varies.""" import torch from vllm.platforms import current_platform from vllm.v1.sample.ops.lo...
fim
vllm-project/vllm
python
<|fim_suffix|>name, speculative_config dict, top_logprobs). monkeypatch: pytest fixture for setting env vars. """ from vllm import LLM # The ROCm skinny GEMM kernels (gemm_kernels.cu) are # non-deterministic across LLM instantiations due to persistent # workgroup scheduling and ...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import lm_eval from ...utils import RemoteOpenAIServer # arc-easy uses prompt_logprobs=1, logprobs=1 TASK = "arc_easy" FILTER = "acc_norm,none" RTOL = 0.03 EXPECTED_VALUE = 0.62 # FIXME(rob): ena...
fim
vllm-project/vllm
python
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project from typing import Any from unittest.mock import Mock import pytest import torch import torch.nn.functional as F from tests.v1.sample.utils import create_allowed_token_ids from vllm.platforms import current_plat...
fim
vllm-project/vllm
python
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import numpy as np import pytest import torch from tests.v1.sample.utils import create_allowed_token_ids from vllm.platforms import current_platform from vllm.utils.platform_utils import is_pin_memory_available ...
fim
vllm-project/vllm
python
<|fim_suffix|>utput[0].outputs[0].logprobs assert len(prompt_logprobs) > 1 assert len(sampled_logprobs) > 1 for all_logprobs in (prompt_logprobs[1:], sampled_logprobs): for logprobs in all_logprobs: assert 3 <= len(logprobs) <= 4 assert all(lp.decoded_token is None for lp in ...
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 import Generator from vllm.platforms import current_platform from vllm.triton_utils import HAS_TRITON from vllm.utils.torch_utils import set_random_seed from vl...
fim
vllm-project/vllm
python
<|fim_suffix|>_detok_str_matches_non_incr_detok_str( incremental_detokenization_str: str, non_incremental_detokenization_str: str, msg: str, ) -> None: """Compare incrementally detok. text to non-incrementally detok. text Fail if the strings mismatch after non-alphanumeric characters are stripped ...
fim
vllm-project/vllm
python
<|fim_suffix|> sc.write_text("\n".join(lines) + "\n") monkeypatch.setenv( "PYTHONPATH", os.pathsep.join(filter(None, [str(tmp_path), os.getenv("PYTHONPATH")])), ) return install <|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contri...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """Test that we handle a startup Error and shutdown.""" import pytest from tests.utils import wait_for_gpu_memory_to_clear from tests.v1.shutdown.utils import ( SHUTDOWN_TEST_THRESHOLD_BYTES, ...
fim
vllm-project/vllm
python
<|fim_suffix|> that we would need to call this. async_llm.shutdown() @pytest.mark.timeout(SHUTDOWN_TEST_TIMEOUT_SEC) @pytest.mark.parametrize("enable_multiprocessing", [True]) @pytest.mark.parametrize("tensor_parallel_size", [2, 1]) @pytest.mark.parametrize("model", MODELS) def test_llm_model_error( monkeypat...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """Test error handling in Processor. Should not impact other reqs.""" import asyncio import pytest from tests.v1.shutdown.utils import SHUTDOWN_TEST_TIMEOUT_SEC from vllm import SamplingParams fro...
fim
vllm-project/vllm
python
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """Test that we handle a startup Error and shutdown.""" import inspect import pytest from tests.utils import wait_for_gpu_memory_to_clear from tests.v1.shutdown.utils import ( SHUTDOWN_TEST_THRESHOLD_BYTES,...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Ap<|fim_suffix|> to the vLLM project """Shutdown test utils""" SHUTDOWN_TEST_TIMEOUT_SEC = 120 SHUTDOWN_TEST_THRESHOLD_BYTES = 2 * 2**30 <|fim_middle|>ache-2.0 # SPDX-FileCopyrightText: Copyright contributors<|endoftext|>
fim
vllm-project/vllm
python
<|fim_suffix|> f"Accuracy too low: {success_count}/{test_count} matched '{expected}'" ) def _latency_test(llm: LLM, lazy: bool = False): """Verify CPU cache hit is faster than cold compute.""" sampling_params = SamplingParams(max_tokens=1, seed=42) prompt_token_ids = [0] * 10001 num_times...
fim
vllm-project/vllm
python
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """Unit tests for SimpleCPUOffloadScheduler.""" from __future__ import annotations from dataclasses import dataclass import torch from vllm import SamplingParams from vllm.config import ( CacheConfig, ...
fim
vllm-project/vllm
python
<|fim_suffix|>roject <|fim_prefix|># SPDX-License-Identifier: Apache-2.0 <|fim_middle|># SPDX-FileCopyrightText: Copyright contributors to the vLLM p<|endoftext|>
fim
vllm-project/vllm
python
<|fim_suffix|>xp) in enumerate( zip(actual_per_pos, expected_per_pos) ): if exp > 0: min_expected = exp * (1 - rtol) assert actual >= min_expected, ( f"Per-position acceptance length regre...
fim
vllm-project/vllm
python
<|fim_suffix|> = torch.tensor([5], dtype=torch.int64) assert _backup_buggy(seq_lens, requests, batch) == [-1] assert _backup_fixed(requests, batch) == [1001] # with inflation: still -1, fixed still correct seq_lens_inf = torch.tensor([8], dtype=torch.int64) assert _backup_buggy(...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project from types import SimpleNamespace import torch from tests.v1.core.utils import create_requests from vllm.config import ( CacheConfig, ModelConfig, ParallelConfig, SchedulerConfig, ...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project from unittest import mock import numpy as np import pytest import torch from tests.utils import get_attn_backend_list_based_on_platform from tests.v1.attention.utils import ( BatchSpec, cr...
fim
vllm-project/vllm
python
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """Unit tests for the fused EAGLE slot mapping kernel.""" import pytest import torch from vllm.platforms import current_platform from vllm.v1.spec_decode.utils import ( PADDING_SLOT_ID, eagle_step_update...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import json from unittest import mock import numpy as np import pytest import torch from transformers import CLIPVisionConfig, LlamaConfig, LlavaConfig, PretrainedConfig from tests.v1.attention.ut...
fim
vllm-project/vllm
python
<|fim_suffix|>a = _make_sampling_metadata(batch_size) _seed_default_generator(12345) probs = logits.softmax(dim=-1, dtype=torch.float32) q = torch.empty(probs.shape, dtype=torch.float64, device=probs.device) q.exponential_() expected_ids = q.reciprocal_().mul_(probs).argmax(dim=-1).view(-1) _s...
fim
vllm-project/vllm
python
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """Test whether spec decoding handles the max model length properly.""" import pytest from tests.utils import get_attn_backend_list_based_on_platform from vllm import LLM, SamplingParams from vllm.config import ...
fim
vllm-project/vllm
python
<|fim_suffix|>device), torch.arange(seq_lens[1], device=device), ] ) target_hidden_states = torch.randn(total_tokens, hidden_size, device=device) next_token_ids = torch.randint( 0, vocab_size, (batch_size,), dtype=torch.int32, device=device ) sampling_metadata = mock.Magi...
fim
vllm-project/vllm
python
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import numpy as np from vllm.config import ( ModelConfig, SpeculativeConfig, VllmConfig, ) from vllm.v1.spec_decode.ngram_proposer import ( NgramProposer, _find_longest_matched_ngram_and_propo...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import math import pytest import torch from vllm.v1.worker.gpu.spec_decode.rejection_sampler_utils import ( rejection_sample, ) VOCAB_SIZE = 4096 # Skip if no CUDA - Triton kernel requires G...
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 import torch from tests.evals.gsm8k.gsm8k_eval import evaluate_gsm8k_offline from tests.utils import large_gpu_mark from vllm import LLM from vllm.config import Spe...
fim
vllm-project/vllm
python
<|fim_suffix|>config.model}" ) vllm_outputs = vllm_model.generate_greedy(example_prompts, max_tokens=20) assert vllm_outputs, f"No outputs generated for speculators model {model_path}" <|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vL...
fim
vllm-project/vllm
python
<|fim_suffix|> unconditional_to_conditional_rates([1.0, 1.0, 1.0]) == pytest.approx( [1.0, 1.0, 1.0] ) @pytest.mark.parametrize( "length,n,expected", [ (2.6, 3, [1.0, 0.6, 0.0]), (1.0, 3, [0.0, 0.0, 0.0]), (4.0, 3, [1.0, 1.0, 1.0]), (2.0, 3, [1.0, 0.0, 0.0]), ...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import asyncio from collections.abc import AsyncGenerator from unittest.mock import AsyncMock, MagicMock import pytest <|fim_suffix|>eam()) return queue return queue llm.a...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """Unit tests for GPUModelRunner._update_streaming_request function.""" from unittest.mock import Mock import pytest from vllm.multimodal.inputs import ( MultiModalFeatureSpec, MultiModal...
fim
vllm-project/vllm
python
<|fim_suffix|>.float32, cache_draft_logits=False, ) runner.encoder_cache = None runner.model_state = Mock() runner.block_tables = Mock() runner.lora_state = Mock() runner.sampler = None runner.prompt_logprobs_worker = None runner.is_last_pp_rank = False # Mock staged writes ...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import unittest from unittest.mock import MagicMock import torch from vllm.config import DeviceConfig, VllmConfig from vllm.multimodal.inputs import ( MultiModalFeatureSpec, MultiModalKwar...
fim
vllm-project/vllm
python
<|fim_suffix|>immediately after init # Before _check_grammar_completion is called, async mode should have a Future raw_grammar = request.structured_output_request._grammar if async_grammar: assert isinstance(raw_grammar, Future), ( "Async mode should store a Future before completion" ...
fim
vllm-project/vllm
python
<|fim_suffix|># Enable enable_in_reasoning manager_with_reasoner.enable_in_reasoning = True # Should always return True when enable_in_reasoning is enabled result = manager_with_reasoner.should_advance( mock_request_with_structured_output ) assert result is True ...
fim
vllm-project/vllm
python
<|fim_suffix|> time.sleep(10) return "never" pattern = r"(a+)+b" with ( patch("vllm.envs.VLLM_REGEX_COMPILATION_TIMEOUT_S", 1), pytest.raises(ValueError, match=r"\(a\+\)\+b"), ): compile_regex_with_timeout(slow_compile, pattern) <|fim_prefi...
fim
vllm-project/vllm
python
<|fim_suffix|>unsupported_json_features_by_type(schema_type, request): schemas = request.getfixturevalue(schema_type) for schema in schemas: assert has_xgrammar_unsupported_json_features(schema), ( f"Schema should be unsupported: {schema}" ) def test_supported_json_features(support...
fim
vllm-project/vllm
python
<|fim_suffix|> StructuredOutputsConfig(), tokenizer=None, ) <|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """Request-time validation of structured output requests.""" import pytest from vllm.config import StructuredOutputsConfig f...
fim
vllm-project/vllm
python
<|fim_suffix|> An unregistered subclass of a registered spec resolves via MRO to its parent's manager — this is intentional registry behaviour. """ @dataclass(frozen=True, kw_only=True) class _ImplicitlyInheritedSpec(FullAttentionSpec): pass spec = _Implicitly...
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.engine.arg_utils import AsyncEngineArgs MODEL = "meta-llama/Llama-3.2-1B-Instruct" def test_unsupported_conf<|fim_suffix|> speculative_config={ "model"...
fim
vllm-project/vllm
python
<|fim_suffix|> ] assert sliced.cu_num_generated_tokens is None def test_slice_single_request(self): """Test slicing a single request""" sliced = self.logprobsLists.slice_request(1, num_positions=3) assert len(sliced.logprob_token_ids) == 3 assert sliced.logprob_token_i...
fim
vllm-project/vllm
python
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project from vllm.v1.request import RequestStatus def test_request_status_fmt_str(): """Test that the string representation of RequestStatus is correct.""" assert f"{RequestStatus.WAITING}" == "WAITING" asse...
fim
vllm-project/vllm
python
<|fim_suffix|>rIpcSender(tensor_queues[0]) encoder = MsgpackEncoder(oob_tensor_consumer=sender) # Create decoder with IPC receiver receiver = TensorIpcReceiver(tensor_queues[0]) decoder = MsgpackDecoder(RequestWithTensor, oob_tensor_provider=receiver) # Create a request with None for the tensor fi...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """Tests for tensor IPC queue functionality.""" import contextlib import multiprocessing as mp from dataclasses import dataclass from multiprocessing.synchronize import Barrier as BarrierType from ...
fim
vllm-project/vllm
python
<|fim_suffix|>need to wait specifically for the llm_request span to appear. timeout = 15 deadline = time.time() + timeout llm_request_spans = [] while time.time() < deadline: all_spans = trace_service.get_all_spans() llm_request_spans = [s for s in all_spans if s[...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import pytest import regex as re import requests from tests.utils import RemoteOpenAIServer # Prometheus metrics utilities for testing def get_prometheus_metrics(server: RemoteOpenAIServer) -> di...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import inspect from collections.abc import Sequence import numpy as np import pytest import torch from vllm.platforms import current_platform from vllm.sampling_params import SamplingParams from v...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project from types import SimpleNamespace from unittest.mock import Mock import numpy as np import pytest import torch import torch.nn as nn import vllm.v1.worker.gpu_model_runner as gpu_model_runner_modu...
fim
vllm-project/vllm
python
<|fim_suffix|>om_mapping_kwargs = kwargs state = cls(kwargs["parallel_config"], kwargs["device"]) state.built_from_mapping = True return state def _make_runner(**overrides: Any) -> Any: runner: Any = mrv2.GPUModelRunner.__new__(mrv2.GPUModelRunner) runner.device = torch.device("cpu") ...
fim
vllm-project/vllm
python
<|fim_suffix|>cheme", False), ("scheme-no-slashes:", False), ("://no-scheme", False), ], ) def test_is_uri_path(self, path, expected): """Test that _is_uri_path correctly identifies URI vs local paths.""" assert _is_uri_path(path) == expected <|fim_prefix|># SPDX-...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project from types import SimpleNamespace from unittest.mock import MagicMock import pytest import torch from vllm.config.parallel import ParallelConfig from vllm.config.weight_transfer import WeightTrans...
fim
vllm-project/vllm
python
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import pytest import torch from vllm.entrypoints.pooling.scoring.utils import compute_maxsim_score from vllm.pooling_params import LateInteractionParams, PoolingParams from vllm.v1.pool.late_interaction import (...
fim
vllm-project/vllm
python