fix: define LAMBDA_ARN_REGEX in finetune_utils to fix RLVRTrainer NameError#5988
Open
jam-jee wants to merge 1 commit into
Open
fix: define LAMBDA_ARN_REGEX in finetune_utils to fix RLVRTrainer NameError#5988jam-jee wants to merge 1 commit into
jam-jee wants to merge 1 commit into
Conversation
…eError
`_is_lambda_arn()` in finetune_utils.py referenced `LAMBDA_ARN_REGEX`,
but the constant was never defined or imported in the module. Any RLVR
training submitted with an evaluator (hub-content) ARN reward function
hit the `not _is_lambda_arn(...)` branch in
`RLVRTrainer._verify_reward_function` and crashed with:
NameError: name 'LAMBDA_ARN_REGEX' is not defined
The identical regex already exists in rlvr_reward_verifier.py, and both
call sites answer the same question ("is this a Lambda ARN?"). Import the
canonical pattern rather than duplicating it so the two paths cannot drift.
Adds regression tests covering valid Lambda ARNs (incl. non-aws
partitions), evaluator hub-content ARNs, and that both modules share the
same compiled regex.
Fixes: P467540738
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.
Issue
RLVRTrainer.train()crashes during reward-function verification with:_is_lambda_arn()infinetune_utils.pyreferencesLAMBDA_ARN_REGEX, but the constant is never defined or imported in that module. Any RLVR training submitted with an evaluator (hub-content) ARN reward function takes thenot _is_lambda_arn(...)branch inRLVRTrainer._verify_reward_functionand hits theNameError, blocking programmatic RLVR submission entirely.Fix
The identical regex already exists in
rlvr_reward_verifier.py, and both call sites answer the same question — "is this reward-function string a Lambda ARN?". Rather than add a second, drift-prone copy,finetune_utils.pynow imports the canonical pattern:No circular import is introduced (
rlvr_reward_verifierdoes not importfinetune_utils).Tests
Adds
TestIsLambdaArncovering:awspartitions likeaws-us-gov)Notes
A second, independent bug in the same RLVR verification path (
Evaluator.get()raisingValueErroron an unrecognizedEvaluatorMethod) was identified but is intentionally out of scope for this PR and will be addressed separately.