fix(模型): 显示加载失败阶段和依赖诊断
模型子进程返回固定的加载阶段、异常类型和已知依赖名称,主进程在启动日志及异常中展示诊断信息,不输出原始异常文本。保留加载失败时阻止就绪与子进程清理行为。 新增六个加载阶段、异常信息过滤与进程清理测试;相关测试共 28 项通过,Ruff 检查通过。
This commit is contained in:
1 parent
5d71803b02
commit
eab1af6c5f
4 files changed
+150
-5
No files matched your search
@@ -127,3 +127,5 @@ local result = host.llm("Qwen3Guard-Gen-0.6B", {
|
||||
```
|
||||
|
||||
`host.llm.call(id, request)` is equivalent to the callable form. Calls are synchronous from Lua, serialized per model, and executed in a separate Python process. The worker is started before `/readyz` becomes ready. Model failures are returned as capability failures; plugins should fail closed (the example `response_guard.lua` blocks on a failed moderation call). The model worker is local-only and does not download weights at request time.
|
||||
|
||||
模型启动失败时,服务日志输出 `model_load_failed model=... stage=... exception=... dependency=...`。`stage` 区分 `import_torch`、`import_transformers`、`load_tokenizer`、`load_model`、`move_to_device` 和 `eval_model`;`exception` 是允许记录的异常类型,`dependency` 标记已知的缺失依赖,其余值为 `unknown`。诊断不输出原始异常文本或模型文件内容,模型加载失败仍会阻止服务就绪。例如 `stage=import_torch exception=ModuleNotFoundError dependency=torch` 表示缺少 PyTorch,需要在构建实际运行的镜像时安装 `.[guard]`。
|
||||
Reference in new issue
Block a user