Skip to content

Commit ecf2442

Browse files
Force torch reinstallation when user requests it. (#5168)
This fixes the scenario when the commit hash did not change, but the user requested a rebuild. Signed-off-by: Petr Kurapov <[email protected]>
1 parent a36827a commit ecf2442

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

scripts/install-pytorch.sh

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,13 @@ if pip show torch &>/dev/null; then
109109
echo "**** PyTorch is already installed. Current commit is $PYTORCH_CURRENT_COMMIT ****"
110110
if [ "$BUILD_LATEST" = false ]; then
111111
if [[ "$PYTORCH_PINNED_COMMIT" = "$PYTORCH_CURRENT_COMMIT"* ]]; then
112-
echo "**** PyTorch is already installed and its current commit is equal to the pinned commit: $PYTORCH_PINNED_COMMIT. ****"
113-
echo "**** There is no need to build anything, just exit. ****"
114-
exit 0
112+
if [ "$FORCE_REINSTALL" = true ]; then
113+
echo "**** Matching pinned commit ($PYTORCH_PINNED_COMMIT) detected but --force-reinstall specified: proceeding with rebuild. ****"
114+
else
115+
echo "**** PyTorch is already installed and its current commit matches the pinned commit: $PYTORCH_PINNED_COMMIT. ****"
116+
echo "**** There is no need to build anything, exiting. ****"
117+
exit 0
118+
fi
115119
else
116120
echo "**** Current PyTorch commit $PYTORCH_CURRENT_COMMIT ****"
117121
echo "**** Pinned PyTorch commit $PYTORCH_PINNED_COMMIT ****"

0 commit comments

Comments
 (0)