diff --git a/README.md b/README.md index 4dd2125f281fee598f6ec842239d87c54d650d91..d1562e9ef7b6fd62421b4d579e92aa72f263cfe9 100644 --- a/README.md +++ b/README.md @@ -47,13 +47,12 @@ x2paddle --framework=onnx --model=onnx_model.onnx --save_dir=pd_model ### Paddle2ONNX ``` -# 注意:paddle_infer_model_dir下需包含__model__和__params__两个文件 -x2paddle --framework=paddle2onnx --model=paddle_infer_model_dir --save_dir=onnx_model +Paddle2ONNX功能已迁移至新的github: https://github.com/PaddlePaddle/paddle2onnx, 欢迎大家去新的代码仓库查看详细介绍以及新功能。 ``` ### 参数选项 | 参数 | | |----------|--------------| -|--framework | 源模型类型 (tensorflow、caffe、onnx、paddle2onnx) | +|--framework | 源模型类型 (tensorflow、caffe、onnx) | |--prototxt | 当framework为caffe时,该参数指定caffe模型的proto文件路径 | |--weight | 当framework为caffe时,该参数指定caffe模型的参数文件路径 | |--save_dir | 指定转换后的模型保存目录路径 | @@ -61,7 +60,6 @@ x2paddle --framework=paddle2onnx --model=paddle_infer_model_dir --save_dir=onnx_ |--caffe_proto | **[可选]** 由caffe.proto编译成caffe_pb2.py文件的存放路径,当存在自定义Layer时使用,默认为None | |--define_input_shape | **[可选]** For TensorFlow, 当指定该参数时,强制用户输入每个Placeholder的shape,见[文档Q2](FAQ.md) | |--params_merge | **[可选]** 当指定该参数时,转换完成后,inference_model中的所有模型参数将合并保存为一个文件__params__ | -|--onnx_opset | **[可选]** 当framework为paddle2onnx时,该参数可设置转换为ONNX的OpSet版本,目前支持9、10、11,默认为10 | diff --git a/x2paddle/__init__.py b/x2paddle/__init__.py index 90f4567ff7c850cf1a9acd09d24965426e40f5db..bd9b93d4054d64bd1c54cb9aabad01fdee806d75 100644 --- a/x2paddle/__init__.py +++ b/x2paddle/__init__.py @@ -1,4 +1,4 @@ -__version__ = "0.8.7" +__version__ = "0.8.8" from .core.program import PaddleGraph diff --git a/x2paddle/convert.py b/x2paddle/convert.py index 0a2f5d1a762aaf81fca4eb616bfe7eebeae909f1..365e1144dc6a049c6c465499e4a868ac73c89cef 100644 --- a/x2paddle/convert.py +++ b/x2paddle/convert.py @@ -75,12 +75,6 @@ def arg_parser(): action="store_true", default=False, help="define input shape for tf model") - parser.add_argument( - "--onnx_opset", - "-oo", - type=int, - default=10, - help="when paddle2onnx set onnx opset version to export") parser.add_argument( "--params_merge", "-pm", @@ -224,24 +218,6 @@ def pytorch2paddle(model_path, save_dir, input_shapes): mapper.graph.gen_model(save_dir, real_input_shapes) -def paddle2onnx(model_path, save_dir, opset_version=10): - import paddle.fluid as fluid - try: - import paddle2onnx - except: - print( - "[ERROR] paddle2onnx not installed, use \"pip install paddle2onnx\"") - - import paddle2onnx as p2o - model = p2o.PaddleDecoder(model_path, '__model__', '__params__') - mapper = p2o.PaddleOpMapper() - mapper.convert( - model.program, - save_dir, - scope=fluid.global_scope(), - opset_version=opset_version) - - def main(): if len(sys.argv) < 2: print("Use \"x2paddle -h\" to print the help information") @@ -306,12 +282,11 @@ def main(): onnx2paddle(args.model, args.save_dir, params_merge) elif args.framework == "paddle2onnx": - assert args.model is not None, "--model should be defined while translating paddle model to onnx" - paddle2onnx(args.model, args.save_dir, opset_version=args.onnx_opset) + print("Paddle to ONNX tool has been migrated to the new github: https://github.com/PaddlePaddle/paddle2onnx") else: raise Exception( - "--framework only support tensorflow/caffe/onnx/paddle2onnx now") + "--framework only support tensorflow/caffe/onnx/ now") if __name__ == "__main__":