utils
#
The utils
module contains utility functions for logging metadata with the Neptune API.
stringify_unsupported()
#
Helper function that converts unsupported values in a collection or dictionary to strings.
The output of this function is lazy-evaluated, as the final type depends on the logging method that is called on the stringified object (for example, assign(obj)
versus append(obj)
).
Parameters
Name | Type | Default | Description |
---|---|---|---|
value |
dictionary or collection | None |
Dictionary or collection which may contain values of an unsupported type. |
Example
Start a run:
Log a complex dictionary with partially unsupported types:
>>> complex_dict = {"tuple": ("learning_rate", 0.01), "accuracy": 0.87} # (1)!
>>> from neptune.utils import stringify_unsupported
>>> run["complex_dict"] = stringify_unsupported(complex_dict)
- No error occurs until you upgrade to 1.0. Until then, the tuple is implicitly cast to a string. With neptune 1.0, you need to explicitly log the unsupported type as a string, or use the
stringify_unsupported()
function as in this example.
Related
This function is related to the deprecation of implicit casting to string.
For details, see the neptune 1.0 upgrade guide.