Boolean Types
Hypster provides boolean parameter configuration through bool and multi_bool methods. These methods handle boolean values without additional validation.
Function Signatures
def bool(
default: bool,
*,
name: str
) -> bool
def multi_bool(
default: List[bool] = [],
*,
name: str
) -> List[bool]Usage Examples
Single Boolean Values
from hypster import HP, instantiate
def stream_config(hp: HP):
# Single boolean parameters with defaults
stream = hp.bool(True, name="stream")
use_cache = hp.bool(False, name="use_cache")
verbose = hp.bool(True, name="verbose")
return {
"stream": stream,
"use_cache": use_cache,
"verbose": verbose
}
# Usage with overrides
cfg = instantiate(stream_config, values={"stream": False, "use_cache": True})
# cfg -> {"stream": False, "use_cache": True, "verbose": True}Multiple Boolean Values
Invalid Values
Required Name Parameter
All hp.* calls that you want to be overrideable must include an explicit name="..." argument.
Last updated
Was this helpful?