From 4095d89aa35bdd8b98e32ef4fe3cb9c5a0f4a59f Mon Sep 17 00:00:00 2001 From: Omkar Salpekar Date: Thu, 20 Oct 2022 15:18:28 -0400 Subject: [PATCH 1/2] [Nova] Linux CPU GHA for Unittests --- .github/workflows/test-linux-cpu.yml | 68 ++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 .github/workflows/test-linux-cpu.yml diff --git a/.github/workflows/test-linux-cpu.yml b/.github/workflows/test-linux-cpu.yml new file mode 100644 index 0000000000..8b981278f5 --- /dev/null +++ b/.github/workflows/test-linux-cpu.yml @@ -0,0 +1,68 @@ +name: Unit-tests on Linux CPU + +on: + pull_request: + push: + branches: + - nightly + - main + - release/* + workflow_dispatch: + +env: + CHANNEL: "nightly" + +jobs: + tests: + strategy: + matrix: + python_version: ["3.7", "3.8", "3.9", "3.10"] + fail-fast: false + uses: pytorch/test-infra/.github/workflows/linux_job.yml@main + with: + runner: linux.12xlarge + repository: pytorch/text + script: | + # Mark Build Directory Safe + git config --global --add safe.directory /__w/text/text + + # Set up Environment Variables + export PYTHON_VERSION="${{ matrix.python_version }}" + export VERSION="cpu" + export CUDATOOLKIT="cpuonly" + + # Set CHANNEL + if [[ (${GITHUB_EVENT_NAME} = 'pull_request' && (${GITHUB_BASE_REF} = 'release'*)) || (${GITHUB_REF} = 'refs/heads/release'*) ]]; then + export CHANNEL=test + else + export CHANNEL=nightly + fi + + # Create Conda Env + conda create -yp ci_env python="${PYTHON_VERSION}" + conda activate /work/ci_env + python3 -m pip --quiet install cmake>=3.18.0 ninja + conda env update --file ".circleci/unittest/linux/scripts/environment.yml" --prune + + # TorchText-specific Setup + printf "* Downloading SpaCy English models\n" + python -m spacy download en_core_web_sm + printf "* Downloading SpaCy German models\n" + python -m spacy download de_core_news_sm + + # Install PyTorch, Torchvision, and TorchData + set -ex + conda install \ + --yes \ + -c "pytorch-${CHANNEL}" \ + -c nvidia "pytorch-${CHANNEL}"::pytorch[build="*${VERSION}*"] \ + "${CUDATOOLKIT}" + printf "Installing torchdata nightly\n" + python3 -m pip install --pre torchdata --extra-index-url https://download.pytorch.org/whl/nightly/cpu + python3 setup.py develop + python3 -m pip install parameterized + + # Run Tests + python3 -m torch.utils.collect_env + cd test + python3 -m pytest --cov=torchtext --junitxml=test-results/junit.xml -v --durations 20 torchtext_unittes From 07aab0778b0e29d84e24ada636824b896de094d8 Mon Sep 17 00:00:00 2001 From: Omkar Salpekar Date: Thu, 20 Oct 2022 15:32:23 -0400 Subject: [PATCH 2/2] small error with folder name --- .github/workflows/test-linux-cpu.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-linux-cpu.yml b/.github/workflows/test-linux-cpu.yml index 8b981278f5..9fdae0b59f 100644 --- a/.github/workflows/test-linux-cpu.yml +++ b/.github/workflows/test-linux-cpu.yml @@ -65,4 +65,4 @@ jobs: # Run Tests python3 -m torch.utils.collect_env cd test - python3 -m pytest --cov=torchtext --junitxml=test-results/junit.xml -v --durations 20 torchtext_unittes + python3 -m pytest --cov=torchtext --junitxml=test-results/junit.xml -v --durations 20 torchtext_unittest