From 6850e5596629852a6789ff7aa8e15aeb813ed76a Mon Sep 17 00:00:00 2001 From: RandySheriffH <48490400+RandySheriffH@users.noreply.github.com> Date: Thu, 13 Jun 2019 13:37:59 -0700 Subject: [PATCH] Fix install_onnx.sh issue (#1201) * switch from map to array to keep visiting sequence * add comment * improve comment --- .../linux/docker/scripts/install_onnx.sh | 35 ++++++++++--------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/tools/ci_build/github/linux/docker/scripts/install_onnx.sh b/tools/ci_build/github/linux/docker/scripts/install_onnx.sh index bfbc750514..06e647d5bf 100755 --- a/tools/ci_build/github/linux/docker/scripts/install_onnx.sh +++ b/tools/ci_build/github/linux/docker/scripts/install_onnx.sh @@ -1,20 +1,22 @@ #!/bin/bash + +# The script is to generate all supported versions of onnx models which will be tested by onnx_test_runner +# in the end of ci build pipeline. The purpose is to make sure latest onnxruntime has no regressions. Note +# that the order of installation must be onnx123, onnx130, onnx141, onnx150 and onnxtip since we want +# to keep the tip of master on script exit for onnx backend test which is also a part of build pipeline. +# One possible improvement here is to keep the models saved to some public storage instead of generating +# on the fly every time. + set -e PYTHON_VER=$1 - -#Install ONNX -#5af210ca8a1c73aa6bae8754c9346ec54d0a756e is v1.2.3 -#bae6333e149a59a3faa9c4d9c44974373dcf5256 is v1.3.0 -#9e55ace55aad1ada27516038dfbdc66a8a0763db is v1.4.1 -#7d7bc83d29a328233d3e8affa4c4ea8b3e3599ef is v1.5.0 -#5c51f0dbbe88ee1536f17ee7bd462b2ab3772c52 is master -declare -A version2tag -version2tag+=(["5af210ca8a1c73aa6bae8754c9346ec54d0a756e"]="onnx123" - ["bae6333e149a59a3faa9c4d9c44974373dcf5256"]="onnx130" - ["9e55ace55aad1ada27516038dfbdc66a8a0763db"]="onnx141" - ["7d7bc83d29a328233d3e8affa4c4ea8b3e3599ef"]="onnx150" - ["5c51f0dbbe88ee1536f17ee7bd462b2ab3772c52"]="onnxtip") -for onnx_version in ${!version2tag[@]}; do +version2tag=(5af210ca8a1c73aa6bae8754c9346ec54d0a756e-onnx123 + bae6333e149a59a3faa9c4d9c44974373dcf5256-onnx130 + 9e55ace55aad1ada27516038dfbdc66a8a0763db-onnx141 + 7d7bc83d29a328233d3e8affa4c4ea8b3e3599ef-onnx150 + 5c51f0dbbe88ee1536f17ee7bd462b2ab3772c52-onnxtip) +for v2t in ${version2tag[*]}; do + onnx_version="$(cut -d'-' -f1<<<${v2t})" + onnx_tag="$(cut -d'-' -f2<<<${v2t})" if [ -z ${lastest_onnx_version+x} ]; then echo "first pass"; else @@ -27,7 +29,6 @@ for onnx_version in ${!version2tag[@]}; do cd /tmp/src/onnx-$onnx_version git clone https://github.com/pybind/pybind11.git third_party/pybind11 /usr/bin/python${PYTHON_VER} -m pip install . - mkdir -p /data/onnx/${version2tag[$onnx_version]} - backend-test-tools generate-data -o /data/onnx/${version2tag[$onnx_version]} - echo $onnx_version":"${version2tag[$onnx_version]} >> /data/onnx/version2tag + mkdir -p /data/onnx/${onnx_tag} + backend-test-tools generate-data -o /data/onnx/$onnx_tag done