From e520bde1fac8b62f7241512a54b36fda6b49c56b Mon Sep 17 00:00:00 2001 From: Huy Do Date: Wed, 8 Jan 2025 16:28:58 -0800 Subject: [PATCH] Bring back more changes from https://github.com/pytorch/executorch/pull/4826 --- .ci/scripts/utils.sh | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/.ci/scripts/utils.sh b/.ci/scripts/utils.sh index aa8d78da4b..f5ca2b851c 100644 --- a/.ci/scripts/utils.sh +++ b/.ci/scripts/utils.sh @@ -40,6 +40,41 @@ install_pip_dependencies() { popd || return } +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() { + pushd .ci/docker || return + TORCH_VERSION=$(cat ci_commit_pins/pytorch.txt) + popd || return + + git clone https://github.com/pytorch/pytorch.git + + # Fetch the target commit + pushd pytorch || return + git checkout "${TORCH_VERSION}" + git submodule update --init --recursive + + # Then build and install PyTorch + 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 || return + # Print sccache stats for debugging + sccache --show-stats || true +} + install_flatc_from_source() { # NB: This function could be used to install flatbuffer from source pushd third-party/flatbuffers || return