Skip to content

Commit 8e8e433

Browse files
metascroyshoumikhin
authored andcommitted
Add github cache for runner-et build (#633)
* attempt 1 * updates * try with cache * fix * fix * fix * update * fix * test * clean up * more changes * more changes * more changes * more changes * more changes * more changes * more changes * more changes * more changes * add commit hash * add commit hash * add commit hash * add commit hash * add commit hash * add commit hash * add commit hash * add commit hash * add commit hash * add commit hash * add commit hash * add commit hash * add commit hash * add commit hash * add commit hash * add commit hash * add commit hash * add commit hash * add commit hash * add commit hash * Pin to the latest stable ExecuTorch commit. * Pin to the latest stable ExecuTorch commit. * update * update * change pin * updates * updates * update pin --------- Co-authored-by: Anthony Shoumikhin <[email protected]>
1 parent 4c26ab7 commit 8e8e433

File tree

2 files changed

+45
-9
lines changed

2 files changed

+45
-9
lines changed

.github/workflows/pull.yml

Lines changed: 44 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -891,20 +891,56 @@ jobs:
891891
sysctl machdep.cpu.brand_string
892892
sysctl machdep.cpu.core_count
893893
fi
894-
- name: Install requirements
894+
- name: Install torchchat
895895
run: |
896896
echo "Intalling pip3 packages"
897897
./install_requirements.sh
898-
899-
export TORCHCHAT_ROOT=${PWD}
900-
bash scripts/build_native.sh et
901898
pip3 list
902899
python3 -c 'import torch;print(f"torch: {torch.__version__, torch.version.git_version}")'
903-
python3 -c 'import torchvision;print(f"torchvision: {torchvision.__version__, torchvision.version.git_version}")'
904-
python3 -c 'import torchaudio;print(f"torchaudio: {torchaudio.__version__, torchaudio.version.git_version}")'
905-
906-
- name: Download checkpoints
900+
- name: Set ET git sha
901+
id: setup-hash
902+
run: |
903+
export TORCHCHAT_ROOT=${PWD}
904+
echo "et-git-hash=$(cat ${TORCHCHAT_ROOT}/.pins/et-pin.txt)" >> "$GITHUB_ENV"
905+
- name: Load or install ET
906+
id: install-et
907+
uses: actions/cache@v3
908+
env:
909+
cache-key: et-build-${{runner.os}}-${{runner.arch}}-${{env.et-git-hash}}
910+
with:
911+
path: ./et-build
912+
key: ${{env.cache-key}}
913+
restore-keys: |
914+
${{env.cache-key}}
915+
- if: ${{ steps.install-et.outputs.cache-hit != 'true' }}
916+
continue-on-error: true
907917
run: |
918+
echo "Intalling ExecuTorch"
919+
export TORCHCHAT_ROOT=${PWD}
920+
bash scripts/install_et.sh
921+
- name: Install ET pip
922+
run: |
923+
echo "ET build directory"
924+
ls et-build | cat
925+
926+
pushd et-build/src/executorch
927+
if [ $(git rev-parse HEAD) != ${{env.et-git-hash}} ]; then
928+
echo "Mismatched hash. Make sure branch install_et.sh matches branch from Github cache."
929+
echo "On commit $(git rev-parse HEAD)"
930+
echo "Expected commit ${{env.et-git-hash}}"
931+
exit 1
932+
fi
933+
pip install .
934+
popd
935+
- name: Install runner
936+
run: |
937+
# Pull submodules (re2, abseil) for Tiktoken
938+
git submodule sync
939+
git submodule update --init
940+
941+
export TORCHCHAT_ROOT=${PWD}
942+
cmake -S . -B ./cmake-out -G Ninja
943+
cmake --build ./cmake-out --target et_run
908944
909945
- name: Run inference
910946
run: |

scripts/install_utils.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ clone_executorch() {
2727
pushd ${TORCHCHAT_ROOT}/${ET_BUILD_DIR}/src
2828
git clone https://github.com/pytorch/executorch.git
2929
cd executorch
30-
git checkout $(cat ${TORCHCHAT_ROOT}/.pins/et-pin)
30+
git checkout $(cat ${TORCHCHAT_ROOT}/.pins/et-pin.txt)
3131
echo "Install executorch: submodule update"
3232
git submodule sync
3333
git submodule update --init

0 commit comments

Comments
 (0)