Jelajahi Sumber

add paddle version check for 2.0

jiangjiajun 5 tahun lalu
induk
melakukan
1cec22198a
1 mengubah file dengan 6 tambahan dan 4 penghapusan
  1. 6 4
      paddlex/__init__.py

+ 6 - 4
paddlex/__init__.py

@@ -27,10 +27,12 @@ if "CUDA_VISIBLE_DEVICES" in os.environ:
 
 import paddle
 version = paddle.__version__.strip().split('.')
-if version[0] != '1' and version[1] != '8':
-    raise Exception(
-        "For running paddlex(v{}), Version of paddlepaddle should be greater than 1.8.3 and less than 2.0.0".
-        format(__version__))
+if version[0] == '1':
+    if version[1] != '8':
+        raise Exception('For running paddlex(v{}), Version of paddlepaddle should be greater than 1.8.3'.format(__version__))
+elif version[0] == '2':
+    print("[WARNING] You are using paddlepaddle(v{}) which may not compatible with paddlex(v{}), paddlepaddle==1.8.4 is strongly recommended.".format(paddle.__version__, __version__))
+    paddle.enable_static()
 
 from .utils.utils import get_environ_info
 from . import cv