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.
hjh0119
approved these changes
Oct 13, 2026
Yunnglin
marked this pull request as draft
October 13, 2026 06:21
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.