From 96773c38e9d9e9afac47c5723f2c297dc60f1eed Mon Sep 17 00:00:00 2001 From: Jason Senthil Date: Wed, 26 Jul 2023 12:10:12 -0700 Subject: [PATCH] fix torch compile tests in OSS (#479) Summary: Pull Request resolved: https://github.com/pytorch/tnt/pull/479 module.compile is only in pytorch nightlies, and it seems the nightly pytorch is being overrided by the stable torch package in `requirements.txt`, so filtering out torch in the github workflows Differential Revision: D47803991 fbshipit-source-id: 9b288c1219c7b50f4607643809f4da3a6e50f19a --- .github/workflows/build_docs.yaml | 4 ++-- .github/workflows/nightly_build_cpu.yaml | 4 ++-- .github/workflows/release_build.yaml | 8 ++++---- .github/workflows/test.yaml | 2 +- tests/framework/test_auto_unit.py | 1 - 5 files changed, 9 insertions(+), 10 deletions(-) diff --git a/.github/workflows/build_docs.yaml b/.github/workflows/build_docs.yaml index 2e4433f93f..bdaa199e7e 100644 --- a/.github/workflows/build_docs.yaml +++ b/.github/workflows/build_docs.yaml @@ -26,7 +26,7 @@ jobs: set -eux conda activate test conda install pytorch cpuonly -c pytorch-nightly - pip install -r requirements.txt + pip install -r $(grep -v '^ *#\|^torch' requirements.txt | grep .) pip install -r dev-requirements.txt python setup.py sdist bdist_wheel pip install dist/*.whl @@ -36,7 +36,7 @@ jobs: set -eux conda activate test cd docs - pip install -r requirements.txt + pip install -r $(grep -v '^ *#\|^torch' requirements.txt | grep .) make html touch build/html/.nojekyll cd .. diff --git a/.github/workflows/nightly_build_cpu.yaml b/.github/workflows/nightly_build_cpu.yaml index 4efe2e1e0d..0854637c63 100644 --- a/.github/workflows/nightly_build_cpu.yaml +++ b/.github/workflows/nightly_build_cpu.yaml @@ -32,7 +32,7 @@ jobs: set -eux conda activate test conda install pytorch cpuonly -c pytorch-nightly - pip install -r requirements.txt + pip install -r $(grep -v '^ *#\|^torch' requirements.txt | grep .) python setup.py sdist bdist_wheel pip install dist/*.whl pip install -r dev-requirements.txt @@ -61,7 +61,7 @@ jobs: set -eux conda activate test conda install pytorch cpuonly -c pytorch-nightly - pip install -r requirements.txt + pip install -r $(grep -v '^ *#\|^torch' requirements.txt | grep .) pip install --no-build-isolation -e ".[dev]" - name: Upload to PyPI shell: bash -l {0} diff --git a/.github/workflows/release_build.yaml b/.github/workflows/release_build.yaml index c4a31220d9..9c10de874b 100644 --- a/.github/workflows/release_build.yaml +++ b/.github/workflows/release_build.yaml @@ -24,7 +24,7 @@ jobs: set -eux conda activate test conda install pytorch cpuonly -c pytorch-nightly - pip install -r requirements.txt + pip install -r $(grep -v '^ *#\|^torch' requirements.txt | grep .) python setup.py sdist bdist_wheel pip install dist/*.whl pip install -r dev-requirements.txt @@ -53,7 +53,7 @@ jobs: set -eux conda activate test conda install pytorch cpuonly -c pytorch-nightly - pip install -r requirements.txt + pip install -r $(grep -v '^ *#\|^torch' requirements.txt | grep .) pip install --no-build-isolation -e ".[dev]" - name: Upload to PyPI shell: bash -l {0} @@ -82,7 +82,7 @@ jobs: set -eux conda activate test conda install pytorch cpuonly -c pytorch-nightly - pip install -r requirements.txt + pip install -r $(grep -v '^ *#\|^torch' requirements.txt | grep .) pip install -r dev-requirements.txt python setup.py sdist bdist_wheel pip install dist/*.whl @@ -92,7 +92,7 @@ jobs: set -eux conda activate test cd docs - pip install -r requirements.txt + pip install -r $(grep -v '^ *#\|^torch' requirements.txt | grep .) RELEASE_BUILD=1 make html touch build/html/.nojekyll cd .. diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 2bc3bbef60..e24ad5b586 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -26,7 +26,7 @@ jobs: set -eux conda activate test conda install pytorch cpuonly -c pytorch-nightly - pip install -r requirements.txt + pip install -r $(grep -v '^ *#\|^torch' requirements.txt | grep .) pip install -r dev-requirements.txt pip install --no-build-isolation -e . - name: Run unit tests with coverage diff --git a/tests/framework/test_auto_unit.py b/tests/framework/test_auto_unit.py index 4b43fc07be..7d911a440a 100644 --- a/tests/framework/test_auto_unit.py +++ b/tests/framework/test_auto_unit.py @@ -16,7 +16,6 @@ COMPILE_AVAIL = False if is_torch_version_geq_1_13(): COMPILE_AVAIL = True - import torch._dynamo from torch.distributed import GradBucket, launcher from torch.distributed.fsdp import FullyShardedDataParallel as FSDP