diff --git a/tensorflow_datasets/core/utils/conversion_utils.py b/tensorflow_datasets/core/utils/conversion_utils.py index 5fbceaa8d69..a7e382febe0 100644 --- a/tensorflow_datasets/core/utils/conversion_utils.py +++ b/tensorflow_datasets/core/utils/conversion_utils.py @@ -152,7 +152,8 @@ def to_tfds_value(value: Any, feature: feature_lib.FeatureConnector) -> Any: case _: return [value] case feature_lib.Audio(): - if array := value.get('array'): + array = value.get('array') + if array is not None: # Hugging Face uses floats, TFDS uses integers. return [int(sample * feature.sample_rate) for sample in array] elif (path := value.get('path')) and (path := epath.Path(path)).exists():