Params
Contains the base parameter class ExperimentParameters, a dataclass meant to represent a configuration for an experiment run.
Classes:
|
Base parameter class, for handling naming and hashing. |
-
class
curifactory.params.
ExperimentParameters
(name: str = 'UNNAMED', hash: Optional[str] = None, overwrite: bool = False, hash_representations: dict = <factory>) Base parameter class, for handling naming and hashing.
In any given repo, this class should be extended to contain any needed local configuration.
Note
Extending with a
@dataclass
is recommended to make it syntactically easier to read and define.Example
from dataclasses import dataclass from curifactory import ExperimentParameters @dataclass class Params(ExperimentParameters): some_parameter: int = 0 # ...
Attributes:
Curifactory automatically fills this, but it can be overriden if you need to use very specific cache naming.
Dictionary of parameter names in the dataclass where you can provide functions that return a unique/consistent representation for each parameter to use as the value for hashing.
Parameter set name.
Whether to overwrite pre-cached values.
Methods:
params_hash
([dry])Convenience function to see the hash of these parameters that curifactory is computing, or debug them with
dry=True
.-
hash
: str = None Curifactory automatically fills this, but it can be overriden if you need to use very specific cache naming. (Should not normally be necessary.)
-
hash_representations
: dict Dictionary of parameter names in the dataclass where you can provide functions that return a unique/consistent representation for each parameter to use as the value for hashing. Setting these allow control over what counts as a cache miss/cache hit. Sane defaults are applied to any parameters that don’t have a representation function specified here. (see
hashing.get_parameter_hash_value
)Any function provided is expected to take self (the entire parameter set instance) and the value of the named parameter to be hashed.
You can also provide
None
for any parameters in order to exclude their value from the hash entirely. (This is useful for operational arguments e.g. the number of GPU’s or processes to run on, where you would not want changing that to invalidate the existing cached values.)
-
name
: str = 'UNNAMED' Parameter set name. This can be used to easily distinguish/refer to specific configurations in aggregate stages. This should be unique for every parameter set.
-
overwrite
: bool = False Whether to overwrite pre-cached values. Curifactory automatically sets this based on command line flags.
-
params_hash
(dry=False) Convenience function to see the hash of these parameters that curifactory is computing, or debug them with
dry=True
.
-