text
stringlengths
14
100k
source
stringclasses
1 value
repo
stringclasses
810 values
language
stringclasses
13 values
<|fim_suffix|> with monkeypatch.context() as m: m.setenv("VLLM_PLUGINS", "dummy_stat_logger") factories = load_stat_logger_plugin_factories() assert len(factories) == 1, f"Expected 1 factory, got {len(factories)}" assert factories[0] is DummyStatLogger, ( f"Expected Dummy...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import importlib.util import io import imagehash imp<|fim_suffix|>nAIServer from vllm.entrypoints.pooling.pooling.protocol import IOProcessorResponse pytestmark = pytest.mark.skipif( importlib....
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """Test model set-up and inference for quantized HF models supported on the GPU backend using FPQuant. Validating the configuration and printing results for manual checking. Run `pytest tests/quant...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import torch BFLOAT16_EXP_BIAS = 127 BFLOAT16_MANTISSA_BITS = 7 BFLOAT16_EXP_BITS = 8 FLOAT16_EXP_BIAS = 15 FLOAT16_MANTISSA_BITS = 10 FLOAT16_EXP_BITS = 5 FLOAT8_E8M0_MAX_EXP = 127 FLOAT4_EXP_BIA...
fim
vllm-project/vllm
python
<|fim_suffix|>ers.0.self_attn.qkv_proj": assert isinstance(submodule.quant_method, AutoGPTQLinearMethod) break llm.apply_model(check_model) outputs = llm.generate_greedy([PROMPT], max_tokens=8) assert outputs assert len(outputs[0][1]) > 0 def t...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """Test model set-up<|fim_suffix|>}") <|fim_middle|> and inference for quantized HF models supported on the AutoRound. Validating the configuration and printing results for manual checking. Run `py...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import json import os from typing import Any import pytest from tests.utils import RemoteOpenAIServer from vllm.platforms import current_platform if not current_platform.is_device_capability_fami...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """Test model set-up and weight loading for llmcompressor-quantized models. Run `pytest tests/quantization/test_compressed_tensors.py`. """ from unittest.mock import Mock import pytest import torc...
fim
vllm-project/vllm
python
<|fim_suffix|>uantization_arg} case" ) <|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """Tests whether Marlin models can be loaded from the autogptq config. Run `pytest tests/quantization/test_configs.py --forked`. """ from dataclasses impo...
fim
vllm-project/vllm
python
<|fim_suffix|> ["--enforce_eager"], ["--enforce_eager", "--cpu-offload-gb", "1"], max_wait_seconds=480, include_seeded_sampling=False, ) <|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project # Expanded quantized model tests...
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.platforms import current_platform if not current_platform.is_cpu(): pytest.skip("skipping CPU-only tests", allow_module_level=True) MODELS = [ "TheBloke/TinyLlama-1...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """Tests for Cutlass W4A16 (Machete) kernel on Hopper. Verifies that W4A16 quantized models loaded through vllm select the MacheteLinearKernel on sm_90 GPUs, that weights are correctly repacked, and...
fim
vllm-project/vllm
python
<|fim_suffix|>force_eager=True, quantization="experts_int8", ) as vllm_model: vllm_model.generate_greedy(example_prompts, max_tokens) <|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project # flake8: noqa """Tests experts_int8 quantiz...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """Tests whether FP8 computation is enabled correctly. Run `pytest tests/quantization/test_fp8.py --forked`. """ import logging import pytest import regex as re import torch from tests.quantizati...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """Tests for FP8 per-channel online quantization. Per-output-channel weight scale + dynamic per-token activation scale. bf16/fp16 checkpoints are quantized at load time with one fp32 scale per outpu...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """ Tests for MXFP4 MoE oracle backend selection on mi355x (GFX950). These tests run on real hardware — no mocks. Skipped on non-GFX950 platforms. """ import pytest import torch from vllm.model_ex...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copy<|fim_suffix|> get_dynamic_override(config, layer_name=name, key="group_size") == 32 ) assert not get_dynamic_override( config, layer_n...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """Tests whether vllm correctly load and run gptq_v2 format checkpoints. Run `pytest tests/quantization/test_gptq_v2.py --forked`. Note: 2/3-bit GPTQ models are no longer supported after the consol...
fim
vllm-project/vllm
python
<|fim_suffix|>d( vllm_runner, model_id: str, lm_head_quantized: bool, monkeypatch, ) -> None: # `LLM.apply_model` requires pickling a function. monkeypatch.setenv("VLLM_ALLOW_INSECURE_SERIALIZATION", "1") with vllm_runner( model_id, dtype=torch.float16, max_model_len=2048, enforce_ea...
fim
vllm-project/vllm
python
<|fim_suffix|>t_accuracy in accuracy_numbers.items(): measured_accuracy = results["results"][task]["acc,none"] assert ( measured_accuracy - rtol < expect_accuracy and measured_accuracy + rtol > expect_accuracy ), f"Expected: {expect_accuracy} | Measured: {measured_accura...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """Test ModelOpt quantization method setup and weight loading. Run `pytest tests/quantization/test_modelopt.py`. """ import os from typing import Any, NoReturn from unittest.mock import MagicMock, ...
fim
vllm-project/vllm
python
<|fim_suffix|>layer = SimpleNamespace( w13_qweight=torch.empty(1, 2), w2_qweight=torch.empty(1, 2), activation=MoEActivation.GELU_TANH, apply_router_weight_on_input=False, global_num_experts=1, expert_map=None, ) output = method.apply( layer, x=to...
fim
vllm-project/vllm
python
<|fim_suffix|> for layer_idx in range(len(model.model.layers)): o_proj = model.model.layers[layer_idx].self_attn.o_proj if layer_idx == 1: assert isinstance(o_proj.quant_method, UnquantizedLinearMethod) else: ...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """Tests for per-token-head KV cache quantization (INT8 and FP8). Covers: - Per-token-head Triton reshape-and-cache kernel - Round-trip quantize/dequantize accuracy - process_weights_after_loading e...
fim
vllm-project/vllm
python
<|fim_suffix|>28 dynamic # activations. Pinning this so renames in QUANT_KEY_NAMES don't quietly # rewire the kernel dispatch. spec = QuantSpec(weight="fp8_per_block_static", activation="fp8_per_block_dynamic") assert spec.weight == kFp8Static128BlockSym assert spec.activation == kFp8Dynamic128Sym <...
fim
vllm-project/vllm
python
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """Test model set-up and weight loading for quark-quantized models. Run `pytest tests/quantization/test_quark.py`. See also `tests/kernels/moe/test_ocp_mx_moe.py`. """ import importlib.metadata from dataclasses...
fim
vllm-project/vllm
python
<|fim_suffix|>should raise a debug message when re-registering it. with caplog_vllm.at_level(logging.DEBUG, logger="vllm"): register_quantization_config("custom_quant")(CustomQuantConfig) assert any( "The quantization method 'custom_quant' already exists" in message for message in caplo...
fim
vllm-project/vllm
python
<|fim_suffix|> model_name=model_name, quantization="torchao", dtype="bfloat16", pt_load_map_location=f"{DEVICE_TYPE}:0", hf_overrides=hf_overrides, enforce_eager=True, ) as llm: def has_int4_preshuffled_tensor_weight(model): return isinstance( ...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import torch from vllm.model_executor.layers.quantization.utils.flashinfer_utils import ( align_trtllm_fp4_moe_hidden_dim_for_fi, ) def test_align_trtllm_fp4_moe_hidden_dim_noop(): w13 = ...
fim
vllm-project/vllm
python
<|fim_suffix|> slot_mapping, PiT, midpoints, mse_bits=cfg.key_mse_bits, key_packed_size=cfg.key_packed_size, value_quant_bits=cfg.effective_value_quant_bits, key_fp8=cfg.key_fp8, ) # Decode: use key as query so attention = softmax...
fim
vllm-project/vllm
python
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import logging import regex as re from vllm.model_executor.layers.quantization import get_quantization_config from vllm.platforms import current_platform def is_quant_method_supported(quant_method: str) -> bo...
fim
vllm-project/vllm
python
<|fim_suffix|> reasoning2, content2 = run_reasoning_extraction(parser2, [model_output2]) assert reasoning2 == "Reasoning2" assert content2 == "Content2" # Verify tokens are different assert parser1.start_token != parser2.start_token assert parser1.end_token != parser2.end_...
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 tests.reasoning.utils import run_reasoning_extraction from vllm.reasoning import ReasoningParser, ReasoningParserManager parser_name = "de...
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.entrypoints.openai.chat_completion.protocol import ChatCompletionRequest from vllm.entrypoints.openai.engine.protocol import DeltaMess...
fim
vllm-project/vllm
python
<|fim_suffix|>arser = ReasoningParserManager.get_reasoning_parser(parser_name)( ernie45_tokenizer ) reasoning, content = run_reasoning_extraction( parser, output_tokens, streaming=streaming ) print() assert reasoning == param_dict["reasoning"] assert content == param_dict["con...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import pytest from tests.reasoning.utils import run_reasoning_extraction from vllm.entrypoints.openai.chat_completion.protocol import ( ChatCompletionRequest, ) from vllm.reasoning import Reaso...
fim
vllm-project/vllm
python
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import pytest from transformers import AutoTokenizer from tests.reasoning.utils import run_reasoning_extraction from vllm.reasoning import ReasoningParser, ReasoningParserManager parser_name = "glm45" start_tok...
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.mock import Mock import pytest from transformers import AutoTokenizer from vllm.entrypoints.mcp.tool_server import ToolServer from vllm.reasoning import ReasoningParser f...
fim
vllm-project/vllm
python
<|fim_suffix|> pytest.param( STREAMING_5, id="Reasoning content has started", ), pytest.param( STREAMING_6, id="Response special sequence has started", ), pytest.param( STREAMING_7, id="Response special sequence reset", ), pytest.param( ...
fim
vllm-project/vllm
python
<|fim_suffix|> id="with_think_enabled", ), pytest.param( True, WITH_THINK_STREAM, {"thinking": True}, id="with_think_stream_enabled", ), pytest.param( False, THINKING_DISABLED, {"thinking": False}, id="thinking_disabled", ), pyte...
fim
vllm-project/vllm
python
<|fim_suffix|>ct["content"] <|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import pytest from transformers import AutoTokenizer from tests.reasoning.utils import run_reasoning_extraction from vllm.reasoning import ReasoningParser, ReasoningPars...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import pytest from tests.reasoning.utils import run_reasoning_extraction from vllm.reasoning import ReasoningParser, ReasoningParserManager from vllm.reasoning.hy_v3_reasoning_parser import HYV3Reas...
fim
vllm-project/vllm
python
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project from unittest.mock import MagicMock import pytest from vllm.entrypoints.openai.chat_completion.protocol import ChatCompletionRequest from vllm.entrypoints.openai.engine.protocol import DeltaMessage from vllm.re...
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 tests.reasoning.utils import run_reasoning_extraction from vllm.reasoning import ReasoningParser, ReasoningParserManager parser_name = "mi...
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 tests.reasoning.utils import run_reasoning_extraction from vllm.reasoning import ReasoningParser, ReasoningParserManager parser_name = "mi...
fim
vllm-project/vllm
python
<|fim_suffix|> pytest.param( False, COMPLETE_REASONING_WITH_THINK, id="complete_reasoning_with_think", ), pytest.param( True, COMPLETE_REASONING_WITH_THINK, id="complete_reasoning_with_think_streaming", ), pytest.param( False, MULTIPLE_LIN...
fim
vllm-project/vllm
python
<|fim_suffix|>reasoning == "4" assert content == "" <|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project from typing import TypedDict import pytest import regex as re from tests.reasoning.utils import run_reasoning_extraction from vllm.entrypoin...
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 tests.reasoning.utils import run_reasoning_extraction from vllm.reasoning import ReasoningParser, ReasoningParserManager parser_name = "ol...
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 tests.reasoning.utils import ( StreamingReasoningReconstructor, run_reasoning_extraction, run_reasoning_extraction_streaming, )...
fim
vllm-project/vllm
python
<|fim_suffix|>def test_streaming_delta_processing(seedoss_tokenizer): """Test streaming processing with small deltas.""" parser_cls = ReasoningParserManager.get_reasoning_parser(parser_name) parser = parser_cls(seedoss_tokenizer) # Test streaming with incremental tokens deltas = ["Some ", "reasonin...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import pytest from tests.reasoning.utils import run_reasoning_extraction from vllm.reasoning import ReasoningParser, ReasoningParserManager from vllm.tokenizers import get_tokenizer parser_name = ...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project from vllm.entrypoints.openai.chat_completion.protocol import ChatCompletionRequest from vllm.entrypoints.openai.engine.protocol import DeltaMessage from vllm.reasoning import ReasoningParser from vl...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLL<|fim_suffix|>ec_only_prompt({"prompt": [1, 2, 3], "cache_salt": "abc"}) def test_parse_dec_only_prompt_rejects_non_string_prompt_list(): with pytest.raises(TypeError, match="Prompt text should be a stri...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """Offline unit tests for `prompt_embeds` chat-completion content parts.""" from __future__ import annotations import inspect import io from typing import Final from unittest import mock import p...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import io from collections.abc import Sequence from dataclasses import dataclass from typing import Any import pybase64 import pytest import torch from vllm.config import ModelConfig from vllm.inp...
fim
vllm-project/vllm
python
<|fim_suffix|> "properties": { "city": { "type": "string", "description": "City name", } }, "required": ["city"], }, ...
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 import ModelConfig from vllm.entrypoints.chat_utils import load_chat_template from vllm.entrypoints.openai.chat_completion.protocol import ChatCompletionRequest from ...
fim
vllm-project/vllm
python
<|fim_suffix|>nfig, parallel_config=MockParallelConfig()), tokenizer=mock_tokenizer, ) task = mock_renderer.render_messages_async([], ChatParams()) # Ensure the event loop is not blocked blocked_count = 0 for _i in range(20): # Check over ~2 seconds start = time.perf_counter() ...
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.assets.image import ImageAsset from vllm.assets.video import VideoAsset from vllm.config import CacheConfig, ModelConfig, VllmConfig from vllm.multimodal.parse import parse_...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """ Tests verify that malicious sparse tensors are rejected before they can trigger out-of-bounds memory writes during to_dense() operations. """ import io import numpy as np import pybase64 as bas...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """Unit tests for BaseRenderer.warmup MM-warmup behavior. These tests exercise: - Zero-limit modalities are filtered from mm_counts passed to get_dummy_processor_inputs (e.g. --limit-mm-per-pr...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import csv import importlib import importlib.util import os import pytest import torch from tests.utils import TestFP8Layer from vllm._aiter_ops import rocm_aiter_ops from vllm.model_executor.kern...
fim
vllm-project/vllm
python
<|fim_suffix|> assert scales_compiled.shape == (M, expected_scale_cols) # Verify results match assert torch.allclose( x_fp8_compiled.to(torch.float32), x_fp8_eager.to(torch.float32), rtol=1e-2, atol=1e-2, ) assert torch.allclose(scales_compiled, scales_eager, rtol=1e-3, ...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """ Unit tests for AITER MLA FP8 support detection. These tests verify that the _check_aiter_mla_fp8_support() function correctly handles various error conditions without crashing. """ from unittes...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """Compare the outputs of HF and vLLM when using beam search. Run `pytest tests/samplers/test_beam_search.py`. """ import json import jsonschema import pytest from transformers import AutoModelFor...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """Make sure ignore_eos works. Run `pytest tests/samplers/test_ignore_eos.py`. """ import pytest from vllm import SamplingParams<|fim_suffix|>pytest.mark.parametrize("model", MODELS) @pytest.mark....
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 import SamplingParams from vllm.logprobs import FlatLogprobs MODELS = ["distilbert/distilgpt2"] MAX_TOKENS = 5 NUM_TOP_LOGPROBS = 5 NUM_PROMPT_LOGPROBS = 7 MAX_LOGPROBS = m...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """Make sure bad_words works. Run `pytest tests/samplers/test_no_bad_words.py`. """ from transformers import AutoTokenizer from vllm import LLM, SamplingParams def _generate( llm: LLM, ...
fim
vllm-project/vllm
python
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """Tests that non-finite float values (NaN, Inf) are rejected by SamplingParams validation, preventing them from propagating to GPU kernels. Addresses advisory GHSA-7h4p-rffg-7823. """ import math import pytest...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """Integration test for custom proposer class in speculative decoding. Usage: .venv/bin/python test_custom_proposer.py """ import os import torch from vllm import LLM, SamplingParams from vl...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project # Description: Test the lazy import module # The utility function cannot be placed in `vllm.utils` # this needs to be a standalone script import sys # List of m<|fim_suffix|> import. for module_nam...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """ Tests for the UvicornAccessLogFilter class. """ import logging from vllm.logging_utils.access_log_filter import ( UvicornAccessLogFilter, create_uvicorn_log_config, ) class TestUvicor...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project from vllm.v1.attention<|fim_suffix|>**kwargs): super().__init__() def forward(self, *args, **kwargs): """Mock forward pass.""" pass class CustomAttentionBackend(Attenti...
fim
vllm-project/vllm
python
<|fim_suffix|>ValueError, match="renderer-num-workers"): ModelConfig(mm_model, renderer_num_workers=4) # Should raise: multi-worker + explicit cache size with pytest.raises(ValueError, match="renderer-num-workers"): ModelConfig(mm_model, renderer_num_workers=2, mm_processor_cache_gb=1.0) #...
fim
vllm-project/vllm
python
<|fim_suffix|>vllm.__version__ != "dev" assert vllm.__version_tuple__ != (0, 0, "dev") <|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import vllm def tes<|fim_middle|>t_embedded_commit_defined(): assert hasattr(vllm, "__version__") ...
fim
vllm-project/vllm
python
<|fim_suffix|>t_with_choices( "TEST_ENV", ["default"], ["option1", "option2"] ) assert env_func() == ["default"] def test_only_commas_returns_default(self): """Test that string with only commas returns default.""" with patch.dict(os.environ, {"TEST_ENV": ",,,...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """Tests for the FxGraphCachePickler.dumps ValueError patch in env_override.py. Validates that _apply_fxgraphcache_pickle_patch correctly wraps a pickler's dumps method to convert ValueError into a ...
fim
vllm-project/vllm
python
<|fim_suffix|>ep_token] processed_inputs = input_preprocessor.preprocess(prompt) assert sep_token_id in processed_inputs["prompt_token_ids"] <|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import pytest from vllm.config import ModelConf...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import os import sys from types import SimpleNamespace from unittest import mock import pytest from vllm.triton_utils import jit_monitor @pytest.fixture(autouse=True) def _reset_monitor(): ""...
fim
vllm-project/vllm
python
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import enum import json import logging import os import sys import tempfile from dataclasses import dataclass from json.decoder import JSONDecodeError from tempfile import NamedTemporaryFile from typing import Any...
fim
vllm-project/vllm
python
<|fim_suffix|> logprobs, token_ids=[1], logprobs=[0.1], decoded_tokens=["1"], rank=10, num_logprobs=-1, ) append_logprobs_for_next_position( logprobs, token_ids=[2, 3], logprobs=[0.2, 0.3], decoded_tokens=["2", "3"], rank=11, ...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contrib<|fim_suffix|>="test prompt", prompt_token_ids=[1, 2, 3], prompt_logprobs=None, outputs=[], finished=False, example_arg_added_in_new_version="some_value", ) assert output is not...
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 import pytest from tests.models.utils import EmbedModelInfo from vllm import PoolingParams from vllm.config import ModelConfig, PoolerConfig EMBEDDING_MODELS = [ ...
fim
vllm-project/vllm
python
<|fim_suffix|>sent assert "MY_FLAG" in result <|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """Tests for vllm.ray.ray_env — env var propagation to Ray workers.""" import os from unittest.mock import patch from vllm.ray.ray_env import g...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """Tests for vllm.v1.executor.ray_env_utils.""" import os from unittest.mock import patch from vllm.v1.executor.ray_env_utils import get_driver_env_vars WORKER_VARS: set[str] = { "CUDA_VISIBLE...
fim
vllm-project/vllm
python
<|fim_suffix|>mory allocated for PyTorch and others should be less than 50MB. # Usually, it's around 10MB. allocated = torch.accelerator.memory_allocated() assert allocated < 50 * 1024 * 1024 def test_model_from_modelscope(monkeypatch: pytest.MonkeyPatch): # model: https://www.modelscope.ai/models/qwe...
fim
vllm-project/vllm
python
<|fim_suffix|>ax} != {t.max()}" <|fim_prefix|># SPDX-License-Identifier: Apache-2.0 <|fim_middle|># SPDX-FileCopyrightText: Copyright contributors to the vLLM project import pytest import torch from vllm.scalar_type import scalar_types @pytest.mark.parametrize( "type_tuple", ( (-8, 7, scalar_types.i...
fim
vllm-project/vllm
python
<|fim_suffix|>2 = np.random.randint(0, 100) torch_random_value_2 = torch.randint(0, 100, (1,)).item() assert random_value_1 == random_value_2 assert np_random_value_1 == np_random_value_2 assert torch_random_value_1 == torch_random_value_2 <|fim_prefix|># SPDX-License-Iden<|fim_middle|>tifier: Apache-2...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import torch from vllm.sequence import IntermediateTensors def test_sequence_intermediate_tensors_equal(): class AnotherIntermediateTensors(IntermediateTensors): pass intermediat...
fim
vllm-project/vllm
python
<|fim_suffix|>ules.pop("triton", None) sys.modules.pop("triton.language", None) sys.modules.pop("vllm.triton_utils", None) sys.modules.pop("vllm.triton_utils.importing", None) # mock triton not being installed with mock.patch.dict(sys.modules, {"triton": None}): from vllm.triton_utils impor...
fim
vllm-project/vllm
python
<|fim_suffix|>n.__version_tuple__", version_tuple): assert version._prev_minor_version_was(version_str) == expected <|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project from unittest.mock import patch import pytest from vllm import version ...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import os from unittest.mock import patch import pytest from vllm.envs import get_vllm_port def test_get_vllm_port_not_set(): """Test when VLLM_PORT is not set.""" with patch.dict(os.env...
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 mock_open, patch from vllm.platforms import _is_amd_zen_cpu def test_is_amd_zen_cpu_detects_amd_with_avx512(): cpuinfo = "vendor_id: AuthenticAMD\nflags: avx avx2 avx...
fim
vllm-project/vllm
python
<|fim_suffix|>o rename # this module to avoid conflicting with HF's `tokenizers` package <|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # S<|fim_middle|>PDX-FileCopyrightText: Copyright contributors to the vLLM project # NOTE: Since CI runs the tests from the `tests` directory, it is necessary t<|endoftext|>
fim
vllm-project/vllm
python
<|fim_suffix|>tokenizer = get_tokenizer("deepseek-ai/DeepSeek-V3", tokenizer_mode="deepseek_v32") assert isinstance(tokenizer, HfTokenizer) # Verify it's a fast tokenizer (required for FastIncrementalDetokenizer) assert isinstance(tokenizer, PreTrainedTokenizerFast) assert "DSV32" in tokenizer.__class_...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import json from pathlib import Path from types import SimpleNamespace import pytest from vllm.entrypoints.chat_utils import parse_chat_messages from vllm.renderers.registry import RENDERER_REGIST...
fim
vllm-project/vllm
python
<|fim_suffix|>okens.insert(0, tokenizer.bos_token_id) truth_tokens.append(tokenizer.eos_token_id) new_truth = tokenizer.decode( truth_tokens, skip_special_tokens=skip_special_tokens, **extra_decode_args ) if with_prompt: num_prompt_tokens = len( tokenizer(truth[: len(truth)...
fim
vllm-project/vllm
python
<|fim_suffix|>hread_pool on unpickling, which used to fall off the end and return None.""" reference_tokenizer = AutoTokenizer.from_pretrained(model_id) pooled_tokenizer = maybe_make_thread_pool(deepcopy(reference_tokenizer)) assert pooled_tokenizer is not None assert isinstance(pooled_tokenizer, T...
fim
vllm-project/vllm
python
<|fim_suffix|> "object", '",', ' "', "properties", '":', ' {"', "city", '":', ' {"', "type", ...
fim
vllm-project/vllm
python
<|fim_suffix|>s, **kwargs ) def test_customized_tokenizer(): TokenizerRegistry.register("test_tokenizer", __name__, TestTokenizer.__name__) tokenizer = TokenizerRegistry.load_tokenizer("test_tokenizer", "abc") assert isinstance(tokenizer, TestTokenizer) assert tokenizer.path_or_repo_id == "abc" ...
fim
vllm-project/vllm
python