#!/bin/bash # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. set -ex # shellcheck source=/dev/null source "$(dirname "${BASH_SOURCE[0]}")/utils.sh" install_domains() { echo "Install torchvision and torchaudio" pip_install --no-use-pep517 --user "git+https://github.com/pytorch/audio.git@${TORCHAUDIO_VERSION}" pip_install --no-use-pep517 --user "git+https://github.com/pytorch/vision.git@${TORCHVISION_VERSION}" } install_pytorch_and_domains() { git clone https://github.com/pytorch/pytorch.git # Fetch the target commit pushd pytorch || true git checkout "${TORCH_VERSION}" git submodule update --init --recursive chown -R ci-user . export _GLIBCXX_USE_CXX11_ABI=0 # Then build and install PyTorch conda_run python setup.py bdist_wheel pip_install "$(echo dist/*.whl)" # Grab the pinned audio and vision commits from PyTorch TORCHAUDIO_VERSION=$(cat .github/ci_commit_pins/audio.txt) export TORCHAUDIO_VERSION TORCHVISION_VERSION=$(cat .github/ci_commit_pins/vision.txt) export TORCHVISION_VERSION install_domains popd || true # Clean up the cloned PyTorch repo to reduce the Docker image size rm -rf pytorch # Print sccache stats for debugging as_ci_user sccache --show-stats } install_pytorch_and_domains