# MindSpore推理报错：Load op info form json config failed, version: Ascend310

**1. 系统环境**

硬件环境\(Ascend/GPU/CPU\): Ascend/GPU/CPU

软件环境: MindSpore 版本: 2.1.0

执行模式（静态图/动态图）： 不限

Python 版本: 3.9

操作系统平台: linux

**2. 报错信息**

2.1 问题描述

docker镜像来源官方镜像库：swr.cn-south-1.myhuaweicloud.com/ascendhub/ascend-mindspore:23.0.RC2-ubuntu18.04。

2.2 报错信息

```
[ERROR] KERNEL(242,fffebb19f1f0,python):2024-06-05-09:57:26.246.982 [mindspore/ccsrc/kernel/oplib/op_info_utils.cc:172] LoadOpInfoJson] Get op info json suffix path failed, soc_version: Ascend310P3
[ERROR] KERNEL(242,fffebb19f1f0,python):2024-06-05-09:57:26.247.074 [mindspore/ccsrc/kernel/oplib/op_info_utils.cc:111] GenerateOpInfos] Load op info json failed, version: Ascend310P3
Traceback (most recent call last):
File "test.py", line 8, in
print(ops.add(x, y))
File "/usr/local/python3.7.5/lib/python3.7/site-packages/mindspore/common/_stub_tensor.py", line 49, in fun
return method(*arg, **kwargs)
File "/usr/local/python3.7.5/lib/python3.7/site-packages/mindspore/common/tensor.py", line 486, in __str__
return str(self.asnumpy())
File "/usr/local/python3.7.5/lib/python3.7/site-packages/mindspore/common/tensor.py", line 924, in asnumpy
return Tensor_.asnumpy(self)
RuntimeError: Load op info form json config failed, version: Ascend310P3
----------------------------------------------------
- C++ Call Stack: (For framework developers)
----------------------------------------------------
mindspore/ccsrc/plugin/device/ascend/hal/device/ascend_kernel_runtime.cc:431 Init
[ERROR] PIPELINE(242,ffff08132ee0,python):2024-06-05-09:57:26.248.372 [mindspore/ccsrc/pipeline/jit/pipeline.cc:2230] ClearResAtexit] Check exception before process exit: Load op info form json config failed, version: Ascend310P3
----------------------------------------------------
- C++ Call Stack: (For framework developers)
----------------------------------------------------
mindspore/ccsrc/plugin/device/ascend/hal/device/ascend_kernel_runtime.cc:431 Init
```

2.3 脚本信息

```
import numpy as np
import mindspore as ms
import mindspore.ops as ops
ms.set_context(device_target="Ascend")
x = ms.Tensor(np.ones([1,3,3,4]).astype(np.float32))
y = ms.Tensor(np.ones([1,3,3,4]).astype(np.float32))
print(ops.add(x, y))
```

**3. 根因分析**

Ascend310是推理专用卡，不能用于训练，所以调用mindspore相关算子会报错。

**4. 解决方案**

安装mindspore\_lite，可以通过python调用predict接口进行推理。

```
import mindspore_lite as mslite
import numpy as np
model = mslite.Model()
context = mslite.Context()
context.target = ["ascend"]
model.build_from_file("mobilenetv2.mindir", mslite.ModelType.MINDIR,context)
inputs = model.get_inputs()
in_data = np.fromfile("input.bin", dtype=np.float32)
inputs[0].set_data_from_numpy(in_data)
outputs = model.predict(inputs)
for output in outputs:
    data = output.get_data_to_numpy()
    print("outputs' shape: ", data.shape)
```

