[server] unpickle-time recursion in starlette State / pydantic MockValSer; tinker request types fail pydantic validation (NameError LossFnInputs)
Maintainer thường phản hồi trong vòng 2 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 22/100
Hướng nghiên cứu
Start by tracing the server’s /api/v1/forward_backward request validation and the pickle deserialization path described in the report. Review the proposed server/_compat_pickle.py changes and verify how the Tinker dataclasses, LossFnInputs, and TensorData reach Pydantic; the issue reports no file or test path. Done means both reported failures are handled and the ForwardBackwardRequest protocol flow validates through optim_step.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Checklist / 检查清单
- I have searched existing issues, and this is a new bug report. / 我已经搜索过现有的 issues,确认这是一个新的 bug report。
Bug Description / Bug 描述
Tinker 兼容网关(server)在本环境两类必现故障:
-
cloudpickle 反序列化过程中,starlette State.getattr 与 pydantic
MockValSer.getattr 访问未填充的 slot(_state / _attempt_rebuild)→ 无限递归
/ "AttributeError: MockValSer unavailable (item='validate_python')"。 -
训练请求体校验 ForwardBackwardRequest 失败:"NameError: name 'LossFnInputs' is
not defined"。根因:tinker SDK 的请求类型是 stdlib dataclass 且 module 被改写
为 'tinker',pydantic 按 tinker 包 namespace 解析字符串注解,而该 namespace 缺
LossFnInputs / Optional / np 等名字;且 TensorData 含 np.ndarray 字段,pydantic
无法生成 core schema。
How to Reproduce / 如何复现
- 启动 twinkle server(qwen3.5 模型,lora train_mode),healthz 正常。
- POST /api/v1/forward_backward(Tinker 协议,ForwardBackwardRequest):
网关侧 pydantic 校验抛 NameError: name 'LossFnInputs' is not defined。 - 反序列化路径触发 State/MockValSer 自递归(AttributeError: MockValSer unavailable)。
期望:server 在 FastAPI body 校验前应用防护;或 tinker SDK 类型可被 pydantic 校验
(若认为属 tinker SDK 责任,建议 twinkle 侧文档说明需要的最小兼容层)。
Additional Information / 补充信息
- twinkle: dev-swift-v5 @ dd3d68f;pydantic 2.11.7, starlette(当前 release), tinker SDK
- Hardware: Ascend910 x2, torch_npu 2.10.0.post7
- 我们提交了 server/_compat_pickle.py 补丁(import 时生效,_LazyModule 替换之前挂载):
① State/MockValSer getattr 防护 ② tinker namespace 注入 ③ TensorData
get_pydantic_core_schema。验证:TypeAdapter(ForwardBackwardRequest) 校验通过,
create_model → forward_backward → optim_step 协议闭环。
- Ngôn ngữ chính
- Python
- Star
- 270
- Fork
- 68
- Merge trung bình
- 2 ngày 16 giờ
- Pull request đã merge (30 ngày)
- 38
Chuẩn bị môi trường
- Có Dockerfile hoặc tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của modelscope/twinkle
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
modelscope/twinkle#429 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 55/100
modelscope/twinkle#410 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
bug
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 55/100
modelscope/twinkle#408 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
bug
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 66/100
modelscope/twinkle#407 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
魔搭托管的 Twinkle API 持续超时Đang mởbug
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 15/100
modelscope/twinkle#319 · 5 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
Tất cả issue của modelscope/twinkle
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
Maintainer thường phản hồi trong vòng 1 ngày
-
AIR-Bench Foundation reads the first letter of the word after "answer" as the model's choiceCó thể đã có người làm @beartester34 đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
modelscope/evalscope#2330 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Distribution plot crashes when a numeric feature is constant in the train or test setCó thể đã có người làm @adembilge đã nhận hôm nay. Đang mởbug good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
MAIF/shapash#847 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 10 ngày
-
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 85/100
Maintainer thường phản hồi trong vòng 2 ngày
-
namespace team:operations
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 60/100
EclipseFdn/open-vsx.org#16738 ·
Maintainer thường phản hồi trong vòng 1 ngày