- Remove Anthropic, Cohere, SageMaker, decisions, structured-decisions, rl, render-launcher and batch entrypoints; keep scale-out token routes - Drop the Swagger static bundle and the /docs, /redoc routes - Delete device-keyed tuning configs for fused_moe, quant utils, mamba select-state and helion; no sm86 entry ever existed for any of them - Remove ten unused rope variants plus the fbgemm_fp8 and fp_quant quantizers and their config, metrics and loader plumbing - Cut the CPU device build: csrc/cpu, cpu_extension.cmake, cpu requirements and the setup.py cpu target path - Delete 29 environment variables nothing reads and 14 chat-template fallbacks for models this fork no longer registers - Remove nine dead CUDA ops (deepseek_v4, kimi_k3, minimax, muse_spark, dsv3 gemm) with their kernels, bindings, wrappers and CMake entries - Delete the connector test suites that targeted removed connectors - Cut the Mistral tokenizer and parser stack, its tests, and the mistral_common and ijson dependency pins - Restore the Qwen4Exp registry rows and nvidia/mtp.py that an earlier cut deleted while keeping the model tree Co-authored-by: Hinata <hinata@idihore.id> Signed-off-by: MOVZX <movzx@yahoo.com>
88 lines
2.8 KiB
Python
88 lines
2.8 KiB
Python
# SPDX-License-Identifier: Apache-2.0
|
|
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
|
|
from argparse import Namespace
|
|
from http import HTTPStatus
|
|
from typing import TYPE_CHECKING
|
|
|
|
from fastapi import FastAPI
|
|
from fastapi.responses import JSONResponse
|
|
from fastapi.routing import APIRoute
|
|
|
|
from vllm.engine.protocol import EngineClient
|
|
from vllm.entrypoints.serve.exception_handling.error_response import (
|
|
create_error_response,
|
|
)
|
|
from vllm.logger import init_logger
|
|
from vllm.tasks import SupportedTask
|
|
|
|
if TYPE_CHECKING:
|
|
from starlette.datastructures import State
|
|
|
|
from vllm.entrypoints.serve.utils.request_logger import RequestLogger
|
|
else:
|
|
RequestLogger = object
|
|
|
|
logger = init_logger(__name__)
|
|
|
|
|
|
def init_scale_out_state(
|
|
state: "State",
|
|
args: "Namespace",
|
|
engine_client: "EngineClient",
|
|
request_logger: RequestLogger | None,
|
|
):
|
|
from vllm.entrypoints.scale_out.token_in_token_out.serving import ServingTokens
|
|
|
|
state.serving_tokens = ServingTokens(
|
|
engine_client,
|
|
state.openai_serving_models,
|
|
state.online_renderer,
|
|
request_logger=request_logger,
|
|
return_tokens_as_token_ids=args.return_tokens_as_token_ids,
|
|
enable_prompt_tokens_details=args.enable_prompt_tokens_details,
|
|
enable_log_outputs=args.enable_log_outputs,
|
|
force_no_detokenize=args.tokens_only,
|
|
)
|
|
|
|
|
|
def register_scale_out_api_routers(
|
|
app: FastAPI,
|
|
supported_tasks: tuple["SupportedTask", ...],
|
|
):
|
|
args = getattr(app.state, "args", None)
|
|
# `vllm serve --tokens-only` is dedicated to serving these endpoints, so it
|
|
# always registers them regardless of `--enable-scale-out`.
|
|
dedicated_mode = getattr(args, "tokens_only", False)
|
|
enabled = dedicated_mode or getattr(args, "enable_scale_out", False)
|
|
if not enabled:
|
|
message = (
|
|
"Scale-out endpoints are disabled. Restart vllm serve with "
|
|
"--enable-scale-out to enable them."
|
|
)
|
|
logger.info(message)
|
|
|
|
async def disabled_scale_out() -> JSONResponse:
|
|
error = create_error_response(
|
|
message, "PermissionDeniedError", HTTPStatus.FORBIDDEN
|
|
)
|
|
return JSONResponse(error.model_dump(), status_code=HTTPStatus.FORBIDDEN)
|
|
|
|
from .token_in_token_out.api_router import router as token_router
|
|
|
|
for route in token_router.routes:
|
|
if isinstance(route, APIRoute):
|
|
app.add_api_route(
|
|
route.path,
|
|
disabled_scale_out,
|
|
methods=sorted(route.methods),
|
|
include_in_schema=False,
|
|
)
|
|
return
|
|
|
|
if "generate" in supported_tasks:
|
|
from .token_in_token_out.api_router import (
|
|
attach_router as attach_disagg_router,
|
|
)
|
|
|
|
attach_disagg_router(app)
|