尝试在板子上将pytorch转出onnx模型,但是遇到了错误
收藏回复举报
尝试在板子上将pytorch转出onnx模型,但是遇到了错误
t('forum.solved') 已解决
发表于2024-05-29 14:58:54
0 查看

板子是Atlas200DK A2,CANN是8.0.RC1.alpha003。

原本在Ubuntu下可以运行转为onnx,想直接在开发板上转就发生如下报错

model_data/yolov5_s.pth model, and classes loaded. 

Starting export with onnx 1.16.1. 

Simplifying with onnx-simplifier 0.4.36. 

2024-05-29 14:49:28.873563897 [E:onnxruntime:Default, env.cc:228 ThreadMain] pthread_setaffinity_np failed for thread: 2149634, index: 2, mask: {3, }, error code: 22 error msg: Invalid argument. Specify the number of threads explicitly so the affinity is not set. 

2024-05-29 14:49:28.875623649 [E:onnxruntime:Default, env.cc:228 ThreadMain] pthread_setaffinity_np failed for thread: 2149637, index: 2, mask: {3, }, error code: 22 error msg: Invalid argument. Specify the number of threads explicitly so the affinity is not set. 

2024-05-29 14:49:28.877191917 [E:onnxruntime:Default, env.cc:228 ThreadMain] pthread_setaffinity_np failed for thread: 2149640, index: 2, mask: {3, }, error code: 22 error msg: Invalid argument. Specify the number of threads explicitly so the affinity is not set. 

2024-05-29 14:49:28.878727997 [E:onnxruntime:Default, env.cc:228 ThreadMain] pthread_setaffinity_np failed for thread: 2149643, index: 2, mask: {3, }, error code: 22 error msg: Invalid argument. Specify the number of threads explicitly so the affinity is not set. 

2024-05-29 14:49:28.880173055 [E:onnxruntime:Default, env.cc:228 ThreadMain] pthread_setaffinity_np failed for thread: 2149646, index: 2, mask: {3, }, error code: 22 error msg: Invalid argument. Specify the number of threads explicitly so the affinity is not set. 

2024-05-29 14:49:28.881571696 [E:onnxruntime:Default, env.cc:228 ThreadMain] pthread_setaffinity_np failed for thread: 2149649, index: 2, mask: {3, }, error code: 22 error msg: Invalid argument. Specify the number of threads explicitly so the affinity is not set. 

2024-05-29 14:49:28.883154465 [E:onnxruntime:Default, env.cc:228 ThreadMain] pthread_setaffinity_np failed for thread: 2149652, index: 2, mask: {3, }, error code: 22 error msg: Invalid argument. Specify the number of threads explicitly so the affinity is not set.

查了下是四核,于是添加了

import os 

import onnxruntime as ort 

os.environ['OMP_NUM_THREADS'] = '4' 

os.environ['MKL_NUM_THREADS'] = '4'

,但仍然是一样的错误。

求解答

我要发帖子