Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Paddle cannot load a saved model file in Cambricon MLU370 Card #71331

Open
wangzy0327 opened this issue Feb 28, 2025 · 1 comment
Open

Paddle cannot load a saved model file in Cambricon MLU370 Card #71331

wangzy0327 opened this issue Feb 28, 2025 · 1 comment

Comments

@wangzy0327
Copy link

wangzy0327 commented Feb 28, 2025

bug描述 Describe the Bug

paddle version : PaddlePaddle:develop d2033d0

paddlepaddle == 2.6

device Cambricon MLU370 PaddleCustomDevice:mlu

env: docker registry.baidubce.com/device/paddle-mlu:ctr2.15.0-ubuntu20-x86_64-gcc84-py310

python script

import paddle
from paddle.static import InputSpec

def save_function():
     @paddle.jit.to_static
     def fun(inputs):
         return paddle.tanh(inputs)

     path = 'test_jit_save_load_function_1/func'
     inps = paddle.rand([3, 6])
     origin = fun(inps)

     paddle.jit.save(fun, path)
     load_func = paddle.jit.load(path)

     load_result = load_func(inps)
     print((load_result - origin).abs().max() < 1e-10)


print("save function ... load function...")
save_function()

bug report

I0228 09:59:05.639653 2263858 init.cc:234] ENV [CUSTOM_DEVICE_ROOT]=/usr/local/lib/python3.10/dist-packages/paddle_custom_device
I0228 09:59:05.639703 2263858 init.cc:143] Try loading custom device libs from: [/usr/local/lib/python3.10/dist-packages/paddle_custom_device]
I0228 09:59:05.670440 2263858 custom_device.cc:1099] Succeed in loading custom runtime in lib: /usr/local/lib/python3.10/dist-packages/paddle_custom_device/libpaddle-custom-mlu.so
I0228 09:59:05.677508 2263858 custom_kernel.cc:63] Succeed in loading 264 custom kernel(s) from loaded lib(s), will be used like native ones.
I0228 09:59:05.677863 2263858 init.cc:155] Finished in LoadCustomDevice with libs_path: [/usr/local/lib/python3.10/dist-packages/paddle_custom_device]
I0228 09:59:05.678017 2263858 init.cc:240] CustomDevice: mlu, visible devices count: 1
save function ... load function...
/usr/local/lib/python3.10/dist-packages/paddle/jit/api.py:898: UserWarning: What you save is a function, and `jit.save` will generate the name of the model file according to `path` you specify. When loading these files with `jit.load`, you get a `TranslatedLayer` whose inference result is the same as the inference result of the function you saved.
  warnings.warn(
/usr/local/lib/python3.10/dist-packages/paddle/static/io.py:618: UserWarning: no variable in your model, please ensure there are any variables in your model to save
  warnings.warn(
W0228 09:59:10.656574 2263858 tensor.cc:405] The `is_initialized` method is deprecated since version 2.3, and will be removed in version 2.4! Please use `initialized` method instead.
Traceback (most recent call last):
  File "/opt/paddle_tests/test_save_load.py", line 92, in <module>
    save_function()
  File "/opt/paddle_tests/test_save_load.py", line 87, in save_function
    load_result = load_func(inps)
  File "/usr/local/lib/python3.10/dist-packages/paddle/nn/layer/layers.py", line 1426, in __call__
    return self.forward(*inputs, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/paddle/jit/translated_layer.py", line 1475, in __i_m_p_l__
    return _run_dygraph(self, input, program_holder)
  File "/usr/local/lib/python3.10/dist-packages/paddle/jit/translated_layer.py", line 1004, in _run_dygraph
    _legacy_C_ops.run_program(
RuntimeError: (NotFound)  interface not found.
  [Hint: Expected dev_impl_map.find(device_type) != dev_impl_map.end(), but received dev_impl_map.find(device_type) == dev_impl_map.end().] (at /opt/Paddle/paddle/phi/backends/device_manager.cc:296)
  [operator < run_program > error]

其他补充信息 Additional Supplementary Information

No response

@wangzy0327
Copy link
Author

@blacksheep-Aristotle Can you help me to solve the problem?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant