nip.parameters.version

nip.parameters.version#

A function for transforming old hyper-parameter dicts to new ones.

The specification and meaning of the hyper-parameter fields can change over time. However, sometimes we want to access hyper-parameter dictionaries that were created with an older version of the package. For example, we may want resume an old run, or re-run it with additional tests or logging.

The converge_hyper_param_dict function is used to transform an old hyper-parameter dictionary to one which is compatible with the current version of the package. This is based on the version number of the package that was used to create the hyper-parameter dictionary, stored in the _package_version field of the dictionary.

The way this works is by stepping through the versions of the package, applying conversion functions to the dictionary as needed. These conversion functions are stored in this module, registered with the register_conversion_function decorator.

Each time a new version of the package is released, a new conversion function should be added to this module.

Example

>>> @register_conversion_function("2.1.5", "2.2")
>>> def _from_2_1_5_to_2_2(hyper_param_dict: dict) -> dict:
>>>     ...

Functions

_from_0_1_to_1_0(hyper_param_dict)

_from_none_to_0_1(hyper_param_dict)

convert_hyper_param_dict(hyper_param_dict)

Convert an old hyper-parameter dictionary to a new one.

register_conversion_function(from_version, ...)

Decorate a function to register it as a conversion function.

Exceptions

ConversionFunctionNotFoundError(dict_version)

Exception raised when no conversion function matches a version number.

MultipleConversionFunctionsMatchError(...)

Exception raised when multiple conversion functions match a version number.