check requirements
@@ -52,6 +52,19 @@ def arg_parser():
def tf2paddle(model_path, save_dir):
+ # check tensorflow installation and version
+ try:
+ import tensorflow as tf
+ version = tf.__version__
+ if version >= '2.0.0' or version < '1.0.0':
+ print(
+ "1.0.0<=tensorflow<2.0.0 is required, and v1.14.0 is recommended"
+ )
+ return
+ except:
+ print("Tensorflow not installed, use \"pip install tensorflow\"")
+ return
+
from x2paddle.decoder.tf_decoder import TFDecoder
from x2paddle.op_mapper.tf_op_mapper import TFOpMapper
@@ -75,6 +88,16 @@ def main():
parser = arg_parser()
args = parser.parse_args()
+ try:
+ import paddle.fluid as fluid
+ import paddle
+ v0, v1, v2 = paddle.__version__.split('.')
+ if int(v0) != 1 or int(v1) < 5:
+ print("paddlepaddle>=1.5.0 is required")
+ return
+ except:
+ print("paddlepaddle not installed, use \"pip install paddlepaddle\"")
+
assert args.framework is not None, "--from is not defined(tensorflow/caffe)"
assert args.save_dir is not None, "--save_dir is not defined"
