Bläddra i källkod

Update scripts to Python 3

Lutz Roeder 7 år sedan
förälder
incheckning
6246fffefc
3 ändrade filer med 16 tillägg och 24 borttagningar
  1. 8 3
      tools/keras
  2. 1 19
      tools/paddle
  3. 7 2
      tools/tflite

+ 8 - 3
tools/keras

@@ -8,8 +8,13 @@ test=${root}/test
 tools=${root}/tools
 third_party=${root}/third_party
 
-python="python"
-pip="pip"
+if [ $(which python3) ] && [ $(which pip3) ]; then
+    python="python3"
+    pip="pip3"
+else
+    python="python"
+    pip="pip"
+fi
 
 identifier=keras
 virtualenv=${build}/virtualenv/${identifier}
@@ -46,7 +51,7 @@ install() {
         virtualenv --quiet -p ${python} ${virtualenv}
     fi
     source ${virtualenv}/bin/activate
-    ${pip} install --quiet tensorflow
+    ${pip} install --quiet tf-nightly
     ${pip} install --quiet ${third_party}/${identifier}
     deactivate
 }

+ 1 - 19
tools/paddle

@@ -11,14 +11,6 @@ third_party=${root}/third_party
 identifier=paddle
 virtualenv=${root}/build/virtualenv/${identifier}
 
-if [ $(which python3) ] && [ $(which pip3) ]; then
-    python="python3"
-    pip="pip3"
-else
-    python="python"
-    pip="pip"
-fi
-
 bold() {
     echo "$(tty -s && tput bold)$1$(tty -s && tput sgr0)" 
 }
@@ -29,7 +21,7 @@ git_sync () {
         git -C "${third_party}/${1}" fetch -p --quiet
         git -C "${third_party}/${1}" reset --quiet --hard origin/$(git -C "${third_party}/${1}" rev-parse --abbrev-ref HEAD)
     else
-        git -C "${third_party}" clone --recursive ${2} ${1}
+        git -C "${third_party}" clone --quiet --recursive ${2} ${1}
     fi
 }
 
@@ -43,16 +35,6 @@ sync() {
     git_sync paddle https://github.com/PaddlePaddle/Paddle.git
 }
 
-install() {
-    bold "paddle install"
-    if [ ! -d "${virtualenv}" ]; then
-        virtualenv --quiet -p ${python} ${virtualenv}
-    fi
-    source ${virtualenv}/bin/activate
-    ${pip} install --quiet ${third_party}/${identifier}
-    deactivate
-}
-
 schema() {
     bold "paddle schema"
     ${node_modules}/protobufjs/bin/pbjs -t static-module -w closure --no-encode --no-delimited --no-comments --keep-case -r paddle -o ${src}/paddle-proto.js ${third_party}/${identifier}/paddle/fluid/framework/framework.proto

+ 7 - 2
tools/tflite

@@ -11,8 +11,13 @@ third_party=${root}/third_party
 identifier=tflite
 virtualenv=${build}/virtualenv/${identifier}
 
-python="python"
-pip="pip"
+if [ $(which python3) ] && [ $(which pip3) ]; then
+    python="python3"
+    pip="pip3"
+else
+    python="python"
+    pip="pip"
+fi
 
 bold() {
     echo "$(tty -s && tput bold)$1$(tty -s && tput sgr0)"