工具/软件:
工程师、您好:
在训练生成 6.1MB 二进制.onnx 文件后、我尝试使用 Pytorch 编译经过训练的模型。 我获得了用于编译模型的资源。 但没有得到澄清。
我所做的步骤:
1.将数据集拆分为 TRAIN 和 VAL.
2.编写了一个训练代码,数据集将被输入其中。
3.包含将.pth 导出到.onnx 的代码
4.克隆 edgeai-tidl-tools
5.检查分支 10_01_04_00(使用 SDK 10.01)
6、导出 SOC=am62a
7. source ./setup.sh8.打开一个新的终端选项卡$ source ./ setup_env.sh $am62a.
9、创建了一个名为 model 的目录,在其中添加了.onnx 文件
10、在中创建了一个词典 examples/osrt_python/model_configs.py
"cl-ort-my_model": create_model_config(
task_type="classification",
source=dict(
model_path="../../models/my_model.onnx",
),
preprocess=dict(
resize=256,
crop=224,
data_layout="NCHW",
resize_with_pad=False,
reverse_channels=False,
),
session=dict(
session_name="onnxrt",
model_path=os.path.join(models_base_path, "my_model.onnx"),
input_mean=[0.0, 0.0, 0.0],
input_scale=[1.0, 1.0, 1.0],
input_optimization=True,
input_details={"input": [1, 3, 224, 224]},
output_details={"output": [1, 6]},
),
extra_info=dict(
num_images=numImages,
num_classes=6,
)
),
and models_base_path =“../../../models /“
11.python3 onnxrt_ep.py -c -m cl-ort-dsm_model
错误如下:
Available execution providers : ['AzureExecutionProvider', 'CPUExecutionProvider']
Running 1 Models - ['cl-ort-my_model']
Running_Model : cl-ort-my_model
Running shape inference on model ../../../models/my_model.onnx
/home/user/.local/lib/python3.10/site-packages/onnxruntime/capi/onnxruntime_inference_collection.py:121: UserWarning: Specified provider 'TIDLCompilationProvider' is not in available provider names.Available providers: 'AzureExecutionProvider, CPUExecutionProvider'
warnings.warn(
*************** EP Error ***************
EP Error Unknown Provider Type: TIDLCompilationProvider when using ['TIDLCompilationProvider', 'CPUExecutionProvider']
Falling back to ['CPUExecutionProvider'] and retrying.
****************************************
Process Process-1:
Traceback (most recent call last):
File "/usr/lib/python3.10/multiprocessing/process.py", line 314, in _bootstrap
self.run()
File "/usr/lib/python3.10/multiprocessing/process.py", line 108, in run
self._target(*self._args, **self._kwargs)
File "/home/user/edgeai-tidl-tools/examples/osrt_python/ort/onnxrt_ep.py", line 388, in run_model
for j in range(batch):
TypeError: 'str' object cannot be interpreted as an integer
请检查并验证我所执行的步骤。 帮助我修复错误。 我需要修改任何其他内容来编译模型
此致、
Sajan