Repository navigation
Conversation
…nts call _load_orpo_rewriter execs every module-level `_` constant of rl_replacements.py into a namespace holding only `re`. Since e6a58b7 (unslothai#14185) three of those constants are built by a helper (_KTO_LOGPS_RE = _fused_pass_logps_re(...)), so the lifter raises NameError before reaching the rewriter and all six tests in the file fail (main's "Repo tests (CPU, studio)" shard since 10:16Z; every main run after it was cancelled by the next push, so the shard never reported). Exec a `_` helper a constant's expression names before that constant. Only the referenced helpers: defining every `_` function evaluates default arguments such as DEVICE_TYPE_TORCH, which the namespace does not have. Co-Authored-By: Claude Fable 5.1 <[email protected]>
This was referenced Oct 25, 2026
…es-underscore-helpers
…es-underscore-helpers
Contributor
Author
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.
Problem
tests/python/test_orpo_processor_text_tokenizer.py::_load_orpo_rewriterexecs every module-level_constant ofrl_replacements.pyinto a namespace that holds onlyre. Since #14185 (e6a58b7) three of those constants are built by a helper:so the lifter raises
NameError: name '_fused_pass_logps_re' is not definedbefore it reaches the rewriter, and all six tests in the file fail. This is theRepo tests (CPU, studio)red on #15245 (merge base 674f7f4, after #14185) and it reproduces on current main (db1e8d9). Main's own studio shard has not reported since #14185 landed: every main run after it was cancelled by the next push.Fix
Before exec'ing a
_constant, exec any_helper its expression names (and not yet defined). Only the referenced helpers: exec'ing every_function evaluates default arguments such asDEVICE_TYPE_TORCH, which the lifter's namespace does not have.Verification
python -m pytest tests/python/test_orpo_processor_text_tokenizer.py: 6 failed withNameErroron main, 6 passed with this change. No other test lifts rl_replacements constants this way (grep -rl 'target.id.startswith("_")' tests/).🤖 Generated with Claude Code