[Auto Sync] Update detokenizer_manager.py, io_struct.py, mu... (20260120) (#17442)

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Wangfan Fu <wangfan@x.ai>
This commit is contained in:
Lianmin Zheng
2026-01-21 14:48:32 -08:00
committed by GitHub
parent 95f59c13fd
commit b74a57a8d9
13 changed files with 59 additions and 88 deletions

View File

@@ -46,7 +46,7 @@ import orjson
import requests
import uvicorn
import uvloop
from fastapi import Depends, FastAPI, HTTPException, Request, UploadFile
from fastapi import Depends, FastAPI, HTTPException, Request
from fastapi.exceptions import RequestValidationError
from fastapi.middleware.cors import CORSMiddleware
from fastapi.responses import ORJSONResponse, Response, StreamingResponse
@@ -552,26 +552,20 @@ async def model_info():
"has_audio_understanding": model_config.is_audio_understandable_model,
"model_type": getattr(model_config.hf_config, "model_type", None),
"architectures": getattr(model_config.hf_config, "architectures", None),
"weight_version": _global_state.tokenizer_manager.server_args.weight_version,
# "hf_config": model_config.hf_config.to_dict(),
}
return result
@app.get("/get_weight_version")
async def get_weight_version():
"""Get the current weight version (deprecated - use /weight_version instead)."""
logger.warning(
"Endpoint '/get_weight_version' is deprecated and will be removed in a future version. "
"Please use '/weight_version' instead."
)
return await weight_version()
@app.get("/weight_version")
async def weight_version():
"""Get the current weight version."""
return {
"weight_version": _global_state.tokenizer_manager.server_args.weight_version
}
raise HTTPException(
status_code=404,
detail="Endpoint '/get_weight_version' or '/weight_version' is deprecated. Please use '/model_info' instead.",
)
@app.get("/get_server_info")
@@ -661,30 +655,6 @@ async def generate_request(obj: GenerateReqInput, request: Request):
return _create_error_response(e)
@app.api_route("/generate_from_file", methods=["POST"])
async def generate_from_file_request(file: UploadFile, request: Request):
"""Handle a generate request, this is purely to work with input_embeds."""
content = await file.read()
input_embeds = orjson.loads(content.decode("utf-8"))
obj = GenerateReqInput(
input_embeds=input_embeds,
sampling_params={
"temperature": 0.0,
"max_new_tokens": 512,
},
)
try:
ret = await _global_state.tokenizer_manager.generate_request(
obj, request
).__anext__()
return ret
except ValueError as e:
logger.error(f"Error: {e}")
return _create_error_response(e)
@app.api_route("/encode", methods=["POST", "PUT"])
async def encode_request(obj: EmbeddingReqInput, request: Request):
"""Handle an embedding request."""