Repository navigation
Conversation
There was a problem hiding this comment.
🟢 Approval recommended
The scoped bypass addresses the reported failure while retaining remote-handle rejection and public safety validation.
0 open findings
What changed in this PR
Fixes Transformers training and inference in Ray safe mode by allowing worker-local processor execution without weakening public remote-call checks.
Changes:
- Adds scoped worker-local invocation for processor instances.
- Uses the local processor path in Transformers
forwardandforward_only. - Adds safe-mode, training, custom-processor, cleanup, and remote-handle regression tests.
| File | Description |
|---|---|
src/twinkle/infra/__init__.py |
Adds context-scoped local execution support. |
src/twinkle/processor/base.py |
Adds the private local processing entry point. |
src/twinkle/model/transformers/transformers.py |
Routes Transformers processing through the local entry point. |
tests/model/test_safe_mode.py |
Covers safe-mode behavior and execution boundaries. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
建议 close 本 PR,作为已被 #309 替代的修复处理;有价值的回归测试可以单独迁移到当前 main。 这次使用独立 worktree 实跑了 main 原始触发源是 worker 内部 processor 调用携带 callable model,而装饰器在选择本地执行之前检查参数。已合入的 #309 将 model patch 移到模型准备阶段,processor 不再接收 model 参数,消除了这一触发源。因此本 PR 的额外 另外,Tinker 的 cross-entropy 路径使用的是字符串 源码依据:当前 Tinker loss 设置、已合入 #309。 验证范围限于上述 Transformers 文本 SFT 场景,不宣称完成 Megatron、多卡或完整训练矩阵验证。#298 的只读 CWD 和 stock Tinker checkpoint 下载问题应继续分别跟踪,不能因为关闭本 PR 就认为整个 issue 已解决。 |
PR type
PR information
With
TWINKLE_TRUST_REMOTE_CODE=0in Ray mode, Transformers training and forward-only calls fail when a worker passes its own callable model toInputProcessor. The remote decorator rejects these internal arguments before selecting worker-local execution.Move the processor pipeline into an undecorated
process_localmethod and call it directly from Transformersforwardandforward_only. The public__call__delegates to the same pipeline through its existing remote decorator, retaining safe-mode checks on both dispatch and worker execution. The local method documents its worker-only purpose, rejects remote handles and is not remotely exported. The remote-call framework and deployment configuration are unchanged.Refs #298 (the Transformers safe-mode training failure).
Experiment results
git diff --checkpassed. Validation does not cover a full HTTP deployment or GPU/PPU training.