Fix parse_args split crash and add NaN guard to get_normalizer - #56
Merged
Randomizez merged 2 commits intoSep 4, 2026
Merged
Conversation
`o.split("=")` splits on every `=` character, so values like
`load_path=s3://bucket/path?key=val` produce more than two parts
and the tuple-unpacking raises `ValueError: too many values to
unpack`.
Use `o.split("=", 1)` to limit the split to the first occurrence.
get_normalizer computes mean and std via all_reduce without checking for non-finite values. If any advantage element is NaN (e.g. from a degenerate reward or GAE), mean and std both become NaN. The caller's `std.clip_(0.01)` does not help because `clamp(NaN)` returns NaN per IEEE 754. All advantages silently become NaN, corrupting the entire training step with no error raised. Add a ValueError check after computing mean and std so the failure is caught immediately at the source.
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
o.split("=")splits on every=character. Config values containing=(e.g.load_path=s3://bucket/path?key=val) produce more than two parts, causingValueError: too many values to unpack. Fixed by usingo.split("=", 1).meanandstdboth become NaN. The downstreamstd.clip_(0.01)does not help becauseclamp(NaN)returns NaN per IEEE 754. All advantages silently become NaN, corrupting the training step. Added aValueErrorcheck after computing mean and std.Test plan
tests/test_arguments.py— 7 tests covering: normal key=value, values with=, Python literals,"false"/"null"edge casestests/test_get_normalizer.py— 4 tests covering: normal input, NaN input, inf input, constant input (std=0)pytest tests/test_arguments.py tests/test_get_normalizer.py -v— all 11 tests passruff checkandruff formatpass on all changed filespytest tests/exp/test_base_exp.py -vpasses