提交 0a1078ca 编写于 作者: J jiangjiajun

check requirements

上级 8c4a8edb
......@@ -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"
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册