TPU-MLIR快速入门指南: YOLOV5S TORCH 转 MLIR失败

Viewed 74

参照TPU-MLIR快速入门指南,执行YOLOV5S的 TORCH 转 MLIR失败,报错信息如下。
截图 2023-11-15 11-08-10.png
root@d93f86c3655a:/workspace/model_yolov5s_pt/workspace# model_transform.py --model_name yolov5s_pt --model_def ../yolov5s.pt --input_shapes [[1,3,640,640]] --mean 0.0,0.0,0.0 --scale 0.0039216,0.0039216,0.0039216 --keep_aspect_ratio --pixel_format rgb --test_input ../image/dog.jpg --test_result yolov5s_pt_top_outputs.npz --mlir yolov5s_pt.mlir
SOPHGO Toolchain v1.3.192-g35e4cefe-20230908
2023/11/14 11:44:59 - INFO :
_____________________________________________________
| preprocess: |
| (x - mean) * scale |
'-------------------------------------------------------'
config Preprocess args :
resize_dims : same to net input dims
keep_aspect_ratio : True
keep_ratio_mode : letterbox
pad_value : 0

pad_type : center
mean : [0.0, 0.0, 0.0]
scale : [0.0039216, 0.0039216, 0.0039216]
--------------------------
pixel_format : rgb
channel_format : nchw

Traceback (most recent call last):
File "/workspace/tpu-mlir_v1.3.192-g35e4cefe-20230908/python/tools/model_transform.py", line 272, in
tool = get_model_transform(args)
File "/workspace/tpu-mlir_v1.3.192-g35e4cefe-20230908/python/tools/model_transform.py", line 232, in get_model_transform
tool = TorchTransformer(args.model_name, args.model_def, args.input_shapes,
File "/workspace/tpu-mlir_v1.3.192-g35e4cefe-20230908/python/tools/model_transform.py", line 204, in init
self.converter = TorchConverter(self.model_name, self.model_def, input_shapes, input_types,
File "/workspace/tpu-mlir_v1.3.192-g35e4cefe-20230908/python/transform/TorchConverter.py", line 55, in init
self.load_torch_model(torch_file, input_shapes, input_types, output_names)
File "/workspace/tpu-mlir_v1.3.192-g35e4cefe-20230908/python/transform/TorchConverter.py", line 251, in load_torch_model
self.model = torch.jit.load(torch_file, map_location=torch.device('cpu'))
File "/usr/local/lib/python3.10/dist-packages/torch/jit/_serialization.py", line 162, in load
cpp_module = torch._C.import_ir_module(cu, str(f), map_location, _extra_files, _restore_shapes) # type: ignore[call-arg]
RuntimeError: PytorchStreamReader failed locating file constants.pkl: file not found

0 Answers