-
Notifications
You must be signed in to change notification settings - Fork 149
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
support paddle_yolov5s transform to MLIR #142
base: master
Are you sure you want to change the base?
Conversation
python/tools/model_runner.py
Outdated
for i in range(len(out_name)): | ||
outputs[out_name[i]] = out_data[i] | ||
|
||
#返回的是一个字典: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
请用英文注释,删除非必要注释。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
好的,我调整一下
python/tools/model_runner.py
Outdated
paddle.enable_static() | ||
exe = paddle.static.Executor(paddle.CPUPlace()) | ||
[inference_program, feed_target_names, fetch_targets] = ( | ||
paddle.static.load_inference_model('model', exe)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
读的pdmodel路径是当前路径下的model.pdmodel,不是paddle_file输入的任意路径。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
好的 这个我也调整一下
self.init_MLIRImporter() | ||
self.preprocess_args = {} | ||
if 'channel_format' in preprocess_args: | ||
if preprocess_args['channel_format'] != "none": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Traceback (most recent call last):
File "/workspace/tpu-mlir/python/tools/model_transform.py", line 296, in
tool.model_transform(args.mlir, args.add_postprocess)
File "/workspace/tpu-mlir/python/tools/model_transform.py", line 50, in model_transform
self.converter.generate_mlir(mlir_origin)
File "/workspace/tpu-mlir/python/transform/paddleConverter.py", line 395, in generate_mlir
input_ = self.mlir.create_input_op(self.get_loc(_name),idx,self.preprocess_args)
File "/workspace/tpu-mlir/python/transform/MLIRImporter.py", line 183, in create_input_op
input_op = top.InputOp(**init_args)
TypeError: InputOp.init() got an unexpected keyword argument 'preprocess_list'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
请问您执行的命令是这个吗
model_transform.py
--model_name paddle_yolov5s
--model_def ../model.pdmodel
--input_shapes [[1,3,640,640]]
--output_name 311,457,587
--mean 0.0,0.0,0.0
--scale 0.0039216,0.0039216,0.0039216
--keep_aspect_ratio
--pixel_format rgb
--test_input ../dog.jpg
--test_result paddle_yolov5s_top_outputs.npz
--mlir paddle_yolov5s.mlir
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
您好,不是这个问题。
运行: model_transform.py --model_name model --model_def ../regression/model/model.pdmodel --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 --output_names 311,457,587 --test_input ../regression/image/dog.jpg --test_result yolov5s_top_outputs.npz --mlir yolov5s.mlir
报错:
Traceback (most recent call last):
File "/workspace/tpu-mlir/python/tools/model_transform.py", line 295, in
tool.model_transform(args.mlir, args.add_postprocess)
File "/workspace/tpu-mlir/python/tools/model_transform.py", line 50, in model_transform
self.converter.generate_mlir(mlir_origin)
File "/workspace/tpu-mlir/python/transform/paddleConverter.py", line 395, in generate_mlir
input_ = self.mlir.create_input_op(self.get_loc(_name),idx,self.preprocess_args)
File "/workspace/tpu-mlir/python/transform/MLIRImporter.py", line 183, in create_input_op
input_op = top.InputOp(**init_args)
TypeError: InputOp.init() got an unexpected keyword argument 'preprocess_list'
在PaddleConverter初始化时,缺少对preprocess_args['preprocess_list']的处理。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
不好意思,我这边重新更换一下环境运行一下,看看如何解决这个问题。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
您好,我在最新环境下运行后也报了您那个错误。然后我重新调整了里面的转换代码,已经重新提交了代码,目前我这边运行结果是可以了,麻烦您有空试一下
您好,在paddle转mlir后,没有准确选取需要compare的算子进行compare。检查两者的name是否能匹配。 |
好的,我补充一下 |
python/tools/model_runner.py
Outdated
if chip == 'BM1688' or chip == 'CV186X': | ||
lib_so = 'libcmodel_1688.so' | ||
if chip == 'BM1686' or chip == 'CV186X': | ||
lib_so = 'libcmodel_1686.so' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if chip == 'BM1688' or chip == 'CV186X':
lib_so = 'libcmodel_1688.so'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
您好,请问那个昨天的INT8量化问题后面解决了吗?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
解决了,不存在问题,我就撤回了comment。
adding some files(for example:paddleCoverter.py) to convert the model from paddle_yolov5s to MLIR