text
stringlengths
14
100k
source
stringclasses
1 value
repo
stringclasses
810 values
language
stringclasses
13 values
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project from typing import Any, Literal from pydantic import field_validator from vllm.config.utils import config from vllm.v1.attention.backends.mla.prefill.registry import MLAPrefillBackendEnum from vllm.v1.attention...
fim
vllm-project/vllm
python
<|fim_suffix|>V cache.""" DEFAULT_BLOCK_SIZE: ClassVar[int] = 16 block_size: int = Field(default=None, gt=0) # type: ignore[assignment] """Size of a contiguous cache block in number of tokens. Accepts None (meaning "use default"). After construction, always int.""" user_specified_block_size: bool...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import enum from collections import Counter from collections.abc import Callable from dataclasses import field, fields from pathlib import Path from typing import TYPE_CHECKING, Any, ClassVar, Liter...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project from dataclasses import field from typing import Any, Literal import torch from pydantic import ConfigDict, SkipValidation from vllm.config.utils import config from vllm.utils.hashing import safe_...
fim
vllm-project/vllm
python
<|fim_suffix|> speculative tokens scheduled per step.""" max_denoising_steps: int | None = None """Maximum number of denoising iterations per canvas block. If not set, read from the model's generation_config.json.""" <|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright co...
fim
vllm-project/vllm
python
<|fim_suffix|>ect the structure of the computation graph from input ids/embeddings to the final hidden states, excluding anything before input ids/embeddings and after the final hidden states. """ # no factors to consider. # this config will not affect the computation gra...
fim
vllm-project/vllm
python
<|fim_suffix|>backend", mode="before") @classmethod def _normalize_moe_backend(cls, value: Any) -> Any: if isinstance(value, str): return value.lower().replace("-", "_") return value @field_validator("linear_backend", mode="before") @classmethod def _normalize_linear_bac...
fim
vllm-project/vllm
python
<|fim_suffix|>llm.config.utils import config @config class KVEventsConfig: """Configuration for KV event publishing.""" enable_kv_cache_events: bool = False """If True, enable KV cache events for tracking block storage and removal. Events can be published externally by zmq using the event publisher c...
fim
vllm-project/vllm
python
<|fim_prefix|># <|fim_suffix|>] def kv_buffer_device_default_factory() -> str: from vllm.platforms import current_platform return current_platform.device_type @config class KVTransferConfig: """Configuration for distributed KV cache transfer.""" kv_connector: str | None = None """The KV connec...
fim
vllm-project/vllm
python
<|fim_suffix|> device_config.device""" ignore_patterns: list[str] | str = Field(default_factory=lambda: ["original/**/*"]) """The list of patterns to ignore when loading the model. Default to "original/**/*" to avoid repeated loading of llama's checkpoints.""" use_tqdm_on_load: bool = True """Whe...
fim
vllm-project/vllm
python
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project from typing import TYPE_CHECKING, Any, Literal import torch from pydantic import ConfigDict, Field, model_validator from typing_extensions import Self from vllm import envs from vllm.config.utils import config ...
fim
vllm-project/vllm
python
<|fim_suffix|>rical stability for long sequences.""" stochastic_rounding_philox_rounds: int = 0 """Number of Philox PRNG rounds for stochastic rounding random number generation. 0 uses the Triton default. Higher values improve randomness quality at the cost of compute.""" @field_validator("backend"...
fim
vllm-project/vllm
python
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import warnings from collections.abc import Callable from dataclasses import InitVar, field from functools import cached_property from typing import TYPE_CHECKING, Any, Literal, cast, get_args import torch from ...
fim
vllm-project/vllm
python
<|fim_suffix|>n the model.""" num_experts: int """Number of experts in the model.""" quantization_config: dict[str, Any] | None """Quantization configuration dictionary containing quantization parameters.""" is_deepseek_mla: bool """Whether the model is a DeepSeek MLA model.""" is_mm_pre...
fim
vllm-project/vllm
python
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project from collections.abc import Mapping from pathlib import Path from typing import Any, Literal, TypeAlias, TypedDict, final from pydantic import ConfigDict, Field, field_validator, model_validator from pydantic.da...
fim
vllm-project/vllm
python
<|fim_suffix|> return value @field_validator("collect_detailed_traces") @classmethod def _validate_collect_detailed_traces( cls, value: list[DetailedTraceModules] | None ) -> list[DetailedTraceModules] | None: """Handle the legacy case where users might provide a comma-separated...
fim
vllm-project/vllm
python
<|fim_suffix|>prefetch offloading is enabled" f" (offload_group_size > 0)" ) # Warn if both backends have non-default values uva_active = self.uva.cpu_offload_gb > 0 prefetch_active = self.prefetch.offload_group_size > 0 if self.offload_backend == "uv...
fim
vllm-project/vllm
python
<|fim_suffix|>gger.warning( "max_parallel_loading_workers is currently " "not supported and will be ignored." ) allowed_backends = ("mp", "uni", "external_launcher") if ( self.distributed_executor_backend not in allowed_backends and sel...
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, get_args from vllm.config.utils import config from vllm.logger import init_logger from vllm.tasks import PoolingTask from vllm.utils.hashing import safe_hash logge...
fim
vllm-project/vllm
python
<|fim_suffix|>sh_str @model_validator(mode="after") def _validate_profiler_config(self) -> Self: has_delay_or_limit = self.delay_iterations > 0 or self.max_iterations > 0 if self.profiler == "torch" and has_delay_or_limit and not self.ignore_frontend: logger.warning_once( ...
fim
vllm-project/vllm
python
<|fim_suffix|> None: raise ValueError( f"quantization_config is only supported when quantization is " f"one of {sorted(ONLINE_QUANT_SHORTHAND_NAMES)}, " f"got quantization={quantization!r}" ) return None base = _ONLINE_SHORTHANDS.get(q...
fim
vllm-project/vllm
python
<|fim_suffix|>se ) if not self._reasoning_start_token_ids or not self._reasoning_end_token_ids: raise ValueError( f"ReasoningConfig: failed to tokenize reasoning strings: " f"reasoning_start_str='{self.reasoning_start_str}', " f"reasoning_end_...
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 dataclasses import InitVar from typing import TYPE_CHECKING, Any, ClassVar, Literal, cast from pydantic import Field, field_validator from typing_extension...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import copy from typing import TYPE_CHECKING, Any, Literal, get_args from pydantic import Field, SkipValidation, field_validator, model_validator from typing_extensions import Self from vllm.confi...
fim
vllm-project/vllm
python
<|fim_suffix|>nfig: ModelConfig """Model configuration.""" language: str | None = None """ISO 639-1 language code (validated / auto-detected).""" hotwords: str | None = None """ hotwords refers to a list of important words or phrases that the model should pay extra attention to during tran...
fim
vllm-project/vllm
python
<|fim_suffix|> return self <|fim_prefix|># SPDX-License-Identifier: <|fim_middle|>Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project from typing import Any, Literal from pydantic import model_validator from typing_extensions import Self from vllm.config.utils import config from vllm.util...
fim
vllm-project/vllm
python
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """Utility functions for vLLM config dataclasses.""" import ast import enum import hashlib import inspect import json import os import pathlib import textwrap from collections.abc import Callable, Mapping, Sequen...
fim
vllm-project/vllm
python
<|fim_suffix|> need_disable_hybrid_kv_cache_manager = True elif not envs.VLLM_ALLOW_CHUNKED_LOCAL_ATTN_WITH_HYBRID_KV_CACHE: logger.warning( "There is a latency regression when using chunked local" " attention with the hybrid KV cache manager. Disab...
fim
vllm-project/vllm
python
<|fim_suffix|> to use for weight transfer. Validated against the `WeightTransferEngineFactory` registry at engine creation time. """ <|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributo<|fim_middle|>rs to the vLLM project from typing import Literal from vllm.config...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import asyncio import functools import time from collections.abc import Callable, Coroutine, Mapping, MutableMapping from pathlib import Path from typing import Any, ParamSpec, TypeVar import aioht...
fim
vllm-project/vllm
python
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project from cutlass import BFloat16, Float32, Int64, Uint32, cute from cutlass._mlir import ir from cutlass._mlir.dialects import llvm, vector from cutlass.cute.nvgpu import cpasync from cutlass.cutlass_dsl import T, dsl...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project # this module is named _tcgen05 to avoid name<|fim_suffix|> make_sdesc_128B_swizzle(LBO: int): SBO = 8 * 128 return Uint64((LBO >> 4 << 16) | (SBO >> 4 << 32) | (1 << 46) | (2 << 61)) @dsl_...
fim
vllm-project/vllm
python
<|fim_suffix|>effects=False, is_align_stack=False, ) return Uint32(out) @dsl_user_op def bf16x2_to_fp32x2(data, *, loc=None, ip=None) -> tuple[Float32, Float32]: if isinstance(data, Uint32): out = llvm.inline_asm( llvm.StructType.get_literal([T.f32(), T.f32()]), [da...
fim
vllm-project/vllm
python
<|fim_suffix|>urrent_platform.device_type})." ) <|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import dataclasses from contextlib import AbstractContextManager from typing import Protocol import torch from vllm.platforms import current_pla...
fim
vllm-project/vllm
python
<|fim_suffix|> allocation that will be offloaded. The rest of the memory allocation will be discarded. """ if offload_tags is None: # by default, allocated tensors are offloaded # when the allocator sleeps offload_tags = (CuMemAllocator.default_tag,) ...
fim
vllm-project/vllm
python
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import atexit import gc from collections.abc import Callable, Iterator from contextlib import contextmanager from typing import Any import torch from vllm.device_allocator import AllocationData, HandleType from...
fim
vllm-project/vllm
python
<|fim_suffix|> import * from .parallel_state import * from .utils import * <|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to <|fim_middle|>the vLLM project from .communication_op<|endoftext|>
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 torch import torch.distributed from .parallel_state import get_tp_group def tensor_model_parallel_all_reduce(input<|fim_suffix|>_) def tensor_model_parallel_all_g...
fim
vllm-project/vllm
python
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import threading from dataclasses import dataclass from typing import Any import torch import torch.distributed as dist import vllm.envs as envs from vllm.distributed import get_dp_group, get_ep_group from vllm....
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import ctypes import json import os import pickle import subprocess import sys import tempfile from collections.abc import Sequence from itertools import product from typing import Any import torch...
fim
vllm-project/vllm
python
<|fim_suffix|>her(self, input_: torch.Tensor, dim: int = -1) -> torch.Tensor: if dim < 0: # Convert negative dim to positive. dim += input_.dim() input_size = input_.size() # NOTE: we have to use concat-style all-gather here, # stack-style all-gather has compatibi...
fim
vllm-project/vllm
python
<|fim_suffix|> return tensor_dict <|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import os from typing import Any import torch from torch.distributed import ProcessGroup from vllm.distributed.utils import pickle from vllm.logger import init_l...
fim
vllm-project/vllm
python
<|fim_suffix|>the source rank.""" if src is None: src = (self.rank_in_group - 1) % self.world_size tensor = torch.empty(size, dtype=dtype, device=self.device) pynccl_comm = self.pynccl_comm if pynccl_comm is not None and not pynccl_comm.disabled: pynccl_comm.recv...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """This file is a pure Python wrapper for the cudart library. It avoids the need to compile a separate shared library, and is convenient for use when we just need to call a few functions. """ import...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project from contextlib import contextmanager from typing import cast import torch import torch.distributed as dist from torch.distributed import ProcessGroup import vllm.envs as envs from vllm import _cu...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import atexit import os import random import threading import torch import torch.distributed as dist from torch.distributed import ProcessGroup import vllm.envs as envs from vllm.config.compilati...
fim
vllm-project/vllm
python
<|fim_suffix|>roup=self._group) def Split(self, color: int, key: int) -> "CustomCommunicator": return self <|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project from typing import Any import torch.distributed as dist from flashinfer.comm.m...
fim
vllm-project/vllm
python
<|fim_suffix|>ks. # Run it in a daemon thread with a timeout: the main # thread proceeds, the graphs drop, and the abort returns. def _abort(): with torch.accelerator.device_index(self.device.index): self.nccl.ncclCommAbort(self.comm) ...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import atexit import contextlib import tempfile from typing import Any import torch from packaging import version from torch.c<|fim_suffix|> self._mem_pool_ctx = torch.cuda.use_mem_pool(get_nccl_me...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project # This file is a pure Python wrapper for the NCCL library. # The main purpose is to use NCCL combined with CUDA graph. # Before writing this script, we tried the following approach: # 1. We tried to...
fim
vllm-project/vllm
python
<|fim_suffix|>ully_connected: logger.debug( "Custom quick allreduce is disabled because it's not supported " "on more than two PCIe-only GPUs. " ) return self.init_quick_all_reduce() def init_quick_all_reduce(self): # On RocM, bfl...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import uuid from typing import Any import ray import torch from ray.exceptions import RayChannelError from ray.experimental.channel.communicator import Communicator, TorchTensorAllocator from torch....
fim
vllm-project/vllm
python
<|fim_suffix|> group_world_size = dist.get_world_size(pg) global_ranks = dist.get_process_group_ranks(pg) else: group_rank = pg.rank group_world_size = pg.world_size global_ranks = list(range(pg.world_size)) from vllm.distributed.parallel_state...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import pickle from abc import ABC, abstractmethod from collections.abc import Callable, Iterable from contextlib import contextmanager, suppress from dataclasses import dataclass from itertools impo...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import torch import torch.distributed as dist from torch.distributed import ProcessGroup import vllm.envs as envs from vllm.distributed.device_communicators.all_reduce_utils import ( SYMM_MEM_A...
fim
vllm-project/vllm
python
<|fim_suffix|> for inp in input_: output_list.append(_all_gather_single(inp, sizes=sizes)) return output_list def gather( self, input_: torch.Tensor, dst: int = 0, dim: int = -1 ) -> torch.Tensor | None: assert -input_.dim() <= dim < input_.dim(), ( f"Invali...
fim
vllm-project/vllm
python
<|fim_suffix|>2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project from vllm.distributed.ec_transfer.ec_transfer_state import ( ensure_ec_transfer_initialized, ensure_ec_transfer_shutdown, get_ec_transfer, has_ec_transfer, ) __all__ = [ "get_ec_transfer", "ensure_ec_transfe...
fim
vllm-project/vllm
python
<|fim_suffix|> cache exists Args: identifier (str): the identifier of the media. Returns: A bool where value is True if cache exist for the media """ pass def ensure_cache_available( self, request: "Request", num_computed_tokens: int ...
fim
vllm-project/vllm
python
<|fim_suffix|>create_folder=True`). """ foldername = self._generate_foldername_debug(mm_hash) # <- folder auto-created return os.path.join(foldername, "encoder_cache.safetensors") <|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM pr...
fim
vllm-project/vllm
python
<|fim_suffix|>ctor_class(ec_transfer_config) logger.info( "Creating connector with name: %s and engine_id: %s", connector_cls.__name__, ec_transfer_config.engine_id, ) # Connector is explicitly separated into two roles. # Scheduler connector: #...
fim
vllm-project/vllm
python
<|fim_suffix|>wn() -> None: global _EC_CONNECTOR_AGENT if _EC_CONNECTOR_AGENT is not None: _EC_CONNECTOR_AGENT.shutdown() _EC_CONNECTOR_AGENT = None <|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project from typing import TYPE_CH...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import copy import gc import weakref from collections.abc import Iterable, Sequence from dataclasses import replace from typing import TYPE_CHECKING import torch import torch.nn as nn import torch.n...
fim
vllm-project/vllm
python
<|fim_suffix|>oup_rank, group_size, barrier_id, timeout=timeout ) torch.distributed.barrier(dp_group) if group_rank == 0: dp_store.delete_key(sync_key) for i in range(group_size): dp_store.delete_key(f"arrival_{barrier_id}_{i}") ...
fim
vllm-project/vllm
python
<|fim_suffix|> ) standby_ep_ranks = [x.tolist() for x in standby_ep_ranks] _STANDBY_EP = _init_stateless_group( standby_ep_ranks, "ep", master_ip, backend, coord_store=coord_store ) if enable_eplb: _STANDBY_EPLB = _init_stateless_group( standby_ep_ranks, "epl...
fim
vllm-project/vllm
python
<|fim_suffix|>" <|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """Expert parallelism load b<|fim_middle|>alancer (EPLB).""<|endoftext|>
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """ The async worker that transfers experts in the background. """ import threading from typing import TYPE_CHECKING import torch from torch.distributed import ProcessGroup from vllm.distributed.p...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """ EPLB communicator implementations and factory. """ import contextlib import time import uuid from abc import ABC, abstractmethod from collections.abc import Sequence from datetime import timedel...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """ Expert parallelism load balancer (EPLB) metrics and states. # Glossary - **Logical Expert**: An expert that is part of the model's logical structure. It holds a set of weights and is replicat...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """Utility functions for EPLB (Expert Parallel Load Balancing).""" import os import threading import torch from vllm.config import ParallelConfig from vllm.logger import init_logger logger = init...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project from typing import get_args from vllm.config.parallel import EPLBPolicyOption from .abstract import AbstractEplbPolicy from .default import DefaultEplbPo<|fim_suffix|>ICIES.keys()) == set(get_args(...
fim
vllm-project/vllm
python
<|fim_suffix|> num_replicas], the expert index of each replica """ raise NotImplementedError <|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project from abc import ABC, abstractmethod import torch class AbstractEplbPol...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """ Expert parallelism load balancer (EPLB) for vLLM. This module implements the core rearrangement algorithm. The rearrangement algorithm is adapted from [DeepSeek EPLB](https://github.co<|fim_suf...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """ The actual execution of the rearrangement. This involves the exchange of expert weights between GPUs. """ from collections.abc import Sequence from dataclasses import dataclass import numpy as...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import queue import threading import time from abc import ABC, abstractmethod from collections import Counter, deque from collections.abc import Callable from dataclasses import asdict from itertool...
fim
vllm-project/vllm
python
<|fim_suffix|> "ensure_kv_transfer_initialized", "ensure_kv_transfer_shutdown", "KVConnectorBaseType", ] <|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project from vllm.distributed.kv_transfer.kv_transfer_state import ( KVConnectorBaseTyp...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """Defines the base type for KV cache connectors.""<|fim_suffix|>1 import KVConnectorBase_V1 KVConnectorBase = KVConnectorBase_V1 KVConnectorBaseType = KVConnectorBase_V1 __all__ = ["KVConnectorBas...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import importlib from collections.abc import Callable from typing import TYPE_CHECKING, cast from vllm.config.kv_transfer import KVTransferConfig from vllm.distributed.kv_transfer.kv_connector.base...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """ KV cache helper for store. """ from collections.abc import Iterator from dataclasses import dataclass from typing import TYPE_CHECKING, Any, Literal, cast import torch from vllm.config import ...
fim
vllm-project/vllm
python
<|fim_suffix|>opyrightText: Copyright contributors to the vLLM project from vllm.distributed.kv_transfer.kv_connector.v1.base import ( KVConnectorBase_V1, KVConnectorRole, SupportsHMA, supports_hma, ) from vllm.distributed.kv_transfer.kv_connector.v1.decode_bench_connector import ( # noqa: E501 Dec...
fim
vllm-project/vllm
python
<|fim_suffix|> will be aggregated using the `aggregate` method below, before being passed to the Scheduler KVConnector. """ @abstractmethod def aggregate( self, other: "KVConnectorWorkerMetadata" ) -> "KVConnectorWorkerMetadata": """ Aggregate metadata with another `KVCon...
fim
vllm-project/vllm
python
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """ DecodeBenchConnector: A KV Connector for decode instance performance testing. This connector emulates a prefill-decode disaggregated setting by filling the KV cache with dummy values, allowing measurement of ...
fim
vllm-project/vllm
python
<|fim_suffix|>ond what is already computed. """ # NOTE: in this debug implementation, we assume that the prompt is # cached_prompt + newly_generated_single_token # Therefore, we use prompt_token_ids[:-1] to determine the folder name # NOTE: in current v1 scheduler, the num_compu...
fim
vllm-project/vllm
python
<|fim_suffix|>ame=filename, token_ids=token_ids, block_ids=list(block_ids), ) return True, {"hidden_states_path": filename} def get_finished( self, finished_req_ids: set[str] ) -> tuple[set[str] | None, set[str] | None]: """Extract hidden states and poll ...
fim
vllm-project/vllm
python
<|fim_suffix|> Tuple of (async_save, kv_transfer_params) where async_save is True if the request is being saved/sent asynchronously and blocks should not be freed until the request_id is returned from :meth:`get_finished`. kv_transfer_params is an optional dict of KVTrans...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import logging import multiprocessing import os import threading from func<|fim_suffix|>( numel, dtype=torch.uint8, device="cpu", pin_m...
fim
vllm-project/vllm
python
<|fim_suffix|> state.load_op.need_fetch_block_ids.extend(local_block_ids) state.phase = "WAITING_TO_LOAD" def build_connector_meta( self, scheduler_output: SchedulerOutput ) -> KVConnectorMetadata: """Build connector metadata for scheduling step.""" metadata = HF3FSConne...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """ HF3FS Metadata Server with key-based organization. """ import argparse import logging import threading from abc import ABC, abstractmethod from dataclasses import dataclass try: import orjs...
fim
vllm-project/vllm
python
<|fim_suffix|>Metadata] = [] def add_request(self, request_metadata: HF3FSRequestMetadata) -> None: """Add request to metadata.""" self.requests.append(request_metadata) <|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import t...
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.logger import init_logger from vllm.triton_utils import tl, triton @triton.jit def kv_cache_scatter_kernel( kv_cache_ptrs_ptr, source_ptr, token_indices_ptr, ...
fim
vllm-project/vllm
python
<|fim_suffix|>ffset < 0 or offset + len(data_bytes) > self._size: results.append(-1) continue f.seek(offset) bytes_written = f.write(data_bytes) if bytes_written == len(data_bytes) == self._bytes_per_page: ...
fim
vllm-project/vllm
python
<|fim_prefix|>#include <cuda_runtime.h> #include <torch/extension.h> #include <cstring> #include <vector> void read_shm(const torch::Tensor& shm, const torch::Tensor& pin, std::vector<torch::Tensor> dst, uint64_t stream_ptr) { py::gil_scoped_release release; cudaStream_t stream = reinterpret_cast<cu...
fim
vllm-project/vllm
cpp
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project from collections.abc import Iterable from typing import TYPE_CHECKING, Any import torch from vllm.config import VllmConfig from vllm.distributed.kv_events import ( BlockStored, KVCacheEvent...
fim
vllm-project/vllm
python
<|fim_suffix|>apter", "LMCacheMPSchedulerAdapter", "LMCacheMPWorkerAdapter", "LoadStoreOp", "ParallelStrategy", ] <|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project from . import multi<|fim_middle|>_process_adapter, vllm_v1_adapter ...
fim
vllm-project/vllm
python
<|fim_suffix|> op.token_ids, op.start, op.end, request_id=request_id ) ) block_ids.extend(op.block_ids) future = send_lmcache_request( self.mq_client, RequestType.RETRIEVE, [ all_keys, sel...
fim
vllm-project/vllm
python
<|fim_suffix|> return (request.mm_hashes, request.mm_positions) # type: ignore else: return ([], []) <|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project # Standard import os import threading from typing import TYPE_CHECKING, Uni...
fim
vllm-project/vllm
python
<|fim_suffix|> role: KVConnectorRole, parent: KVConnectorBase_V1, ): assert vllm_config.kv_transfer_config is not None self._parent = parent self._vllm_config = vllm_config self.kv_role = vllm_config.kv_transfer_config.kv_role self.worker_count = vllm_config.paralle...
fim
vllm-project/vllm
python
<|fim_suffix|>ed in vLLM """ if not tracker.is_ready_for_retrieving(): return None # |---------------------|-----------------|----------------| # | num_vllm_hit_blocks | # | lmcache chunk 1 | lmcache chunk 2 | # | need to retrieve | ...
fim
vllm-project/vllm
python
<|fim_suffix|>Error def reduce(self) -> dict[str, int | float]: """ Reduce the observations collected during a time interval to one or more representative values (eg avg/median/sum of the series). This is meant to be called by the logger to produce a summary of the stats for...
fim
vllm-project/vllm
python
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import asyncio import logging import threading import time from collections import defaultdict from concurrent.futures import ThreadPoolExecutor from dataclasses import dataclass from enum import IntEnum from typi...
fim
vllm-project/vllm
python
<|fim_suffix|> f"{tp_entry[payload.pp_rank]}, " f"but still want to register at {payload.addr}" ), ) tp_entry[payload.pp_rank] = payload.addr logger.debug( "Registered worker: engine_id=%s, dp_rank=%d, tp_rank=%d, pp_rank=%d at %...
fim
vllm-project/vllm
python