fix webui trainer callable globals#2876
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR ports a fix to the subprocess “callable” payload reconstruction so reconstructed functions always have sys available in their globals, preventing failures when the serialized callable globals omit sys. It also adds a regression test to ensure the callable reconstruction path completes successfully in that scenario.
Changes:
- Ensure callable reconstruction initializes
globals_dictwithsys(in addition to__builtins__) before applying serialized globals metadata. - Add a regression test that submits a reconstructed function lacking
sysin its globals and asserts the job completes.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
simpletuner/simpletuner_sdk/process_keeper.py |
Seeds reconstructed callable globals with sys to prevent NameError when executing serialized callables missing sys. |
tests/test_process_keeper.py |
Adds a regression test covering callable payload reconstruction when sys is absent from the callable’s serialized globals. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Summary
Ports the callable globals fix from whitejt2/SimpleTuner@2041c01 and adds a regression test.
The subprocess callable reconstruction path can rebuild a function with a globals dictionary that lacks
sys. The generated runner script imports and usessys, so providing it in the reconstructed callable globals prevents valid callables from failing when their serialized globals do not carrysysexplicitly.Validation
.venv/bin/python -m unittest tests.test_process_keeper.TestProcessLifecycle.test_callable_payload_reconstruction_provides_sys_global -v.venv/bin/python -m unittest tests.test_process_keeper -v