mirror of
https://github.com/PaddlePaddle/FastDeploy.git
synced 2026-04-23 00:17:25 +08:00
[BugFix][Optimization] Replace silent failures with catchable exceptions and informative error messages (#6533)
* init * init * fix format * add * add files * add ut * fix some * add ut * add more * add * fix pre-commit * fix pre-commit * fix cover * skip long seq * add * add * fix * remove not need * fix set attr * fix comments * fix comments * fix failed tests --------- Co-authored-by: gongweibao <gognweibao@baidu.com>
This commit is contained in:
@@ -20,6 +20,7 @@ from fastdeploy.config import ErnieArchitectures, ModelConfig
|
||||
from fastdeploy.entrypoints.openai.tool_parsers import ToolParserManager
|
||||
from fastdeploy.reasoning import ReasoningParserManager
|
||||
from fastdeploy.utils import envs
|
||||
from fastdeploy.utils import llm_logger as logger
|
||||
|
||||
|
||||
class InputPreprocessor:
|
||||
@@ -78,7 +79,8 @@ class InputPreprocessor:
|
||||
tool_parser_obj=tool_parser_obj,
|
||||
mm_processor_kwargs=self.mm_processor_kwargs,
|
||||
)
|
||||
except:
|
||||
except Exception as e:
|
||||
logger.info(f"Plugin input processor not available ({e}), using built-in processor")
|
||||
if not self.model_config.enable_mm:
|
||||
if not ErnieArchitectures.contains_ernie_arch(architecture):
|
||||
if not envs.ENABLE_V1_DATA_PROCESSOR:
|
||||
|
||||
@@ -127,7 +127,7 @@ class AsyncTokenizerClient:
|
||||
elif type == "audio":
|
||||
url = f"{self.base_url}/audio/encode"
|
||||
else:
|
||||
raise ValueError("Invalid type")
|
||||
raise ValueError(f"Invalid encode type: '{type}', expected 'image', 'video', or 'audio'")
|
||||
|
||||
resp = await client.post(url, json=request)
|
||||
resp.raise_for_status()
|
||||
@@ -159,9 +159,9 @@ class AsyncTokenizerClient:
|
||||
elif data.get("state") == "Error":
|
||||
raise RuntimeError(f"Tokenize task failed: {data.get('message')}")
|
||||
|
||||
except httpx.RequestError:
|
||||
# 网络问题时继续轮询
|
||||
pass
|
||||
except httpx.RequestError as e:
|
||||
# Network error, keep polling
|
||||
data_processor_logger.debug(f"Request error while polling tokenize task {task_tag}: {e}")
|
||||
|
||||
# 超时检测
|
||||
if asyncio.get_event_loop().time() - start_time > self.max_wait:
|
||||
@@ -183,7 +183,7 @@ class AsyncTokenizerClient:
|
||||
elif type == "audio":
|
||||
url = f"{self.base_url}/audio/decode"
|
||||
else:
|
||||
raise ValueError("Invalid type")
|
||||
raise ValueError(f"Invalid decode type: '{type}', expected 'image' or 'audio'")
|
||||
|
||||
for attempt in range(self.max_retries):
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user