UX: clean loggings (#22174)
This commit is contained in:
@@ -259,7 +259,7 @@ class MistralModel(nn.Module):
|
|||||||
mask_function = create_causal_mask
|
mask_function = create_causal_mask
|
||||||
causal_mask = mask_function(
|
causal_mask = mask_function(
|
||||||
config=self.config,
|
config=self.config,
|
||||||
input_embeds=inputs_embeds,
|
inputs_embeds=inputs_embeds,
|
||||||
attention_mask=attention_mask,
|
attention_mask=attention_mask,
|
||||||
cache_position=cache_position,
|
cache_position=cache_position,
|
||||||
past_key_values=past_key_values,
|
past_key_values=past_key_values,
|
||||||
|
|||||||
@@ -434,7 +434,7 @@ class Qwen2_5_VLTextModel(nn.Module):
|
|||||||
# Prepare mask arguments
|
# Prepare mask arguments
|
||||||
mask_kwargs = {
|
mask_kwargs = {
|
||||||
"config": self.config,
|
"config": self.config,
|
||||||
"input_embeds": inputs_embeds,
|
"inputs_embeds": inputs_embeds,
|
||||||
"attention_mask": attention_mask,
|
"attention_mask": attention_mask,
|
||||||
"cache_position": cache_position,
|
"cache_position": cache_position,
|
||||||
"past_key_values": past_key_values,
|
"past_key_values": past_key_values,
|
||||||
|
|||||||
@@ -562,6 +562,7 @@ def globally_suppress_loggers():
|
|||||||
"urllib3",
|
"urllib3",
|
||||||
"httpx",
|
"httpx",
|
||||||
"httpcore",
|
"httpcore",
|
||||||
|
"flash_attn.cute.cache_utils",
|
||||||
]
|
]
|
||||||
|
|
||||||
for name in target_names:
|
for name in target_names:
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
import orjson
|
import orjson
|
||||||
from fastapi.responses import ORJSONResponse, Response
|
from fastapi.responses import Response
|
||||||
|
|
||||||
# Keep response serialization behavior consistent across endpoints:
|
# Keep response serialization behavior consistent across endpoints:
|
||||||
# - Support non-string dictionary keys used in some metadata payloads.
|
# - Support non-string dictionary keys used in some metadata payloads.
|
||||||
@@ -16,17 +16,15 @@ def dumps_json(content: Any) -> bytes:
|
|||||||
return orjson.dumps(content, option=ORJSON_RESPONSE_OPTIONS)
|
return orjson.dumps(content, option=ORJSON_RESPONSE_OPTIONS)
|
||||||
|
|
||||||
|
|
||||||
class SGLangORJSONResponse(ORJSONResponse):
|
class SGLangORJSONResponse(Response):
|
||||||
"""ORJSON response with SGLang-specific serialization options."""
|
"""ORJSON response with SGLang-specific serialization options."""
|
||||||
|
|
||||||
|
media_type = "application/json"
|
||||||
|
|
||||||
def render(self, content: Any) -> bytes:
|
def render(self, content: Any) -> bytes:
|
||||||
return dumps_json(content)
|
return dumps_json(content)
|
||||||
|
|
||||||
|
|
||||||
def orjson_response(content: Any, status_code: int = 200) -> Response:
|
def orjson_response(content: Any, status_code: int = 200) -> Response:
|
||||||
"""Create a JSON response with stable ORJSON serialization options."""
|
"""Create a JSON response with stable ORJSON serialization options."""
|
||||||
return Response(
|
return SGLangORJSONResponse(content=content, status_code=status_code)
|
||||||
content=dumps_json(content),
|
|
||||||
media_type="application/json",
|
|
||||||
status_code=status_code,
|
|
||||||
)
|
|
||||||
|
|||||||
Reference in New Issue
Block a user