From c7e5ad4d4cd35384b50e524e1a4ad7adf42f65df Mon Sep 17 00:00:00 2001 From: Michael Gschwind <61328285+mikekgfb@users.noreply.github.com> Date: Fri, 24 Jan 2025 14:00:25 -0800 Subject: [PATCH 1/3] Add evaluation, multimodal, native tests to run-readme-pr-macos.yml (#1409) * Add evaluation, multimodal, native tests to run-readme-pr-macos.yml Add evaluation, multimodal, native tests to run-readme-pr-macos.yml * Update run-readme-pr-mps.yml * Update build_native.sh Update to C++11 ABI for AOTI, similar to ET * Update run-readme-pr-macos.yml fix typo --------- Co-authored-by: Jack-Khuu --- .github/workflows/run-readme-pr-macos.yml | 103 ++++++++++++++++++++++ 1 file changed, 103 insertions(+) diff --git a/.github/workflows/run-readme-pr-macos.yml b/.github/workflows/run-readme-pr-macos.yml index 64afe2247..c6f3d99f6 100644 --- a/.github/workflows/run-readme-pr-macos.yml +++ b/.github/workflows/run-readme-pr-macos.yml @@ -143,3 +143,106 @@ jobs: echo "tests complete" echo "*******************************************" echo "::endgroup::" + + test-eval-macos: + runs-on: macos-14-xlarge + steps: + - name: Checkout code + uses: actions/checkout@v2 + - uses: actions/setup-python@v4 + with: + python-version: '3.10.11' + - name: Setup Xcode + if: runner.os == 'macOS' + uses: maxim-lobanov/setup-xcode@v1 + with: + xcode-version: '15.3' + - name: Run script + run: | + set -x + # NS: Remove previous installation of torch first + # as this script does not isntall anything into conda env but rather as system dep + pip3 uninstall -y torch || true + set -eou pipefail + + echo "::group::Print machine info" + uname -a + sysctl machdep.cpu.brand_string + sysctl machdep.cpu.core_count + echo "::endgroup::" + + .ci/scripts/run-docs evaluation + + echo "::group::Completion" + echo "tests complete" + echo "*******************************************" + echo "::endgroup::" + + test-multimodal-macos: + runs-on: macos-14-xlarge + steps: + - name: Checkout code + uses: actions/checkout@v2 + - uses: actions/setup-python@v4 + with: + python-version: '3.10.11' + - name: Setup Xcode + if: runner.os == 'macOS' + uses: maxim-lobanov/setup-xcode@v1 + with: + xcode-version: '15.3' + - name: Run script + run: | + set -x + # NS: Remove previous installation of torch first + # as this script does not isntall anything into conda env but rather as system dep + pip3 uninstall -y torch || true + set -eou pipefail + + echo "::group::Print machine info" + uname -a + sysctl machdep.cpu.brand_string + sysctl machdep.cpu.core_count + echo "::endgroup::" + + .ci/scripts/run-docs multimodal + + echo "::group::Completion" + echo "tests complete" + echo "*******************************************" + echo "::endgroup::" + + test-native-macos: + runs-on: macos-14-xlarge + steps: + - name: Checkout code + uses: actions/checkout@v2 + - uses: actions/setup-python@v4 + with: + python-version: '3.10.11' + - name: Setup Xcode + if: runner.os == 'macOS' + uses: maxim-lobanov/setup-xcode@v1 + with: + xcode-version: '15.3' + - name: Run script + run: | + set -x + # NS: Remove previous installation of torch first + # as this script does not isntall anything into conda env but rather as system dep + pip3 uninstall -y torch || true + set -eou pipefail + + echo "::group::Print machine info" + uname -a + sysctl machdep.cpu.brand_string + sysctl machdep.cpu.core_count + echo "::endgroup::" + + .ci/scripts/run-docs native + + echo "::group::Completion" + echo "tests complete" + echo "*******************************************" + echo "::endgroup::" + From 24fd44117e888d6c87c812753c0a9d6bfa17072e Mon Sep 17 00:00:00 2001 From: Michael Gschwind <61328285+mikekgfb@users.noreply.github.com> Date: Fri, 24 Jan 2025 14:03:10 -0800 Subject: [PATCH 2/3] Add evaluation, multimodal, native tests to run-readme-pr-mps.yml (#1410) * Add evaluation, multimodal, native tests to run-readme-pr-mps.yml Add evaluation, multimodal, native tests to run-readme-pr-mps.yml * Update run-readme-pr-mps.yml Typos * Update run-readme-pr-mps.yml * Update run-readme-pr-mps.yml Extend timeout for test-readme-mps to avoid test failing from timeout. * Update build_native.sh Update to C++11 ABI for AOTI, similar to ET --------- Co-authored-by: Jack-Khuu --- .github/workflows/run-readme-pr-mps.yml | 81 +++++++++++++++++++++++++ 1 file changed, 81 insertions(+) diff --git a/.github/workflows/run-readme-pr-mps.yml b/.github/workflows/run-readme-pr-mps.yml index 7ab5b1558..4d5cd7e14 100644 --- a/.github/workflows/run-readme-pr-mps.yml +++ b/.github/workflows/run-readme-pr-mps.yml @@ -113,3 +113,84 @@ jobs: echo "tests complete" echo "*******************************************" echo "::endgroup::" + + test-evaluation-mps-macos: + uses: pytorch/test-infra/.github/workflows/macos_job.yml@main + with: + runner: macos-m1-14 # needs MPS, was macos-m1-stable + script: | + set -x + conda create -y -n test-evaluation-mps-macos python=3.10.11 + conda activate test-evaluation-mps-macos + # NS: Remove previous installation of torch first + # as this script does not isntall anything into conda env + # but rather system dep + pip3 uninstall -y torch || true + set -eou pipefail + + echo "::group::Print machine info" + uname -a + sysctl machdep.cpu.brand_string + sysctl machdep.cpu.core_count + echo "::endgroup::" + + .ci/scripts/run-docs evaluation + + echo "::group::Completion" + echo "tests complete" + echo "*******************************************" + echo "::endgroup::" + + test-multimodal-mps-macos: + uses: pytorch/test-infra/.github/workflows/macos_job.yml@main + with: + runner: macos-m1-14 # needs MPS, was macos-m1-stable + script: | + set -x + conda create -y -n test-multimodal-mps-macos python=3.10.11 + conda activate test-multimodal-mps-macos + # NS: Remove previous installation of torch first + # as this script does not isntall anything into conda env + # but rather system dep + pip3 uninstall -y torch || true + set -eou pipefail + + echo "::group::Print machine info" + uname -a + sysctl machdep.cpu.brand_string + sysctl machdep.cpu.core_count + echo "::endgroup::" + + .ci/scripts/run-docs multimodal + + echo "::group::Completion" + echo "tests complete" + echo "*******************************************" + echo "::endgroup::" + + test-native-mps-macos: + uses: pytorch/test-infra/.github/workflows/macos_job.yml@main + with: + runner: macos-m1-14 # needs MPS, was macos-m1-stable + script: | + set -x + conda create -y -n test-native-mps-macos python=3.10.11 + conda activate test-native-mps-macos + # NS: Remove previous installation of torch first + # as this script does not isntall anything into conda env + # but rather system dep + pip3 uninstall -y torch || true + set -eou pipefail + + echo "::group::Print machine info" + uname -a + sysctl machdep.cpu.brand_string + sysctl machdep.cpu.core_count + echo "::endgroup::" + + .ci/scripts/run-docs native + + echo "::group::Completion" + echo "tests complete" + echo "*******************************************" + echo "::endgroup::" From 9686c79818e594199844563de219a8541aa66ce8 Mon Sep 17 00:00:00 2001 From: Michael Gschwind <61328285+mikekgfb@users.noreply.github.com> Date: Fri, 24 Jan 2025 14:07:36 -0800 Subject: [PATCH 3/3] Force run-readme-pr-macos.yml to use CPU instead of incorrectly loading to MPS (#1417) * bandaid for run-readme-pr-macos.yml incorrectly loading to MPS as per #1416 torchchat on hosts without MPS (which is all github hosts which use kvm to virtualize MacOS, but not MPS) should choose CPU as "fast" device. The logic is present (see discussion in #1416 ), but either not fully functional (that would be the easier one to fix, just print the result of get_device_str and fix the code!) or specifically ignored on load in torch/serialization.py (If this is the case, we're effectively looking at a core PyTorch issue....) In the meantime, this bandaid just forces the use of CPU on MacOS tests, to make MacOS tests run on CPU -- labeit hsortcircuiting test/execution of the "fast" device logic. Not ideal, but some testing beats no testing. * Update run-readme-pr-macos.yml Add informational message to MacOS CPU tests * Update build_native.sh Update to C++11 ABI for AOTI, similar to ET --------- Co-authored-by: Jack-Khuu --- .github/workflows/run-readme-pr-macos.yml | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/.github/workflows/run-readme-pr-macos.yml b/.github/workflows/run-readme-pr-macos.yml index c6f3d99f6..ce84d3b50 100644 --- a/.github/workflows/run-readme-pr-macos.yml +++ b/.github/workflows/run-readme-pr-macos.yml @@ -33,7 +33,8 @@ jobs: sysctl machdep.cpu.core_count echo "::endgroup::" - .ci/scripts/run-docs readme + echo "using workaround for #1416 and #1315 by setting torchchat device explicitly" + TORCHCHAT_DEVICE=cpu .ci/scripts/run-docs readme echo "::group::Completion" echo "tests complete" @@ -68,7 +69,8 @@ jobs: sysctl machdep.cpu.core_count echo "::endgroup::" - .ci/scripts/run-docs quantization + echo "using workaround for #1416 and #1315 by setting torchchat device explicitly" + TORCHCHAT_DEVICE=cpu .ci/scripts/run-docs quantization echo "::group::Completion" echo "tests complete" @@ -103,7 +105,8 @@ jobs: sysctl machdep.cpu.core_count echo "::endgroup::" - .ci/scripts/run-docs gguf + echo "using workaround for #1416 and #1315 by setting torchchat device explicitly" + TORCHCHAT_DEVICE=cpu .ci/scripts/run-docs gguf echo "::group::Completion" echo "tests complete" @@ -137,7 +140,8 @@ jobs: sysctl machdep.cpu.core_count echo "::endgroup::" - .ci/scripts/run-docs advanced + echo "using workaround for #1416 and #1315 by setting torchchat device explicitly" + TORCHCHAT_DEVICE=cpu .ci/scripts/run-docs advanced echo "::group::Completion" echo "tests complete"