Skip to content

Commit 63b012a

Browse files
jeffdailypytorchmergebot
authored andcommitted
[CI] Remove --no-use-pep517 from .ci/onnx/test.sh (pytorch#168026)
Following up on pytorch#167096, as it was causing failures in ONNX tests e.g. https://github.com/pytorch/pytorch/actions/runs/19438276772/job/55617158792#step:27:209 Pull Request resolved: pytorch#168026 Approved by: https://github.com/jeffdaily, https://github.com/atalman Co-authored-by: Jeff Daily <[email protected]>
1 parent 1a0a198 commit 63b012a

File tree

2 files changed

+85
-1
lines changed

2 files changed

+85
-1
lines changed

.ci/onnx/common.sh

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,87 @@ if [[ "${BUILD_ENVIRONMENT}" == *rocm* ]]; then
2121
fi
2222
2323
mkdir -p "$pytest_reports_dir" || true
24+
25+
##########################################
26+
# copied from .ci/pytorch/common_utils.sh
27+
##########################################
28+
29+
function get_pinned_commit() {
30+
cat .github/ci_commit_pins/"${1}".txt
31+
}
32+
33+
function pip_install_whl() {
34+
# This is used to install PyTorch and other build artifacts wheel locally
35+
# without using any network connection
36+
37+
# Convert the input arguments into an array
38+
local args=("$@")
39+
40+
# Check if the first argument contains multiple paths separated by spaces
41+
if [[ "${args[0]}" == *" "* ]]; then
42+
# Split the string by spaces into an array
43+
IFS=' ' read -r -a paths <<< "${args[0]}"
44+
# Loop through each path and install individually
45+
for path in "${paths[@]}"; do
46+
echo "Installing $path"
47+
python3 -mpip install --no-index --no-deps "$path"
48+
done
49+
else
50+
# Loop through each argument and install individually
51+
for path in "${args[@]}"; do
52+
echo "Installing $path"
53+
python3 -mpip install --no-index --no-deps "$path"
54+
done
55+
fi
56+
}
57+
58+
function pip_build_and_install() {
59+
local build_target=$1
60+
local wheel_dir=$2
61+
62+
local found_whl=0
63+
for file in "${wheel_dir}"/*.whl
64+
do
65+
if [[ -f "${file}" ]]; then
66+
found_whl=1
67+
break
68+
fi
69+
done
70+
71+
# Build the wheel if it doesn't exist
72+
if [ "${found_whl}" == "0" ]; then
73+
python3 -m pip wheel \
74+
--no-build-isolation \
75+
--no-deps \
76+
-w "${wheel_dir}" \
77+
"${build_target}"
78+
fi
79+
80+
for file in "${wheel_dir}"/*.whl
81+
do
82+
pip_install_whl "${file}"
83+
done
84+
}
85+
86+
function install_torchvision() {
87+
local orig_preload
88+
local commit
89+
commit=$(get_pinned_commit vision)
90+
orig_preload=${LD_PRELOAD}
91+
if [ -n "${LD_PRELOAD}" ]; then
92+
# Silence dlerror to work-around glibc ASAN bug, see https://sourceware.org/bugzilla/show_bug.cgi?id=27653#c9
93+
echo 'char* dlerror(void) { return "";}'|gcc -fpic -shared -o "${HOME}/dlerror.so" -x c -
94+
LD_PRELOAD=${orig_preload}:${HOME}/dlerror.so
95+
fi
96+
97+
if [[ "${BUILD_ENVIRONMENT}" == *cuda* ]]; then
98+
# Not sure if both are needed, but why not
99+
export FORCE_CUDA=1
100+
export WITH_CUDA=1
101+
fi
102+
pip_build_and_install "git+https://github.com/pytorch/vision.git@${commit}" dist/vision
103+
104+
if [ -n "${LD_PRELOAD}" ]; then
105+
LD_PRELOAD=${orig_preload}
106+
fi
107+
}

.ci/onnx/test.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ git config --global --add safe.directory /var/lib/jenkins/workspace
1919

2020
if [[ "$BUILD_ENVIRONMENT" == *onnx* ]]; then
2121
# TODO: This can be removed later once vision is also part of the Docker image
22-
pip install -q --no-use-pep517 "git+https://github.com/pytorch/vision.git@$(cat .github/ci_commit_pins/vision.txt)"
22+
install_torchvision
2323
# JIT C++ extensions require ninja, so put it into PATH.
2424
export PATH="/var/lib/jenkins/.local/bin:$PATH"
2525
# NB: ONNX test is fast (~15m) so it's ok to retry it few more times to avoid any flaky issue, we

0 commit comments

Comments
 (0)