@@ -48,19 +48,15 @@ if [[ "${torchvision_version}" != "" ]]; then
48
48
pip install torchvision==${torchvision_version} -f https://download.pytorch.org/whl/torch_stable.html
49
49
fi
50
50
51
- if [[ " ${ipex_version} " == " 1.13.0+cpu" ]]; then
52
- ipex_whl=" https://github.com/intel/intel-extension-for-pytorch/releases/download/v1.13.0%2Bcpu/intel_extension_for_pytorch-1.13.0-cp310-cp310-manylinux2014_x86_64.whl"
53
- pip install $ipex_whl
54
- elif [[ " ${ipex_version} " == " 2.0.0+cpu" ]]; then
51
+ if [[ " ${ipex_version} " == " 2.0.0+cpu" ]]; then
55
52
ipex_whl=" https://intel-extension-for-pytorch.s3.amazonaws.com/ipex_stable/cpu/intel_extension_for_pytorch-2.0.0%2Bcpu-cp310-cp310-linux_x86_64.whl"
56
53
pip install $ipex_whl
57
54
elif [[ " ${ipex_version} " == " 2.0.1+cpu" ]]; then
58
55
ipex_whl=" https://intel-extension-for-pytorch.s3.amazonaws.com/ipex_stable/cpu/intel_extension_for_pytorch-2.0.100%2Bcpu-cp310-cp310-linux_x86_64.whl"
59
56
pip install $ipex_whl
60
- elif [[ " ${ipex_version} " == " 2.1.0" ]]; then
61
- pip install /tf_dataset/pt_binary/ww32/torch-* .whl
62
- pip install /tf_dataset/pt_binary/ww32/torchvision-* .whl
63
- pip install /tf_dataset/pt_binary/ww32/intel_extension_for_pytorch-* .whl
57
+ elif [[ " ${ipex_version} " == " 2.1.0+cpu" ]]; then
58
+ ipex_whl=" https://intel-extension-for-pytorch.s3.amazonaws.com/ipex_stable/cpu/intel_extension_for_pytorch-2.1.0%2Bcpu-cp310-cp310-linux_x86_64.whl"
59
+ pip install $ipex_whl
64
60
fi
65
61
66
62
if [[ " ${onnx_version} " != " " ]]; then
88
84
# install special test env requirements
89
85
# common deps
90
86
pip install cmake
91
- pip install horovod
92
87
pip install transformers
93
88
94
89
if [[ $( echo " ${test_case} " | grep -c " others" ) != 0 ]]; then
@@ -97,6 +92,10 @@ elif [[ $(echo "${test_case}" | grep -c "nas") != 0 ]]; then
97
92
pip install dynast==1.6.0rc1
98
93
elif [[ $( echo " ${test_case} " | grep -c " tf pruning" ) != 0 ]]; then
99
94
pip install tensorflow-addons
95
+ # Workaround
96
+ # horovod can't be install in the env with TF and PT together
97
+ # so test distribute cases in the env with single fw installed
98
+ pip install horovod
100
99
fi
101
100
# test deps
102
101
pip install coverage
@@ -106,3 +105,12 @@ pip list
106
105
echo " [DEBUG] list pipdeptree..."
107
106
pip install pipdeptree
108
107
pipdeptree
108
+
109
+ # import torch before import tensorflow
110
+ if [[ $( echo " ${test_case} " | grep -c " run basic api" ) != 0 ]] || [[ $( echo " ${test_case} " | grep -c " run basic others" ) != 0 ]] || [[ $( echo " ${test_case} " | grep -c " run basic adaptor" ) != 0 ]]; then
111
+ cd /neural-compressor/test || exit 1
112
+ find . -name " test*.py" | xargs sed -i ' s/import tensorflow as tf/import torch; import tensorflow as tf/g'
113
+ find . -name " test*.py" | xargs sed -i ' s/import tensorflow.compat.v1 as tf/import torch; import tensorflow.compat.v1 as tf/g'
114
+ find . -name " test*.py" | xargs sed -i ' s/from tensorflow import keras/import torch; from tensorflow import keras/g'
115
+ fi
116
+
0 commit comments