Fix: use math.log for Python float bounds in hyperparameter_sampling#29
Open
jasherb wants to merge 1 commit into
Open
Fix: use math.log for Python float bounds in hyperparameter_sampling#29jasherb wants to merge 1 commit into
jasherb wants to merge 1 commit into
Conversation
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
test_distribution_normalizershas been failing since f04d3ca ("sync"):In
pfns/priors/hyperparameter_sampling.py,self.lowerandself.upperare Python
floatattributes of the dataclass, but f04d3ca changedmath.log(...)totorch.log(...)for both, in three methods.torch.logdoesn't accept Python scalars, so it raises immediately onany call into
normalize()(or the newunnormalize()) withlog=True.Fix
Revert the scalar-side calls to
math.login:UniformFloatDistConfig.normalizeUniformFloatDistConfig.unnormalizePowerUniformFloatDistConfig.unnormalizeThe tensor-side
torch.log(value)calls stay as they were.Verification
Before:
1 failed (test_distribution_normalizers), 30 passed
After:
pytest tests/ -ra --ignore=tests/priors/test_convert_prior_to_x_only_format.py
31 passed
(The ignored file has separate pre-existing failures also introduced in
f04d3ca — happy to file a follow-up PR if useful.)