Skip to content

[paddlepaddle] module 'numpy' has no attribute 'float8_e5m2' #682

@takeshi-yoshimura

Description

@takeshi-yoshimura

System Info

safetensors==0.7.0

Information

  • The official example scripts
  • My own modified scripts

Reproduction

Script:

from safetensors.paddle import save_file, load_file
import paddle
t0 = paddle.randn((8, 16), dtype=paddle.float32).to(dtype=paddle.float8_e5m2)
save_file({"t0": t0}, "/tmp/a.safetensors", {})
load_file("/tmp/a.safetensors")
/data/venvs/paddle/lib/python3.12/site-packages/paddle/utils/cpp_extension/extension_utils.py:711: UserWarning: No ccache found. Please be aware that recompiling all source files may be required. You can download and install ccache from: https://github.com/ccache/ccache/blob/master/doc/INSTALL.md
  warnings.warn(warning_message)
Traceback (most recent call last):
  File "/tmp/test.py", line 5, in <module>
    load_file("/tmp/a.safetensors")
  File "/data/venvs/paddle/lib/python3.12/site-packages/safetensors/paddle.py", line 139, in load_file
    flat = numpy.load_file(filename)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/venvs/paddle/lib/python3.12/site-packages/safetensors/numpy.py", line 140, in load_file
    result[k] = f.get_tensor(k)
                ^^^^^^^^^^^^^^^
  File "/data/venvs/paddle/lib/python3.12/site-packages/numpy/__init__.py", line 795, in __getattr__
    raise AttributeError(f"module {__name__!r} has no attribute {attr!r}")
AttributeError: module 'numpy' has no attribute 'float8_e5m2'

Expected behavior

safetensors==0.6.2 did not cause this crash.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions