text
stringlengths
14
100k
source
stringclasses
1 value
repo
stringclasses
810 values
language
stringclasses
13 values
<|fim_suffix|> # post-sampled frames (expected behavior) (-1, 1, 5), (-1, 2, 10), ], ) def test_processor_override( model_id: str, expected_toks_per_frame: int, expected_grid_t: int, fps: int, num_frames: int, ): """Ensure GLM4vMultiModalProcessor can handle video frames pro...
fim
vllm-project/vllm
python
<|fim_suffix|>, False]) @pytest.mark.parametrize("kwargs_on_init", [True, False]) def test_processor_override( model_id: str, image_assets: ImageTestAssets, size_factors: list[int], min_dynamic_patch: int, max_dynamic_patch: int, dynamic_image_size: bool | None, kwargs_on_init: bool, ): ...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-F<|fim_suffix|>at are correct hf_processor = processor.info.get_hf_processor(**hf_processor_mm_kwargs) hf_processed_inputs = hf_processor( text=prompt, images=mm_data["image"], **processor.info.ctx.get_merged_mm_kwargs(hf_process...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """Tests for InternVL's multimodal preprocessing kwargs.""" from collections.abc import Mapping import pytest from PIL import Image from transformers import PretrainedConfig from vllm.multimodal i...
fim
vllm-project/vllm
python
<|fim_suffix|>patch_per_chunk(config.vision_config) assert ( prompt_token_ids.count(config.image_token_index) == sum(mm_data["patches_per_image"]) * num_patches_per_chunk ) assert len(mm_data["pixel_values"]) == sum(mm_data["patches_per_image"]) <|fim_prefix|># SPDX-License-Identifier: Apach...
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 from PIL import Image from pqdm.threads import pqdm from vllm.multimodal import MULTIMODAL_REGISTRY from vllm.multimodal.parse import I...
fim
vllm-project/vllm
python
<|fim_suffix|> hf_processor_mm_kwargs={}, ) image_placeholders = processed_inputs["mm_placeholders"]["image"] assert len(image_placeholders) == num_imgs first_placeholder = image_placeholders[0] assert first_placeholder.offset == 0 assert ( first_p...
fim
vllm-project/vllm
python
<|fim_suffix|>d_size_excs = list[tuple[ImageSize, Exception]]() for size in image_sizes: _validate_image_prompt_replacements_one( processor, num_imgs, failed_size_excs, size ) if failed_size_excs: msg = "Found failing image sizes:" + "\n========\n".join( f"[{siz...
fim
vllm-project/vllm
python
<|fim_suffix|>total_num_patches = chunks_per_image * tokens_per_patch num_tiles = ( mm_data["aspect_ratios"][0][0] * mm_data["aspect_ratios"][0][1] ) # x-y separator tokens total_tokens = ( total_num_patches.item() + num_tiles.item() + 3 ) # image start, image, image end assert to...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project from t<|fim_suffix|>_tokens=False, use_single_crop_col_tokens=False, use_single_crop_start_token=True, ) assert num_image_tokens.tolist() == [45] assert len(image_tokens...
fim
vllm-project/vllm
python
<|fim_suffix|>P_SIZE, max_crops=MAX_CROPS ) assert tiling == (1, 1) def test_exact_crop_size(self): """Image exactly at crop size should use 1x1.""" from vllm.transformers_utils.processors.moondream3 import select_tiling tiling = select_tiling( height=CROP_SIZE,...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project # Copyright 2026 The vLLM team. # Copyright 2026 NVIDIA CORPORATION and the HuggingFace Inc. team. All rights # reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you ma...
fim
vllm-project/vllm
python
<|fim_suffix|>_num, hf_processor_mm_kwargs, ) <|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """Tests for Nemotron-Nano-VL's multimodal preprocessing kwargs.""" from collections.abc import Mapping import pytest from PIL import Image...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """Tests for OpenVLA multimodal preprocessing.""" import numpy as np import pytest import torch from PIL import Image from transformers import LlamaConfig from vllm.model_executor.models.openvla im...
fim
vllm-project/vllm
python
<|fim_suffix|> hf_processor_mm_kwargs=hf_processor_mm_kwargs, ) # Ensure we have the right number of placeholders per num_crops size img_tok_count = processed_inputs["prompt_token_ids"].count(_IMAGE_TOKEN_ID) assert img_tok_count == expected_toks_per_img * num_imgs <|fim_prefix|># SPDX-License-I...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """Tests for phi4mm's multimodal preprocessing kwargs.""" import pytest from vllm.multimodal import MULTIMODAL_REGISTRY from ....conftest import ImageTestAssets from ...utils import build_model_co...
fim
vllm-project/vllm
python
<|fim_suffix|> audio_n = sum(audio_chunks) # 6 # mm_embeds come in [video, audio] order (video feature first in # mm_features when positions are the same for use_audio_in_video) mm_embeds = [ torch.full((video_n, hidden), video_val), torch.full((audio_n, hidden), audio...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import pytest from packaging.version import Version from transformers import __version__ as TRANSFORMERS_VERSION from vllm.multimodal import MULTIMODAL_REGISTRY from ....conftest import ImageTestA...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """Tests for Qwen3 Omni audio processing and sample rate handling.""" from typing import Any import numpy as np import pytest from vllm.multimodal import MULTIMODAL_REGISTRY from ...utils import ...
fim
vllm-project/vllm
python
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """Regression tests for Qwen3-VL processor. Covers the fix for num_frames-based timestamp calculation (issue vllm-project/vllm#35909). """ from typing import Any import numpy as np import pytest from vllm.mult...
fim
vllm-project/vllm
python
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """Tests for smolvlm's multimodal preprocessing kwargs.""" import pytest from packaging.version import Version from transformers import SmolVLMConfig from transformers import __version__ as TRANSFORMERS_VERSION ...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """Tests for Step3-VL precomputed image embedding in<|fim_suffix|> """Step3VLImageEmbeddingInputs should store embeddings in the data field.""" image_embeds = torch.randn(2, 16, 64) inputs =...
fim
vllm-project/vllm
python
<|fim_suffix|>require_data() return group_and_batch_mm_kwargs( [ (modality, item) for modality in supported_mm_limits for item in mm_kwargs[modality] ] ) # TODO(Isotr0py): Don't initialize model during test @contextmanager def initialize_dummy_model( mo...
fim
vllm-project/vllm
python
<|fim_suffix|>n_ids"] ) <|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.config import ModelConfig from vllm.multimodal import MULTIMODAL_REGISTRY @pytest.mark.parametrize("mod...
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 import pytest import torch import transformers from transformers import AutoConfig, AutoModel, PreTrainedModel from vllm.config import ModelConfig from vllm.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 vllm.model_executor.models.nano_nemotron_vl import NemotronH_Nano_VL_V2 class _TextOnlyMultiModalConfig: def get_limit_per_prompt(self, modality: str) -> int: retur...
fim
vllm-project/vllm
python
<|fim_suffix|>", "quant_model"), [("OpenGVLab/InternVL2-2B", "OpenGVLab/InternVL2-2B-AWQ")], ) @pytest.mark.parametrize( "size_factors", [ # Single-scale [1.0], # Single-scale, batched [1.0, 1.0, 1.0], # Multi-scale [0.25, 0.5, 1.0], ], ) @pytest.mark.para...
fim
vllm-project/vllm
python
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """Tests whether bitsandbytes computation is enabled correctly. Run `pytest tests/quantization/test_bitsandbytes.py`. """ import types from unittest.mock import MagicMock, patch import pytest from packaging.ver...
fim
vllm-project/vllm
python
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project # flake8: noqa """Tests fp8 models against ground truth generation Note: these tests will only pass on L4 GPU. """ import pytest from tests.quantization.utils import is_quant_method_supported from vllm.platform...
fim
vllm-project/vllm
python
<|fim_suffix|>y_logprobs( example_prompts, MAX_TOKENS, NUM_LOG_PROBS ) with vllm_runner( model, max_model_len=MAX_MODEL_LEN, enforce_eager=True, quantization="fp8_per_channel", ) as vllm_model: test_outputs = vllm_m...
fim
vllm-project/vllm
python
<|fim_suffix|>rtol = 0.02 assert measured_accuracy >= expected_accuracy - rtol, ( f"Accuracy {measured_accuracy:.4f} is below threshold " f"{expected_accuracy - rtol:.4f} (expected >= {expected_accuracy} - {rtol})" ) <|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: C...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """Tests AutoGPTQ (GPTQ with Marlin kernels) output correctness. Note: Marlin internally uses locks to synchronize the threads. This can result in very slight nondeterminism for Marlin. As a result,...
fim
vllm-project/vllm
python
<|fim_suffix|>f"Test{i}:\nExpected: {expected_str!r}\nvLLM: {generated_str!r}" ) <|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project # flake8: noqa """Tests Model Optimizer fp8 models against ground truth generation Note: these tests will onl...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project # flake8: noqa """Tests Quark mxfp4 models against ground truth generation""" import pytest from vllm import LLM, SamplingParams MODELS = ["amd/Llama-2-7b-chat-hf-wmxfp4-amxfp4-kvfp8-scale-uint8"]...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """E2E tests for online MXFP8 quantization. Loads a BF16 model with ``--quantization mxfp8`` (online quantization) and compares log-probabilities against the same model served in BF16 without quant...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project # flake8: noqa """Tests Model Optimizer nvfp4 models against ground truth generation Note: these tests will only pass on B200 """ import os from typing import List import pytest from transformers i...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """End-to-end accuracy tests for per-token-head KV cache quantization. Compares logprobs between a baseline bf16 model and the same model with per-token-head quantized KV cache (int8 or fp8) using ...
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 Mapping, Set from dataclasses import dataclass, field from typing import Any, Literal import pytest from packaging.version import Version from transformers import Pretra...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """Tests for model adapter weight loading (adapters.py).""" import pytest import torch from vllm.model_executor.models.adapters import _create_pooling_model_cls from vllm.model_executor.models.util...
fim
vllm-project/vllm
python
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project from types import SimpleNamespace import pytest import torch from vllm.models.deepseek_v4.nvidia.model import ( DeepseekV4MegaMoEExperts, make_deepseek_v4_expert_params_mapping, ) from vllm.models.deeps...
fim
vllm-project/vllm
python
<|fim_suffix|>S.get_supported_archs()) - set( MINIMAL_MODEL_ARCH_LIST ) @create_new_process_for_each_test() def can_initialize( model_arch: str, monkeypatch: pytest.MonkeyPatch, EXAMPLE_MODELS: HfExampleModels ): """The reason for using create_new_process_for_each_test is to avoid the WARNING: ...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import warnings import pytest import torch.cuda from vllm.model_executor.models import ( is_pooling_model, is_text_generation_model, supports_multimodal, ) from vllm.model_executor.mod...
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 pytest import torch from tests.conftest import VllmRunner from tests.utils import create_new_process_for_each_test pytestmark = pytest.mark.skipif( importlib.util...
fim
vllm-project/vllm
python
<|fim_suffix|>s = vllm_model.classify(example_prompts) hf_outputs = hf_model.classify(example_prompts) check_embeddings_close( embeddings_0_lst=hf_outputs, embeddings_1_lst=vllm_outputs, name_0="hf", name_1="vllm", ) <|fim_prefix|># SPDX-License-Identifier: Apache-2....
fim
vllm-project/vllm
python
<|fim_suffix|>new_mod.nested_mod.bn.num_batches_tracked.item() == 1 @pytest.mark.cpu_test def test_module_skip_substr(): """Ensure the auto weight loader can skip prefix.""" mod = ModuleWithNestedBatchNorm() # Run some data through the module with batchnorm mod(torch.Tensor([[1, 2], [3, 4]])) # T...
fim
vllm-project/vllm
python
<|fim_suffix|>erging by reducing the number of patches merge_factor = self.spatial_merge_size * self.spatial_merge_size # Group patches and merge spatially merged_embeddings = [] start_idx = 0 for grid_thw in grid_thw_list: num_patches = math.prod(grid_thw) ...
fim
vllm-project/vllm
python
<|fim_suffix|>efilter("always") warnings.warn(fail_msg, stacklevel=2) def build_model_context( model_id: str, runner: RunnerOption = "auto", dtype: ModelDType = "auto", model_config_kwargs: dict[str, Any] | None = None, mm_processor_kwargs: dict[str, Any] | None = None, li...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project from pathlib import Path from unittest.mock import patch import numpy as np import pybase64 as base64 import pytest from vllm.multimodal.media import AudioMediaIO from vllm.multimodal.media.audio i...
fim
vllm-project/vllm
python
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import pickle from pathlib import Path import pytest from PIL import Image from vllm.multimodal.media import MediaWithBytes pytestmark = pytest.mark.cpu_test ASSETS_DIR = Path(__file__).parent.parent / "assets...
fim
vllm-project/vllm
python
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import asyncio import mimetypes import os import shutil import time from tempfile import NamedTemporaryFile, TemporaryDirectory import aiohttp import numpy as np import pybase64 as base64 import pytest import re...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project from pathlib import Path import numpy as np import pytest from PIL import Image from vllm.multimodal.media import ImageMediaIO pytestmark = pytest.mark.cpu_test ASSETS_DIR = Path(__file__).parent...
fim
vllm-project/vllm
python
<|fim_suffix|> data = ",".join(b64_frames) imageio = ImageMediaIO() videoio = VideoMediaIO(imageio, num_frames=0) with pytest.raises(ValueError, match="num_frames must be greater than 0 or -1"): videoio.load_base64("video/jpeg", data) <|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-F...
fim
vllm-project/vllm
python
<|fim_suffix|>1, ) # Process audio through the parser # Note: Parser expects numpy, so we convert first (simulating real usage) result = parser._parse_audio_data((stereo_torch.numpy(), 16000)) audio_output = result.get(0) # Verify output is mono 1D numpy array a...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import multiprocessing as mp import numpy as np import pytest import torch from vllm.config import ModelConfig, ParallelConfig, VllmConfig from vllm.multimodal import MULTIMODAL_REGISTRY from vllm....
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """ Embedding shape validation in multimodal APIs. Tests verify that embeddings with correct ndim but incorrect hidden_size are rejected before they can cause crashes during model inference. Valida...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """ Unit tests for embedding shape validation. Simple, fast unit tests that can run without server fixtures. Run with: pytest tests/multimodal/test_embedding_shape_validation_unit.py -v """ import ...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import uuid from pathlib import Path import numpy as np import pytest import torch from PIL import Image, ImageDraw from vllm.multimodal.hasher import MultiModalHasher pytestmark = pytest.mark.cpu...
fim
vllm-project/vllm
python
<|fim_suffix|>e[1]): # Verify that all transparent pixels are converted to white. if original_image_numpy[i][j][3] == 0: assert converted_image_numpy[i][j][0] == 255 assert converted_image_numpy[i][j][1] == 255 assert converted_image_numpy[i][j][2]...
fim
vllm-project/vllm
python
<|fim_suffix|>d=is_embed) if expected is None: assert pr.embeds_cumsum is None return assert pr.embeds_cumsum == expected # cached_property should return the same object on repeated access assert pr.embeds_cumsum is pr.embeds_cumsum <|fim_prefix|># SPDX-License-Identifier: Apache-2.0 #...
fim
vllm-project/vllm
python
<|fim_suffix|>items.get_image_size(0) == (W, H) @pytest.mark.parametrize( "frame", [ Image.new("RGB", (W, H)), np.zeros((H, W, 3), dtype=np.uint8), torch.zeros((H, W, 3), dtype=torch.uint8), np.zeros((3, H, W), dtype=np.uint8), torch.zeros((3, H, W), dtype=torch.uint8),...
fim
vllm-project/vllm
python
<|fim_suffix|>, 918, 1550], is_embed=None, ), ], }, ), ], ) @pytest.mark.parametrize("update_type", [PromptInsertion, PromptReplacement]) def test_find_mm_placeholders( repl_by_key, prompt, expected, update_type, ): ...
fim
vllm-project/vllm
python
<|fim_suffix|>"""Test supports_multimodal_inputs returns correct boolean for various configs.""" ctx = build_model_context( model_id, limit_mm_per_prompt=limit_mm_per_prompt, ) assert MULTIMODAL_REGISTRY.supports_multimodal_inputs(ctx.model_config) is expected def test_create_processor...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """ Unit tests for sparse tensor validation. Simple, fast unit tests that can run without server fixtures. Run with: pytest tests/multimodal/test_sparse_tensor_validation_unit.py -v """ import io ...
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 vllm.multimodal.inputs import ( MultiModalBatchedField, MultiModalFieldElem, MultiModalKwargsItem, MultiModalSharedField, PlaceholderRange, ) from...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project from pathlib import Path import numpy as np import numpy.typing as npt import pytest from vllm.assets.base import get_vllm_public_assets from vllm.multimodal.video import ( VIDEO_LOADER_REGIST...
fim
vllm-project/vllm
python
<|fim_suffix|> for packet in stream.encode(): container.mux(packet) return buf.getvalue() def cosine_similarity(A: npt.NDArray, B: npt.NDArray, axis: int = -1) -> npt.NDArray: """Compute cosine similarity between two vectors.""" return np.sum(A * B, axis=axis) / ( np.linalg.nor...
fim
vllm-project/vllm
python
<|fim_suffix|>ntributors to the vLLM project <|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-Fil<|fim_middle|>eCopyrightText: Copyright co<|endoftext|>
fim
vllm-project/vllm
python
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import json from collections.abc import Sequence import pytest from openai_harmony import ( Conversation, Message, RenderConversationConfig, Role, ) from transformers import AutoTokenizer from v...
fim
vllm-project/vllm
python
<|fim_suffix|>urn get_tokenizer("Qwen/Qwen3-32B") def make_request(**overrides): base = { "model": "test-model", "messages": [{"role": "user", "content": "hi"}], } base.update(overrides) return ChatCompletionRequest.model_validate(base) TOOLS = [ { "type": "function", ...
fim
vllm-project/vllm
python
<|fim_suffix|>ds_remaining_args(tokenizer, request_obj): """When finished=True and the tool parser has unstreamed args, parse_delta appends the remaining arguments to the tool-call delta.""" parser = make_parser(tokenizer, reasoning=False, tool=True) token_ids = tokenizer.encode(MODEL_OUTPUT, add_specia...
fim
vllm-project/vllm
python
<|fim_suffix|>arseEmbeddingsProcessor" # noqa: E501 <|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the v<|fim_middle|>LLM project def register_bge_m3_sparse_embeddings_processor(): return "bge_m3_sparse_processor.sparse_embeddings_processor.BgeM3Sp<|endoft...
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 Sequence from vllm.config import ModelConfig, PoolerConfig, VllmConfig from vllm.entrypoints.openai.engine.protocol import UsageInfo from vllm.entrypoints.pooling.base.p...
fim
vllm-project/vllm
python
<|fim_suffix|>stMixin, EmbedRequestMixin): return_tokens: bool | None = Field( default=None, description="Whether to return dict shows the mapping of token_id to text." "`None` or False means not return.", ) embed_task: EmbedTask = Field( default="dense&sparse", descr...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM proj<|fim_suffix|>o_processor_plugins": [ "bge_m3_sparse_plugin = bge_m3_sparse_processor:register_bge_m3_sparse_embeddings_processor", # noqa: E501 ] }, ) <|fim_middle|>ect from se...
fim
vllm-project/vllm
python
<|fim_prefix|># SP<|fim_suffix|>dentifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project def register_prithvi(): return "prithvi_io_processor.prithvi_processor.PrithviMultimodalDataProcessor" # noqa: E501 <|fim_middle|>DX-License-I<|endoftext|>
fim
vllm-project/vllm
python
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import datetime import os import tempfile import urllib.request from collections.abc import Sequence from typing import Any import albumentations import numpy as np import pybase64 as base64 import rasterio impo...
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, Literal, TypedDict import albumentations from pydantic import BaseModel class DataModuleConfig(TypedDict): bands: list[str] batch_size: int constant_scale: flo...
fim
vllm-project/vllm
python
<|fim_suffix|> entry_points={ "vllm.io_processor_plugins": [ "prithvi_to_tiff = prithvi_io_processor:register_prithvi", # noqa: E501 ] }, ) <|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileC<|fim_middle|>opyrightText: Copyright contributors to the vLLM project from se...
fim
vllm-project/vllm
python
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project from setuptools import setup setup( name="vllm_add_dummy_model", version="0.1", packages=["vllm_add_dummy_model"], entry_points={ "vllm.general_plugins": ["register_dummy_model = vllm_add...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project from vllm impor<|fim_suffix|>TForCausalLM if "MyOPTForCausalLM" not in ModelRegistry.get_supported_archs(): ModelRegistry.register_model("MyOPTForCausalLM", MyOPTForCausalLM) # Tes...
fim
vllm-project/vllm
python
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project from collections.abc import Iterable import torch import torch.nn as nn from vllm.config import VllmConfig from vllm.model_executor.layers.pooler import DispatchPooler from vllm.model_executor.models.gemma2 imp...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Iden<|fim_suffix|>mmy_inputs=LlavaDummyInputsBuilder, ) class MyLlava(LlavaForConditionalGeneration): def compute_logits(self, hidden_states: torch.Tensor) -> torch.Tensor | None: # this dummy model always predicts the first token logits = super().compute_logits(hidden_s...
fim
vllm-project/vllm
python
<|fim_suffix|>my model always predicts the first token logits = super().compute_logits(hidden_states) if logits is not None: logits.zero_() logits[:, 0] += 1.0 return logits <|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributo...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project from setuptools import setup setup( name="vllm_add_dummy_platform", version="0.1", packages=["vllm_add_dum<|fim_suffix|>mmy_custom_ops = vllm_add_dummy_platform:register_ops" ],...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project def dummy_platform<|fim_suffix|>gin() -> str | None: return "vllm_add_dummy_platform.dummy_platform.DummyPlatform" def register_ops(): import vllm_add_dummy_platform.dummy_custom_ops # n...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM <|fim_suffix|> <|fim_middle|>project from vllm.attention.backends.placeholder_attn import PlaceholderAttentionBackend class DummyAttentionBackend(PlaceholderAttentionBackend): @staticmethod def ge...
fim
vllm-project/vllm
python
<|fim_suffix|> tuple[torch.Tensor, torch.Tensor]: return super().forward_oot(*args, **kwargs) <|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import torch from vllm.model_executor.layers.rotary_embedding import RotaryEmbedding # Regist...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-Fi<|fim_suffix|>m.platforms.interface import Platform, PlatformEnum if TYPE_CHECKING: from vllm.config import VllmConfig else: VllmConfig = None class DummyPlatform(Platform): _enum = PlatformEnum.OOT device_name = "DummyDevice" device_ty...
fim
vllm-project/vllm
python
<|fim_suffix|>lf.recorded.append( (scheduler_stats, iteration_stats, mm_cache_stats, engine_idx) ) def log(self): self.logged = True def log_engine_initialized(self): self.engine_initialized = True <|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText...
fim
vllm-project/vllm
python
<|fim_suffix|> packages=["dummy_stat_logger"], entry_points={ "vllm.stat_logger_plugins": [ "dummy_stat_logger = dummy_stat_logger.dummy_stat_logger:DummyStatLogger" # noqa ] }, ) <|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # S<|fim_middle|>PDX-FileCopyrightText: Copyright...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """ E2E tests for GGUF plugin functionality. """ import os from typing import NamedTuple import pytest from transformers import AutoTokenizer from ...conftest import VllmRunner from ...models.util...
fim
vllm-project/vllm
python
<|fim_suffix|>_model_len: int = 4096 marks: list[MarkDecorator] = [] mm_processor_kwargs: dict[str, Any] = {} @property def gguf_model(self): hf_hub_download(self.gguf_repo, filename=self.gguf_mmproj) return hf_hub_download(self.gguf_repo, filename=self.gguf_backbone) # Common prompts...
fim
vllm-project/vllm
python
<|fim_suffix|>s None @pytest.mark.asyncio async def test_nonlora_adapter(adapter_cache, pa_files): model_files = adapter_cache / PA_NAME shutil.copytree(pa_files, model_files) fs_resolver = FilesystemResolver(adapter_cache) assert fs_resolver is not None pa_request = await fs_resolver.resolve_lo...
fim
vllm-project/vllm
python
<|fim_suffix|> # noqa: E501 NON_LORA_SUBPATH = "ibm-granite/granite-3.3-8b-rag-agent-lib/README.md" LIB_DOWNLOAD_DIR = os.path.join( HF_HUB_CACHE, "models--ibm-granite--granite-3.3-8b-rag-agent-lib" ) INVALID_REPO_NAME = "thisrepodoesnotexist" # Repo with only one LoRA in the root dir LORA_REPO_MODEL_NAME = "meta...
fim
vllm-project/vllm
python
<|fim_suffix|>instance(obj, dict) and key in obj: return obj[key] return getattr(obj, key, None) def _check_dense_embedding(data, index=0): assert _float_close(sum(data), dense_embedding_sum[index]), ( "dense-embedding result not match" ) def _check_sparse_embedding(data, check_tokens=Fa...
fim
vllm-project/vllm
python
<|fim_suffix|>del. mock_hf_config = MagicMock() mock_hf_config.to_dict.return_value = {"io_processor_plugin": "wrong_plugin"} vllm_config = MagicMock(spec=VllmConfig) vllm_config.model_config.hf_config = mock_hf_config renderer = MagicMock(spec=BaseRenderer) with pytest.raises(ValueError): ...
fim
vllm-project/vllm
python
<|fim_suffix|>e first token is generated rest = generated_text.replace(first_token, "") assert rest == "" <|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import pytest from tests.utils import create_new_process_for_each_t...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project from tests.utils import VLLM_PATH, RemoteOpenAIServ<|fim_suffix|> rest = generated_text.replace("<s>", "") assert rest == "" def test_oot_registration_for_api_server(dummy_opt_path: str): ...
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 vllm.plugins import load_general_plugins def test_platform_plugins(): # simulate workload by running an example import runpy current_file = __file__ ...
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 EngineArgs from vllm.sampling_params import SamplingParams from vllm.v1.core.sched.scheduler import Scheduler from vllm.v1.engine.llm_engine import L...
fim
vllm-project/vllm
python