[Bug] Wrong script path in /workspace/scripts/convert_model.py in latest toolchain docker image
Docker image ID: 0923a4d61021
When converting TFLite to ONNX with the scripts in example (`python /workspace/scripts/convert_model.py tflite path_of_input_tflite_model path_of_output_onnx_file`)
Got message:
python: can't open file '/workspace/libs/ONNX_Convertor/optimizer_scripts/tflite-onnx/onnx_tflite/tflite2onnx.py': [Errno 2] No such file or directory Traceback (most recent call last): File "/workspace/scripts/convert_model.py", line 84, in <module> '-release_mode', 'True'], check=True) File "/workspace/miniconda/lib/python3.7/subprocess.py", line 512, in run output=stdout, stderr=stderr) subprocess.CalledProcessError: Command '['python', '/workspace/libs/ONNX_Convertor/optimizer_scripts/tflite-onnx/onnx_tflite/tflite2onnx.py', '-tflite ', <TFLite file>, '-save_path', <ONNX file>, '-release_mode', 'True']' returned non-zero exit status 2
The problem is the redundant /optimizer_scripts
in the path.
However, after remove the path, the script still fails, message:
tflite2onnx.py: error: unrecognized arguments: -tflite /data1/char_mobilenet_1.0_128_20180515_unquant.tflite Traceback (most recent call last): File "/workspace/scripts/convert_model.py", line 84, in <module> '-release_mode', 'True'], check=True) File "/workspace/miniconda/lib/python3.7/subprocess.py", line 512, in run output=stdout, stderr=stderr) subprocess.CalledProcessError: Command '['python', '/workspace/libs/ONNX_Convertor/tflite-onnx/onnx_tflite/tflite2onnx.py', '-tflite ', <TFLite file>, '-save_path', <ONNX file>, '-release_mode', 'True']' returned non-zero exit status 2.
This problem is caused by the trailing white in line 84:
'-tflite ', args.input_model,
After removing the space after tflite
, the script works.
Diff:
--- convert_model.py.orig 2021-04-19 07:42:23.604756103 +0000 +++ convert_model.py 2021-04-19 07:53:22.764785209 +0000 @@ -78,8 +78,8 @@ args.input_model, args.output_model], check=True) call_optimizer(args.output_model, args.output_model, args.disable_fuse_bn) elif args.platform == 'tflite': - subprocess.run(['python', CONVERTER_BASE + '/optimizer_scripts/tflite-onnx/onnx_tflite/tflite2onnx.py', - '-tflite ', args.input_model, + subprocess.run(['python', CONVERTER_BASE + '/tflite-onnx/onnx_tflite/tflite2onnx.py', + '-tflite', args.input_model, '-save_path', args.output_model, '-release_mode', 'True'], check=True) call_optimizer(args.output_model, args.output_model, args.disable_fuse_bn)
I haven't check other paths, so you may want to double check the script again, thank you.
The discussion has been closed due to inactivity. To continue with the topic, please feel free to post a new discussion.
Comments
Hi Phidias,
Really thanks your post,
we will fix this bug in next release.