require --ref-load when KL is enabled instead of crashing with a TypeError - #2348
Open
rootkiller6788 wants to merge 2 commits into
Open
require --ref-load when KL is enabled instead of crashing with a TypeError#2348rootkiller6788 wants to merge 2 commits into
rootkiller6788 wants to merge 2 commits into
Conversation
slime_validate_args called os.path.exists(args.ref_load) whenever
kl_coef != 0 or use_kl_loss is on, but ref_load defaults to None. A
run with --kl-coef but no --ref-load died with a bare TypeError
("path should be string... not NoneType") instead of telling the user
the reference checkpoint is missing. Mirror the OPD check just below
and raise a clear ValueError first.
Two new slime_validate_args unit tests: a non-zero kl_coef or use_kl_loss with ref_load unset now raises a ValueError mentioning --ref-load, and a ref_load path that does not exist still raises FileNotFoundError. Both follow the existing rollout-temperature test style in this file.
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.
Enabling KL (--kl-coef 0.1 or --use-kl-loss) without --ref-load used to die in slime_validate_args with
TypeError: _path_exists: path should be string, bytes, os.PathLike or integer, not NoneType, because it stat'd args.ref_load before checking it was set. The sibling OPD check just below already guards for None first.This adds the same guard: ref_load unset now raises a ValueError telling the user to pass --ref-load, and a ref_load that points nowhere still raises the original FileNotFoundError. Two unit tests cover both cases.