nip.parameters.version.register_conversion_function#
- nip.parameters.version.register_conversion_function(from_version: str | None, to_version: str) Callable[[Callable[[dict], dict]], Callable[[dict], dict]][source]#
Decorate a function to register it as a conversion function.
A conversion function is used to transform hyper-parameter dictionaries from one version of the package to another. The function should take a dictionary as input and return a dictionary as output.
Versions are represented as strings, e.g. “1.5.3”. It is possible to omit the last elements of the version, e.g. “1.5” for version 1.5.x or “1” for version 1.x.x. In this case, it applies to any version which matches the pattern.
The
from_versionparameter may beNone. This deals with the case where the hyper-parameter dictionary does not have a_package_versionfield. This is the case for runs created prior to the introduction of this field.