text stringlengths 14 100k | source stringclasses 1
value | repo stringclasses 810
values | language stringclasses 13
values |
|---|---|---|---|
<|fim_suffix|>red_segment") is not None:
raise ValueError(
"Mooncake preferred_segment override must be a non-empty string"
)
env_value = normalize_string_override(envs.MOONCAKE_PREFERRED_SEGMENT)
if env_value is not None:
logger.info(
"Mooncake preferred_segment... | fim | vllm-project/vllm | python |
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
"""Stats container for the Mooncake connector."""
import threading
from dataclasses import dataclass
from typing import Any
import numpy as np
from vllm.distributed.kv_transfer.kv_connector.v1.met... | fim | vllm-project/vllm | python |
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0
# SPDX-FileCop<|fim_suffix|>utors to the vLLM project
<|fim_middle|>yrightText: Copyright contrib<|endoftext|> | fim | vllm-project/vllm | python |
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
#
# Adapted from vllm-project/vllm-ascend
# (vllm_ascend/distributed/kv_transfer/kv_pool/ascend_store/).
"""MooncakeStoreConnector - KV cache connector using MooncakeDistributedStore.
Unlike Mooncak... | fim | vllm-project/vllm | python |
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
"""External-store cache-hit coordinator for MooncakeStoreConnector."""
from typing import cast
from vllm.v1.core.block_pool import BlockPool
from vllm.v1.core.kv_cache_utils import (
BlockHash,... | fim | vllm-project/vllm | python |
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
#
# Adapted from vllm-project/vllm-ascend
# (vllm_ascend/distributed/kv_transfer/kv_pool/ascend_store/).
"""Data classes for MooncakeStoreConnector."""
from collections.abc import Iterable
from data... | fim | vllm-project/vllm | python |
<|fim_suffix|>
documentation="Histogram of Mooncake store communication time.",
buckets=[
1e-3,
5e-3,
1e-2,
5e-2,
1e-1,
2e-1,
3e-1,
4e-1,
5e-1,
... | fim | vllm-project/vllm | python |
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyrigh<|fim_suffix|>y the NIXL connector (see
``vllm/distributed/kv_transfer/kv_connector/v1/nixl/metadata.py``).
"""
# Request message-type tags. Frame 0 of every request.
LOOKUP_MSG: bytes = b"lookup"
RESET_MSG: bytes = b"reset"
# Singl... | fim | vllm-project/vllm | python |
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
#
# Adapted from vllm-project/vllm-ascend
# (vllm_ascend/distributed/kv_transfer/kv_pool/ascend_store/).
"""Scheduler-side logic for MooncakeStoreConnector."""
from typing import Any
from vllm.conf... | fim | vllm-project/vllm | python |
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
#
# The transfer-thread scaffolding (KVTransferThread, KVCacheStoreSendingThread,
# KVCacheStoreRecvingThread) is adapted from vllm-project/vllm-ascend
# (vllm_ascend/distributed/kv_transfer/kv_pool/... | fim | vllm-project/vllm | python |
<|fim_suffix|>r
TransferId = str
@dataclass
class WriteTask:
request_id: ReqId
transfer_id: TransferId
dst_engine_id: str
local_block_ids: list[int]
remote_block_ids_hint: list[int] | None
layer_name: str
event: torch.cuda.Event
remote_notify_port: int
remote_ip: str
enqueue_ti... | fim | vllm-project/vllm | python |
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
import logging
import math
import queue
import threading
import time
from collections import defaultdict
from concurrent.futures import Future, ThreadPoolExecutor
from typing import TYPE_CHECKING, An... | fim | vllm-project/vllm | python |
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
import threading
import time
from typing import TYPE_CHECKING, Any
from weakref import ref as weakref_ref
import msgpack
import torch
import zmq
from vllm.logger import init_logger
from vllm.utils.network_utils ... | fim | vllm-project/vllm | python |
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
import copy
from collections.abc import Callable, Iterable
from dataclasses import dataclass
from typing import TYPE_CHECKING, Any, cast
import torch
from vllm.config import VllmConfig
from vllm.co... | fim | vllm-project/vllm | python |
<|fim_suffix|>er",
"NixlPushConnectorWorker",
]
<|fim_prefix|># SPDX-License-Identifier: Apache-<|fim_middle|>2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
"""NIXL KV-cache transfer connector (disaggregated prefill / decode)."""
from vllm.distributed.kv_transfer.kv_connector.v1.nixl.base... | fim | vllm-project/vllm | python |
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
"""Base scheduler-side logic for the NIXL connector."""
import threading
import time
from typing import TYPE_CHECKING, Any
import msgspec
import zmq
from vllm import envs
from vllm.distributed.kv_... | fim | vllm-project/vllm | python |
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
"""NIXL connector facades.
This module hosts the thin facade classes that vLLM's KV-connector layer
instantiates. Almost all the real work lives in the per-mode scheduler
and worker classes; the con... | fim | vllm-project/vllm | python |
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
"""Metadata dataclasses and helpers for the NIXL connector."""
from dataclasses import dataclass
from typing import Any
from vllm.config import VllmConfig
from vllm.distributed.kv_transfer.kv_conne... | fim | vllm-project/vllm | python |
<|fim_suffix|> # NOTE HMA will "mark" empty/null blocks in groups with 0s (eg SWA ones),
# trimming down after allocating for the whole sequence length. Empty
# blocks are always at the start of the list.
# Here we "unpad" blocks to send the actual remote blocks to be read.
... | fim | vllm-project/vllm | python |
<|fim_suffix|>s(
block_ids=local_block_ids,
dst_num_blocks=self.dst_num_blocks[self.engine_id],
block_size_ratio=block_size_ratio,
physical_blocks_per_logical=self._physical_blocks_per_logical_kv_block,
)
assert len(local_block_descs_ids) == len(remote_bl... | fim | vllm-project/vllm | python |
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
"""Push-specific scheduler-side logic for the NIXL connector.
In push mode, scheduler-side responsibilities are:
* D side (decode): on ``update_state_after_alloc``, stash registration data
(D's i... | fim | vllm-project/vllm | python |
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
"""Push-specific (WRITE) worker-side logic for the NIXL connector.
A dedicated ``nixl-push-writer`` thread owns all push-related NIXL ops:
calls ``get_new_notifs`` (routing PUSH_REG internally; HB /... | fim | vllm-project/vllm | python |
<|fim_suffix|>duler is the pull-based scheduler.
NixlConnectorScheduler = NixlPullConnectorScheduler
__all__ = ["NixlConnectorScheduler", "NixlPullConnectorScheduler"]
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
"""Backward-compatible re-expo... | fim | vllm-project/vllm | python |
<|fim_suffix|> labelnames=labelnames,
)
self.counter_nixl_num_failed_notifications = create_metric_per_engine(
counter_nixl_num_failed_notifications, self.per_engine_labelvalues
)
counter_nixl_num_kv_expired_reqs = self._counter_cls(
name="vllm:nixl_num_kv_... | fim | vllm-project/vllm | python |
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
"""TP mapping computation for NIXL KV cache transfers."""
from __future__ import annotations
from dataclasses import dataclass
import numpy as np
from vllm.distributed.kv_transfer.kv_connector.utils import (
... | fim | vllm-project/vllm | python |
<|fim_suffix|>r oot platform by providing mapping in current_platform
_NIXL_SUPPORTED_DEVICE.update(current_platform.get_nixl_supported_devices())
# TODO: merge with vllm.utils.network_utils.zmq_socket_ctx
@contextlib.contextmanager
def zmq_ctx(socket_type: Any, addr: str) -> Iterator[zmq.Socket]:
"""Context mana... | fim | vllm-project/vllm | python |
<|fim_suffix|> = ["NixlConnectorWorker", "NixlPullConnectorWorker"]
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
"""Backward-compatible re-export of NixlPullConnectorWorker."""
from vllm.distributed.kv<|fim_middle|>_transfer.kv_connector.v1.ni... | 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, field
from vllm.distributed.kv_transfer.kv_connector.v1.base import (
KVConnectorMetadata,
KVConnectorWorkerMetadata,
)
from vllm.v1.kv_offload.worker.work... | fim | vllm-project/vllm | python |
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
from dataclasses import dataclass
from typing import Any
from vllm.config import VllmConfig
from vllm.distributed.kv_transfer.kv_connector.v1.metrics import (
KVConnectorPromMetrics,
KVConne... | fim | vllm-project/vllm | python |
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
from collections.abc import Iterable, Sequence
from dataclasses import dataclass, field
from itertools import islice
from typing import Any, NamedTuple
from vllm.distributed.kv_events import BlockRemoved, BlockSt... | fim | vllm-project/vllm | python |
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
from collections import defaultdict
from dataclasses import replace
import torch
from vllm.distributed.kv_transfer.kv_connector.v1.offloading.common import (
OffloadingConnectorMetadata,
Of... | fim | vllm-project/vllm | python |
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
from collections.abc import Iterable
from typing import Any
import torch
from vllm.config import VllmConfig
from vllm.distributed.kv_events import KVCacheEvent
from vllm.distributed.kv_transfer.kv_connector.v1 i... | fim | vllm-project/vllm | python |
<|fim_suffix|>ndle_preemptions(kv_connector_metadata)
def start_load_kv(self, forward_context: "ForwardContext", **kwargs: Any) -> None:
pass # Launch loads ops in get_finished() after launching model execution
def wait_for_layer_load(self, layer_name: str) -> None:
pass # Always load asynch... | fim | vllm-project/vllm | python |
<|fim_suffix|> engine's page.
Used by both P and D for local descriptor registration.
"""
conv0, conv1, conv2 = self.proj_bytes
return [(0, conv0), (conv0, conv1), (conv0 + conv1, conv2)]
def remote_conv_offsets(
self, local_rank_offset: int, tp_ratio: int
) -> li... | fim | vllm-project/vllm | python |
<|fim_suffix|>across_tp(vllm_config: "VllmConfig") -> None:
"""Broadcast engine_id from TP rank 0 so all workers in a
multi-node TP group share the same value."""
from vllm.distributed.parallel_state import (
get_tp_group,
)
assert vllm_config.kv_transfer_config is not None
synced_id = ... | fim | vllm-project/vllm | python |
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
import importlib
import os
import sys
from typing import Any
from vllm.log<|fim_suffix|>ule {__name__!r} has no attribute {name!r}")
def is_nixl_available() -> bool:
"""Lightweight check for ... | fim | vllm-project/vllm | python |
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
# Copyright 2023 The vLLM team.
# Adapted from
# https://github.com/NVIDIA/Megatron-LM/blob/main/megatron/core/parallel_state.py
# Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved.
"""vLLM distributed ... | fim | vllm-project/vllm | python |
<|fim_suffix|> continue
if self.device_communicator and tensor.is_cuda:
tensor.copy_(self.device_communicator.broadcast(tensor, src))
else:
tensor.copy_(self.tcp_store_group.broadcast(tensor, src))
return tensor_dict
def send_object(self, obj, ... | fim | vllm-project/vllm | python |
<|fim_suffix|>not None else None
def init_gloo_process_group(
prefix_store: PrefixStore,
group_rank: int,
group_size: int,
timeout: timedelta,
) -> ProcessGroup:
"""
Stateless init ProcessGroup with gloo backend compatible with
different torch versions.
"""
with suppress_stdout():
... | fim | vllm-project/vllm | python |
<|fim_suffix|>transfer.base import WeightTransferEngine
from vllm.distributed.weight_transfer.factory import WeightTransferEngineFactory
__all__ = [
"WeightTransferEngine",
"WeightTransferEngineFactory",
]
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to t... | fim | vllm-project/vllm | python |
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors <|fim_suffix|> f"`num_updates_list` should be of the same size as `names`: "
f"got {len(self.num_updates_list)} and {len(names)}"
)
@dataclass
class SparseWeightPatch:
"""A... | fim | vllm-project/vllm | python |
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
"""Factory for weight transfer engines with lazy loading."""
import importlib
from collections.abc import Callable
from typing import TYPE_CHECKING
from vllm.distributed.weight_transfer.base import... | fim | vllm-project/vllm | python |
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
"""IPC-based weight transfer engine using CUDA IPC for communication."""
import pickle
from collections.abc import Callable, Iterator
from dataclasses import asdict, dataclass
from typing import Any... | fim | vllm-project/vllm | python |
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
"""NCCL-based weight transfer engine."""
from collections.abc import Callable, Iterator
from dataclasses import dataclass
from typing import TYPE_CHECKING, Any
import torch
if TYPE_CHECKING:
f... | fim | vllm-project/vllm | python |
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
"""Packed tensor utilities for efficient weight transfer."""
import math
from collections.abc import Callable, Iterator
from dataclasses import dataclass
from typing import Any
import torch
from to... | fim | vllm-project/vllm | python |
<|fim_prefix|># SPDX-Licen<|fim_suffix|>s to the vLLM project
from vllm.v1.engine.async_llm import AsyncLLM
AsyncLLMEngine = AsyncLLM # type: ignore
"""The `AsyncLLMEngine` class is an alias of [vllm.v1.engine.async_llm.AsyncLLM][]."""
<|fim_middle|>se-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contr... | fim | vllm-project/vllm | python |
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
from vllm.v1.engine.llm_engine import LLMEngine as V1LLMEngine
LLMEngine = V1LLMEngine # type: ignore
"""The `LLMEngine` class is an alias of [vllm.<|fim_suffix|>gine][]."""
<|fim_middle|>v1.engin... | fim | vllm-project/vllm | python |
<|fim_suffix|>ng."""
raise NotImplementedError
async def start_weight_update(self, is_checkpoint_format: bool = True) -> None:
"""Start a new weight update."""
raise NotImplementedError
async def update_weights(self, request: WeightTransferUpdateRequest) -> None:
"""Batched wei... | fim | vllm-project/vllm | python |
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM<|fim_suffix|>oject
<|fim_middle|> pr<|endoftext|> | fim | vllm-project/vllm | python |
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
from http import HTTPStatus
from fastapi import APIRouter, Depends, FastAPI, Request
from fastapi.responses import JSONResponse, StreamingResponse
from vllm.entrypoints.anthropic.protocol import ... | fim | vllm-project/vllm | python |
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
"""Pydantic models for Anthropic API protocol"""
import time
from typing import Any, Literal
from pydantic import BaseModel, Field, field_validator, model_validator
class AnthropicError(BaseModel... | fim | vllm-project/vllm | python |
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
# Adapted from
# https://github.com/vllm-project/vllm/blob/main/vllm/entrypoints/openai/chat_completion/serving.py
"""Anthropic Messages API serving handler"""
import json
import logging
import time
import uuid
... | fim | vllm-project/vllm | python |
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
"""
NOTE: This API server is used only for demonstrating usage of AsyncEngine
and simple performance benchmarks. It is not intended for production use.
For production use, we recommend using our OpenAI compatible ... | fim | vllm-project/vllm | python |
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
import asyncio
import json
from abc import ABC, abstractmethod
from collections import Counter, defaultdict
from collections.abc import Awaitable, Callable, Iterable
from dataclasses import dataclass
from functoo... | fim | vllm-project/vllm | python |
<|fim_suffix|>ntributors to the vLLM project
<|fim_prefix|># SPDX-License-Ide<|fim_middle|>ntifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright co<|endoftext|> | fim | vllm-project/vllm | python |
<|fim_suffix|> bench`."""
help: str
@classmethod
def add_cli_args(cls, parser: argparse.ArgumentParser) -> None:
"""Add the CLI arguments to the parser."""
raise NotImplementedError
@staticmethod
def cmd(args: argparse.Namespace) -> None:
"""Run the benchmark.
Arg... | fim | vllm-project/vllm | python |
<|fim_suffix|>ommandBase):
"""The `latency` subcommand for `vllm bench`."""
name = "latency"
help = "Benchmark the latency of a single batch of requests."
@classmethod
def add_cli_args(cls, parser: argparse.ArgumentParser) -> None:
add_cli_args(parser)
@staticmethod
def cmd(args: ... | fim | vllm-project/vllm | python |
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
import argparse
import sys
import typing
from vllm.entrypoints.cli.benchmark.base import BenchmarkSubcommandBase
from vllm.entrypoints.cli.types import CLISubcommand
from vllm.entrypoints.serve.uti... | fim | vllm-project/vllm | python |
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
import argparse
from vllm.benchmarks.mm_processor import add_cli_args, main
from vllm.entrypoints.cli.benchmark.base import BenchmarkSubcommandBase
class BenchmarkMMProcessorSubcommand(BenchmarkSu... | fim | vllm-project/vllm | python |
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
import argparse
from vllm.benchmarks.serve import add_cli_args, main
from vllm.entrypoints.cli.benchmark.base import BenchmarkSubcommandBase
class BenchmarkServingSubcommand(BenchmarkSubcommandBas... | fim | vllm-project/vllm | python |
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
import argparse
from vllm.benchmarks.<|fim_suffix|>t add_cli_args, main
from vllm.entrypoints.cli.benchmark.base import BenchmarkSubcommandBase
class BenchmarkStartupSubcommand(BenchmarkSubcommand... | fim | vllm-project/vllm | python |
<|fim_suffix|>r sweep."
@classmethod
def add_cli_args(cls, parser: argparse.ArgumentParser) -> None:
add_cli_args(parser)
@staticmethod
def cmd(args: argparse.Namespace) -> None:
main(args)
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contribu... | fim | vllm-project/vllm | python |
<|fim_suffix|>e `throughput` subcommand for `vllm bench`."""
name = "throughput"
help = "Benchmark offline inference throughput."
@classmethod
def add_cli_args(cls, parser: argparse.ArgumentParser) -> None:
add_cli_args(parser)
@staticmethod
def cmd(args: argparse.Namespace) -> None:
... | fim | vllm-project/vllm | python |
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
import argparse
import typing
from vllm.collect_env import main as collect_env_main
from vllm.entrypoints.cli.types import CLISubcommand
if typing.TYPE_CHECKING:
from vllm.utils.argparse_utils... | fim | vllm-project/vllm | python |
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
import argparse
import signal
import uvloop
from vllm import envs
from vllm.config import VllmConfig
from vllm.engine.arg_utils import AsyncEngineArgs
from vllm.entrypoints.cli.types import CLISubcommand
from v... | fim | vllm-project/vllm | python |
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
"""The CLI entrypoints of vLLM
Note that all future modules must be lazily loaded within main
to avoid certain eager import breakage."""
import importlib.metadata
import sys
from importlib.util imp... | fim | vllm-project/vllm | python |
<|fim_suffix|> from vllm.utils.argparse_utils import FlexibleArgumentParser
else:
FlexibleArgumentParser = argparse.ArgumentParser
def _register_signal_handlers():
def signal_handler(sig, frame):
sys.exit(0)
signal.signal(signal.SIGINT, signal_handler)
signal.signal(signal.SIGTSTP, signal_... | fim | vllm-project/vllm | python |
<|fim_prefix|><|fim_suffix|>rgparse
import asyncio
import importlib.metadata
import typing
from vllm.entrypoints.cli.types import CLISubcommand
from vllm.entrypoints.serve.utils.api_utils import VLLM_SUBCMD_PARSER_EPILOG
from vllm.logger import init_logger
if typing.TYPE_CHECKING:
from vllm.utils.argparse_utils i... | fim | vllm-project/vllm | python |
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
import argparse
import signal
import time
import uvloop
import vllm
import vllm.envs as envs
from vllm.entrypoints.cli.types import CLISubcommand
from vllm.entrypoints.openai.api_server import run... | fim | vllm-project/vllm | python |
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
import argparse
import typing
if typing.TYPE_CHECKING:
from vllm.utils.argparse_utils import FlexibleArgumentParser
else:
<|fim_suffix|>entedError("Subclasses should implement this method")
<... | fim | vllm-project/vllm | python |
<|fim_suffix|>urn_tokens_as_token_ids=args.return_tokens_as_token_ids,
enable_auto_tools=args.enable_auto_tool_choice,
exclude_tools_when_tool_choice_none=args.exclude_tools_when_tool_choice_none,
tool_parser=args.tool_call_parser,
reasoning_parser=args.structured_outputs_config.reasonin... | fim | vllm-project/vllm | python |
<|fim_suffix|>
backend = OutlinesBackend(
vllm_config=vllm_config,
tokenizer=tokenizer,
vocab_size=vocab_size,
)
elif backend_name == "lm-format-enforcer":
from vllm.v1.structured_output.backend_lm_format_enforcer import (
... | fim | vllm-project/vllm | python |
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
import asyncio
from abc import ABC
from collections.abc import AsyncGenerator, Mapping
import numpy as np
from vllm import CompletionOutput, RequestOutput
from vllm.engine.protocol import EngineCl... | fim | vllm-project/vllm | python |
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
from dataclasses import dataclass
from vllm.inputs import (
DecoderOnlyEngineInput,
EncoderDecoderInput,
MultiModalInput,
TokensInput,
mm_input,
tokens_input,
)
from vllm.lo... | fim | vllm-project/vllm | python |
<|fim_suffix|> completion,
create_completion,
)
from vllm.entrypoints.openai.completion.protocol import CompletionRequest
invocation_types += [
(ChatCompletionRequest, (chat, create_chat_completion)),
(CompletionRequest, (completion, create_completion)),... | fim | vllm-project/vllm | python |
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0
#<|fim_suffix|>eCopyrightText: Copyright contributors to the vLLM project
<|fim_middle|> SPDX-Fil<|endoftext|> | fim | vllm-project/vllm | python |
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrigh<|fim_suffix|>isinstance(result, GenerativeScoringResponse):
return JSONResponse(content=result.model_dump())
raise ValueError(f"Unexpected response type: {type(result)}")
def register_generative_scoring_api_router(app: FastAPI):
... | fim | vllm-project/vllm | python |
<|fim_suffix|>rompts by concatenating query and items.
Uses the Renderer's tokenizer to tokenize text inputs, then
creates EngineInput via tokens_input() for engine consumption.
Args:
request: The request containing query, items, and settings.
tokenizer: The tokenizer t... | fim | vllm-project/vllm | python |
<|fim_suffix|>
# Start server
await server.start()
logger.info("vLLM gRPC server started on %s", address)
logger.info("Server is ready to accept requests")
# Start periodic stats logging (mirrors the HTTP server's lifespan task)
if not args.disable_log_stats:
... | fim | vllm-project/vllm | python |
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
import asyncio
import signal
import socket
from functools import partial
from typing import Any
import uvicorn
from fastapi import FastAPI
from vllm import envs
from vllm.engine.protocol import EngineClient
fro... | fim | vllm-project/vllm | python |
<|fim_suffix|> spec_tokens=spec_tokens,
**kwargs,
)
log_non_default_args(engine_args)
self.llm_engine = LLMEngine.from_engine_args(
engine_args=engine_args, usage_context=UsageContext.LLM_CLASS
)
self.model_config = self.llm_engine.model_config
... | fim | vllm-project/vllm | python |
<|fim_suffix|>he vLLM project
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrig<|fim_middle|>htText: Copyright contributors to t<|endoftext|> | fim | vllm-project/vllm | python |
<|fim_suffix|> from gpt_oss.tools.simple_browser import SimpleBrowserTool
from gpt_oss.tools.simple_browser.backend import ExaBackend
except ImportError as e:
self.enabled = False
logger.warning_once(
"gpt_oss is not installed properly (%s), browsing... | fim | vllm-project/vllm | python |
<|fim_suffix|> if allowed_tools is None:
return cfg
filtered = [t for t in cfg.tools if t.name in allowed_tools]
if not filtered:
return None
return ToolNamespaceConfig(
name=cfg.name,
description=cfg.description,
tools=filtered,
... | 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, Iterable, Sequence
from typing import Any
from tqdm import tqdm
from typing_extensions import TypeVar
from vllm import (
PoolingParams,
PoolingRequest... | fim | vllm-project/vllm | python |
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
import asyncio
import importlib
import inspect
import multiprocessing
import multiprocessing.forkserver as forkserver
import os
import signal
import socket
import tempfile
import warnings
from argpar... | fim | vllm-project/vllm | python |
<|fim_suffix|>he vLLM project
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright co<|fim_middle|>ntributors to t<|endoftext|> | fim | vllm-project/vllm | python |
<|fim_suffix|>lidate_json_request)],
responses={
HTTPStatus.OK.value: {},
HTTPStatus.BAD_REQUEST.value: {"model": ErrorResponse},
HTTPStatus.NOT_FOUND.value: {"model": ErrorResponse},
HTTPStatus.INTERNAL_SERVER_ERROR.value: {"model": ErrorResponse},
HTTPStatus.NOT_IMPLEMENTED... | fim | vllm-project/vllm | python |
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
import asyncio
import time
from collections.abc import AsyncGenerator
from http import HTTPStatus
from fastapi import Request
from vllm.entrypoints.chat_utils import ConversationMessage
from vllm.... | fim | vllm-project/vllm | python |
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
# Adapted from
# https://github.com/lm-sys/FastChat/blob/168ccc29d3f7edc50823016105c024fe2282732a/fastchat/protocol/openai_api_protocol.py
import json
import time
from typing import Annotated, Any, ClassVar, Lite... | fim | vllm-project/vllm | python |
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
import asyncio
import io
import time
from collections.abc import AsyncGenerator, AsyncIterator
from collections.abc import Sequence as GenericSequence
from http import HTTPStatus
from typing import ... | fim | vllm-project/vllm | python |
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
"""
This file contains the command line arguments for the vLLM's
OpenAI-compatible server. It is kept in a separate file for documentation
purposes.
"""
import argparse
import json
import ssl
from c... | fim | vllm-project/vllm | python |
<|fim_suffix|>0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
<|fim_prefix|><|fim_middle|># SPDX-License-Identifier: Apache-2.<|endoftext|> | fim | vllm-project/vllm | python |
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
from http import HTTPStatus
from fastapi import APIRouter, Depends, FastAPI, Request
from fastapi.responses import JSONResponse, StreamingResponse
from vllm.entrypoints.openai.completion.protocol... | fim | vllm-project/vllm | python |
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
# Adapted from
# https://github.com/lm-sys/FastChat/blob/168ccc29d3f7edc50823016105c024fe2282732a/fastchat/protocol/openai_api_protocol.py
import json
import time
from typing import Annotated, Any, ... | fim | vllm-project/vllm | python |
<|fim_suffix|> tokenizer,
return_as_token_id=should_return_as_token_id,
): max(top_lp[1].logprob, -9999.0)
for i, top_lp in enumerate(step_top_logprobs.items())
if num_output_top_logprobs >= i
}
... | fim | vllm-project/vllm | python |
<|fim_suffix|>n to avoid SAN/hostname mismatches for
# localhost/127.0.0.1 deployments.
probe_ssl = False
async with session.get(
_child_base_url(args, port) + path, ssl=probe_ssl
) as response:
# vLLM returns 503 on EngineDeadError... | fim | vllm-project/vllm | python |
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
<|endoftext|> | fim | vllm-project/vllm | python |
<|fim_suffix|> )
logits_processors.append(logits_processor)
return logits_processors
elif processors:
raise ValueError(
"The `logits_processors` argument is not supported by this "
"server. See --logits-processor-pattern engine argument "
... | fim | vllm-project/vllm | python |
<|fim_suffix|>late_kwargs
def _extract_prompt_components(self, prompt: PromptType | EngineInput):
return extract_prompt_components(self.model_config, prompt)
def _extract_prompt_text(self, prompt: PromptType | EngineInput):
return self._extract_prompt_components(prompt).text
def _extract_... | fim | vllm-project/vllm | python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.