Commit Graph
2 Commits
Author SHA1 Message Date
Shaun ZhouandClaude Opus 5 9ead8c0a6e fix(scripts): push_predictions 支持 JWT 个人访问令牌
服务器上的 Label Studio 关闭了旧式 token(jwt_auth_jwtsettings.legacy_api_tokens_enabled=0),
用 authtoken_token 里的 key 直接请求返回 401。个人访问令牌是 JWT refresh token,
要先 POST /api/token/refresh/ 换成 access token 再以 Bearer 发送。

脚本按令牌形态自动区分:三段点分的按 JWT 换取,否则沿用旧式 Token。

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-22 12:13:20 +08:00
Shaun ZhouandClaude Opus 5 dce2eef0a7 fix(ml-backend): 推理分批,避免 Retrieve Predictions 撑爆显存;新增批量推送脚本
Retrieve Predictions 会把选中的任务一次发给后端,而后端把整个列表交给
model.predict(source=paths)——ultralytics 不理会 batch 参数,会当成一个 batch,
于是显存爆掉。这与之前 visualize_detections 踩的是同一个坑。后端现在按
YOLO_BATCH(默认 16)自己分批。

另加 scripts/push_predictions.py:重训完在本地分批推理,再用批量导入接口
POST /api/projects/<id>/import/predictions 提交,不经过后端服务,显存与请求体都可控。
支持 --replace 先删同版本旧预测(预测是追加的,重复跑会堆两份)、--limit 与 --dry-run。

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-22 12:11:06 +08:00