Enable None as default and instantiation value for hp.int, hp.float, hp.bool, and hp.select#12
Draft
Enable None as default and instantiation value for hp.int, hp.float, hp.bool, and hp.select#12
Conversation
…lect Co-authored-by: gilad-rubin <6134299+gilad-rubin@users.noreply.github.com>
Co-authored-by: gilad-rubin <6134299+gilad-rubin@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] can you enable a user to define None as the value and/or default for hp.select, hp.int, hp.float, hp.bool? if so - add that option
example
hp.int(default=None, min=1, max=10, name="dimensions")
or
def conf(hp: HP):
hp.int(default=7, max=10, name...
Enable None as default and instantiation value for hp.int, hp.float, hp.bool, and hp.select
Aug 29, 2025
CodSpeed Performance ReportMerging #12 will not alter performanceComparing Summary
|
|
Important Review skippedBot user detected. To trigger a single review, invoke the You can disable this status message by setting the Comment |
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.
This PR implements support for using
Noneas both default values and instantiation values forhp.int,hp.float,hp.bool, andhp.selectparameter types.Problem
Previously, users could not define
Noneas a valid value for hyperparameters, which limited flexibility when dealing with optional parameters. The following use cases were not supported:Solution
Core Changes
IntValidator,FloatValidator,BoolValidator) to accept and returnOptionaltypes, with early return forNonevaluesNone, preventing unnecessary validation errorsNonedefault using a sentinel valueOptionalparameter and return typesKey Features
hp.int(default=None, name="param")now worksinstantiate(config, values={"param": None})now workshp.select(['a', 'b'])(uses first option) andhp.select(['a', 'b'], default=None)(returns None)Example Usage
This enhancement provides greater flexibility for optional hyperparameters while maintaining all existing functionality and validation behavior.
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.