Skip to content

Float attribute value malformed#

Error

ERROR: Error occurred during asynchronous operation processing: Value of float attribute cannot be malformed.

Issue#

A value you are trying to log is malformed or unsupported.

Note that Neptune does not support Inf or NaN values.

Workaround#

Use a supported value type, or convert the value to string.

Info

As of version 1.8.3 , Neptune automatically skips any unsupported values.

For upgrade instructions, see Upgrade the Neptune client library.

Stringifying unsupported values#

You can pass a value or collection of values to the utils.stringify_unsupported() function, which converts any unsupported values to strings.

This way, you can log common Python constants, like math.inf or math.nan, without errors.

import math
import neptune
from neptune.utils import stringify_unsupported

run = neptune.init_run()

value = math.inf
run["inf"] = stringify_unsupported(value) # (1)!
  1. You can also convert individual values to strings using the built-in str() method.

    run["inf"] = str(value) if math.isinf(value) else value
    
When fetching
value = float(run["inf"].fetch())

Handling unsupported values in a series#

If you're logging a series of values, as of version 1.8.3 , Neptune automatically skips any unsupported values.

On older versions, you can add a check to filter out Inf and NaN values:

values = [...]
for v in values:
    if not math.isinf(v) and not math.isnan(v):
        run["metric"].append(v)

Tip

To help locate the problem in your code, try initializing Neptune in synchronous mode:

run = neptune.init_run(mode="sync")

Getting help