Quellcode durchsuchen

Ubuntu onnx install script

Lutz Roeder vor 7 Jahren
Ursprung
Commit
fa5d92087d
2 geänderte Dateien mit 26 neuen und 3 gelöschten Zeilen
  1. 19 0
      tools/onnx
  2. 7 3
      tools/pytorch

+ 19 - 0
tools/onnx

@@ -51,8 +51,27 @@ sync() {
 
 install() {
     bold "onnx install"
+    case "$(uname)" in
+        "Linux")
+            if [ -z "$(which cmake)" ]; then
+                sudo apt install cmake
+            fi
+            if [ -z "$(which protoc)" ]; then
+                sudo apt install protobuf-compiler libprotoc-dev
+            fi
+            ;;
+        "Darwin")
+            if [ -z "$(which cmake)" ]; then
+                brew install cmake
+            fi
+            if [ -z "$(which protoc)" ]; then
+                brew install protobuf
+            fi
+            ;;
+    esac
     virtualenv --quiet -p ${python} ${virtualenv}
     source ${virtualenv}/bin/activate
+    ${pip} install --quiet protobuf
     export ONNX_ML=1
     export ONNX_NAMESPACE=onnx
     ${pip} install --quiet ${third_party}/onnx

+ 7 - 3
tools/pytorch

@@ -50,14 +50,18 @@ sync() {
 
 install() {
     bold "pytorch install"
-if [ "$(uname -s)" == "Darwin" ] && [ "$(which brew)" != "" ]; then
-brew bundle --file=- <<-EOS
+    case "$(uname)" in
+        "Darwin")
+            if [ -z "$(which cmake)" ]; then
+                brew bundle --file=- <<-EOS
 brew "automake"
 brew "cmake"
 brew "gflags"
 brew "glog"
 EOS
-fi
+            fi
+            ;;
+    esac
     virtualenv --quiet -p ${python} ${virtualenv}
     source ${virtualenv}/bin/activate
     pushd "${third_party}/pytorch" > /dev/null