From b06428cf7f9dd99e52ff6af6f834f1ed8369849a Mon Sep 17 00:00:00 2001 From: Omkar Salpekar Date: Fri, 26 May 2023 13:46:13 -0700 Subject: [PATCH 1/5] Remove Unused Docker build --- .circleci/config.yml | 32 -------------------------------- .circleci/config.yml.in | 32 -------------------------------- 2 files changed, 64 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 033e8c3f75..791c80eabc 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -81,27 +81,6 @@ jobs: name: .circleci/config.yml not in sync with config.yml.in! Run '$ python .circleci/regenerate.py' to fix this. command: exit 1 - smoke_test_docker_image_build: - machine: - image: ubuntu-1604:201903-01 - resource_class: large - environment: - image_name: torchtext/smoke_test - steps: - - checkout - - run: - name: Build and push Docker image - no_output_timeout: "1h" - command: | - set +x - echo "${DOCKER_HUB_TOKEN}" | docker login --username "${DOCKER_HUB_USERNAME}" --password-stdin - set -x - cd .circleci/smoke_test/docker && docker build . -t ${image_name}:${CIRCLE_WORKFLOW_ID} - docker tag ${image_name}:${CIRCLE_WORKFLOW_ID} ${image_name}:latest - docker push ${image_name}:${CIRCLE_WORKFLOW_ID} - docker push ${image_name}:latest - - stylecheck: <<: *binary_common docker: @@ -120,14 +99,3 @@ workflows: lint: jobs: - circleci_consistency - docker_build: - triggers: - - schedule: - cron: "0 10 * * 0" - filters: - branches: - only: - - main - jobs: - - smoke_test_docker_image_build: - context: org-member diff --git a/.circleci/config.yml.in b/.circleci/config.yml.in index 033e8c3f75..791c80eabc 100644 --- a/.circleci/config.yml.in +++ b/.circleci/config.yml.in @@ -81,27 +81,6 @@ jobs: name: .circleci/config.yml not in sync with config.yml.in! Run '$ python .circleci/regenerate.py' to fix this. command: exit 1 - smoke_test_docker_image_build: - machine: - image: ubuntu-1604:201903-01 - resource_class: large - environment: - image_name: torchtext/smoke_test - steps: - - checkout - - run: - name: Build and push Docker image - no_output_timeout: "1h" - command: | - set +x - echo "${DOCKER_HUB_TOKEN}" | docker login --username "${DOCKER_HUB_USERNAME}" --password-stdin - set -x - cd .circleci/smoke_test/docker && docker build . -t ${image_name}:${CIRCLE_WORKFLOW_ID} - docker tag ${image_name}:${CIRCLE_WORKFLOW_ID} ${image_name}:latest - docker push ${image_name}:${CIRCLE_WORKFLOW_ID} - docker push ${image_name}:latest - - stylecheck: <<: *binary_common docker: @@ -120,14 +99,3 @@ workflows: lint: jobs: - circleci_consistency - docker_build: - triggers: - - schedule: - cron: "0 10 * * 0" - filters: - branches: - only: - - main - jobs: - - smoke_test_docker_image_build: - context: org-member From f47af2fde1c3fb8dcfd2cc1864c640aa0754f52c Mon Sep 17 00:00:00 2001 From: Omkar Salpekar Date: Tue, 30 May 2023 11:07:18 -0700 Subject: [PATCH 2/5] Deleting CircleCI directory entirely --- .circleci/build_docs/commit_docs.sh | 35 ------ .circleci/config.yml | 101 ------------------ .circleci/config.yml.in | 101 ------------------ .circleci/regenerate.py | 33 ------ .circleci/smoke_test/docker/Dockerfile | 33 ------ .circleci/smoke_test/docker/build_and_push.sh | 8 -- .../unittest/linux/scripts/environment.yml | 19 ---- .circleci/unittest/linux/scripts/install.sh | 41 ------- .../unittest/linux/scripts/post_process.sh | 8 -- .circleci/unittest/linux/scripts/run_test.sh | 10 -- .circleci/unittest/linux/scripts/setup_env.sh | 49 --------- .../unittest/windows/scripts/environment.yml | 21 ---- .circleci/unittest/windows/scripts/install.sh | 34 ------ .../windows/scripts/install_conda.bat | 1 - .../unittest/windows/scripts/post_process.sh | 8 -- .../unittest/windows/scripts/run_test.sh | 10 -- .../unittest/windows/scripts/setup_env.sh | 47 -------- .circleci/utils/test_sort_yaml.py | 15 --- 18 files changed, 574 deletions(-) delete mode 100755 .circleci/build_docs/commit_docs.sh delete mode 100644 .circleci/config.yml delete mode 100644 .circleci/config.yml.in delete mode 100755 .circleci/regenerate.py delete mode 100644 .circleci/smoke_test/docker/Dockerfile delete mode 100755 .circleci/smoke_test/docker/build_and_push.sh delete mode 100644 .circleci/unittest/linux/scripts/environment.yml delete mode 100755 .circleci/unittest/linux/scripts/install.sh delete mode 100755 .circleci/unittest/linux/scripts/post_process.sh delete mode 100755 .circleci/unittest/linux/scripts/run_test.sh delete mode 100755 .circleci/unittest/linux/scripts/setup_env.sh delete mode 100644 .circleci/unittest/windows/scripts/environment.yml delete mode 100644 .circleci/unittest/windows/scripts/install.sh delete mode 100644 .circleci/unittest/windows/scripts/install_conda.bat delete mode 100644 .circleci/unittest/windows/scripts/post_process.sh delete mode 100644 .circleci/unittest/windows/scripts/run_test.sh delete mode 100644 .circleci/unittest/windows/scripts/setup_env.sh delete mode 100755 .circleci/utils/test_sort_yaml.py diff --git a/.circleci/build_docs/commit_docs.sh b/.circleci/build_docs/commit_docs.sh deleted file mode 100755 index 11297f9521..0000000000 --- a/.circleci/build_docs/commit_docs.sh +++ /dev/null @@ -1,35 +0,0 @@ -#!/usr/bin/env bash - -set -ex - - -if [ "$2" == "" ]; then - echo call as "$0" "" "" - echo where src is the root of the built documentation git checkout and - echo branch should be "main" or "1.7" or so - exit 1 -fi - -src=$1 -target=$2 - -echo "committing docs from ${src} to ${target}" - -pushd $src -git checkout gh-pages -mkdir -p ./"${target}" -rm -rf ./"${target}"/* -cp -r "${src}/docs/build/html/"* ./"$target" -if [ "${target}" == "main" ]; then - mkdir -p ./_static - rm -rf ./_static/* - cp -r "${src}/docs/build/html/_static/"* ./_static - git add --all ./_static || true -fi -git add --all ./"${target}" || true -git config user.email "soumith+bot@pytorch.org" -git config user.name "pytorchbot" -# If there aren't changes, don't make a commit; push is no-op -git commit -m "auto-generating sphinx docs" || true -git remote add https https://github.com/pytorch/text.git -git push -u https gh-pages diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index 791c80eabc..0000000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,101 +0,0 @@ -version: 2.1 - -# How to test the Linux jobs: -# - Install CircleCI local CLI: https://circleci.com/docs/2.0/local-cli/ -# - circleci config process .circleci/config.yml > gen.yml && circleci local execute -c gen.yml --job binary_linux_wheel_py3.8 -# - Replace binary_linux_wheel_py3.8 with the name of the job you want to test. -# Job names are 'name:' key. - -orbs: - win: circleci/windows@2.0.0 - -executors: - windows-cpu: - machine: - resource_class: windows.xlarge - image: windows-server-2019-vs2019:stable - shell: bash.exe - -commands: - designate_upload_channel: - description: "inserts the correct upload channel into ${BASH_ENV}" - steps: - - run: - name: adding UPLOAD_CHANNEL to BASH_ENV - command: | - our_upload_channel=nightly - # On tags upload to test instead - if [[ -n "${CIRCLE_TAG}" ]] || [[ ${CIRCLE_BRANCH} =~ release/* ]]; then - our_upload_channel=test - fi - echo "export UPLOAD_CHANNEL=${our_upload_channel}" >> ${BASH_ENV} - load_conda_channel_flags: - description: "Determines whether we need extra conda channels" - steps: - - run: - name: Adding CONDA_CHANNEL_FLAGS to BASH_ENV - command: | - CONDA_CHANNEL_FLAGS="" - -binary_common: &binary_common - parameters: - # Edit these defaults to do a release - build_version: - description: "version number of release binary; by default, build a nightly" - type: string - default: "" - pytorch_version: - description: "PyTorch version to build against; by default, use a nightly" - type: string - default: "" - torchdata_version: - description: "TorchData version to build against; by default, use a nightly" - type: string - default: "" - # Don't edit these - python_version: - description: "Python version to build against (e.g., 3.8)" - type: string - environment: - PYTHON_VERSION: << parameters.python_version >> - BUILD_VERSION: << parameters.build_version >> - PYTORCH_VERSION: << parameters.pytorch_version >> - TORCHDATA_VERSION: << parameters.torchdata_version >> - CU_VERSION: cpu - MACOSX_DEPLOYMENT_TARGET: 10.9 - -jobs: - circleci_consistency: - docker: - - image: cimg/python:3.8 - steps: - - checkout - - run: - name: Install check utilities - command: pip install --user --progress-bar=off jinja2 pyyaml - - run: - name: Check CircleCI config consistency - command: python .circleci/regenerate.py && git diff --quiet - - run: - when: on_fail - name: .circleci/config.yml not in sync with config.yml.in! Run '$ python .circleci/regenerate.py' to fix this. - command: exit 1 - - stylecheck: - <<: *binary_common - docker: - - image: "pytorch/manylinux-cuda102" - resource_class: medium - steps: - - checkout - - designate_upload_channel - - run: - name: Setup - command: .circleci/unittest/linux/scripts/setup_env.sh - - run: - name: Run style check - command: .circleci/unittest/linux/scripts/run_style_checks.sh -workflows: - lint: - jobs: - - circleci_consistency diff --git a/.circleci/config.yml.in b/.circleci/config.yml.in deleted file mode 100644 index 791c80eabc..0000000000 --- a/.circleci/config.yml.in +++ /dev/null @@ -1,101 +0,0 @@ -version: 2.1 - -# How to test the Linux jobs: -# - Install CircleCI local CLI: https://circleci.com/docs/2.0/local-cli/ -# - circleci config process .circleci/config.yml > gen.yml && circleci local execute -c gen.yml --job binary_linux_wheel_py3.8 -# - Replace binary_linux_wheel_py3.8 with the name of the job you want to test. -# Job names are 'name:' key. - -orbs: - win: circleci/windows@2.0.0 - -executors: - windows-cpu: - machine: - resource_class: windows.xlarge - image: windows-server-2019-vs2019:stable - shell: bash.exe - -commands: - designate_upload_channel: - description: "inserts the correct upload channel into ${BASH_ENV}" - steps: - - run: - name: adding UPLOAD_CHANNEL to BASH_ENV - command: | - our_upload_channel=nightly - # On tags upload to test instead - if [[ -n "${CIRCLE_TAG}" ]] || [[ ${CIRCLE_BRANCH} =~ release/* ]]; then - our_upload_channel=test - fi - echo "export UPLOAD_CHANNEL=${our_upload_channel}" >> ${BASH_ENV} - load_conda_channel_flags: - description: "Determines whether we need extra conda channels" - steps: - - run: - name: Adding CONDA_CHANNEL_FLAGS to BASH_ENV - command: | - CONDA_CHANNEL_FLAGS="" - -binary_common: &binary_common - parameters: - # Edit these defaults to do a release - build_version: - description: "version number of release binary; by default, build a nightly" - type: string - default: "" - pytorch_version: - description: "PyTorch version to build against; by default, use a nightly" - type: string - default: "" - torchdata_version: - description: "TorchData version to build against; by default, use a nightly" - type: string - default: "" - # Don't edit these - python_version: - description: "Python version to build against (e.g., 3.8)" - type: string - environment: - PYTHON_VERSION: << parameters.python_version >> - BUILD_VERSION: << parameters.build_version >> - PYTORCH_VERSION: << parameters.pytorch_version >> - TORCHDATA_VERSION: << parameters.torchdata_version >> - CU_VERSION: cpu - MACOSX_DEPLOYMENT_TARGET: 10.9 - -jobs: - circleci_consistency: - docker: - - image: cimg/python:3.8 - steps: - - checkout - - run: - name: Install check utilities - command: pip install --user --progress-bar=off jinja2 pyyaml - - run: - name: Check CircleCI config consistency - command: python .circleci/regenerate.py && git diff --quiet - - run: - when: on_fail - name: .circleci/config.yml not in sync with config.yml.in! Run '$ python .circleci/regenerate.py' to fix this. - command: exit 1 - - stylecheck: - <<: *binary_common - docker: - - image: "pytorch/manylinux-cuda102" - resource_class: medium - steps: - - checkout - - designate_upload_channel - - run: - name: Setup - command: .circleci/unittest/linux/scripts/setup_env.sh - - run: - name: Run style check - command: .circleci/unittest/linux/scripts/run_style_checks.sh -workflows: - lint: - jobs: - - circleci_consistency diff --git a/.circleci/regenerate.py b/.circleci/regenerate.py deleted file mode 100755 index f3962ee084..0000000000 --- a/.circleci/regenerate.py +++ /dev/null @@ -1,33 +0,0 @@ -#!/usr/bin/env python3 - -""" -This script should use a very simple, functional programming style. -Avoid Jinja macros in favor of native Python functions. - -Don't go overboard on code generation; use Python only to generate -content that can't be easily declared statically using CircleCI's YAML API. - -Data declarations (e.g. the nested loops for defining the configuration matrix) -should be at the top of the file for easy updating. - -See this comment for design rationale: -https://github.com/pytorch/vision/pull/1321#issuecomment-531033978 -""" - -import os.path - -import jinja2 -from jinja2 import select_autoescape - - -if __name__ == "__main__": - d = os.path.dirname(__file__) - env = jinja2.Environment( - loader=jinja2.FileSystemLoader(d), - lstrip_blocks=True, - autoescape=select_autoescape(enabled_extensions=("html", "xml")), - ) - - with open(os.path.join(d, "config.yml"), "w") as f: - f.write(env.get_template("config.yml.in").render()) - f.write("\n") diff --git a/.circleci/smoke_test/docker/Dockerfile b/.circleci/smoke_test/docker/Dockerfile deleted file mode 100644 index ba6f4fb020..0000000000 --- a/.circleci/smoke_test/docker/Dockerfile +++ /dev/null @@ -1,33 +0,0 @@ -# this Dockerfile is for torchtext smoke test, it will be created periodically via CI system -# if you need to do it locally, follow below steps once you have Docker installed -# to test the build use : docker build . -t torchtext/smoketest -# to upload the Dockerfile use build_and_push.sh script - -FROM ubuntu:latest - -RUN apt-get -qq update && apt-get -qq -y install curl bzip2 sox libsox-dev libsox-fmt-all \ - && curl -sSL https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -o /tmp/miniconda.sh \ - && bash /tmp/miniconda.sh -bfp /usr/local \ - && rm -rf /tmp/miniconda.sh \ - && conda install -c conda-forge gcc \ - && conda install -y python=3 \ - && conda update conda \ - && apt-get -qq -y remove curl bzip2 \ - && apt-get -qq -y autoremove \ - && apt-get autoclean \ - && rm -rf /var/lib/apt/lists/* /var/log/dpkg.log \ - && conda clean --all --yes - -ENV PATH /opt/conda/bin:$PATH - - -RUN conda create -y --name python3.8 python=3.8 -RUN conda create -y --name python3.9 python=3.9 -RUN conda create -y --name python3.10 python=3.10 - -SHELL [ "/bin/bash", "-c" ] -RUN echo "source /usr/local/etc/profile.d/conda.sh" >> ~/.bashrc -RUN source /usr/local/etc/profile.d/conda.sh && conda activate python3.8 && conda install -y numpy -RUN source /usr/local/etc/profile.d/conda.sh && conda activate python3.9 && conda install -y numpy -RUN source /usr/local/etc/profile.d/conda.sh && conda activate python3.10 && conda install -y numpy -CMD [ "/bin/bash"] diff --git a/.circleci/smoke_test/docker/build_and_push.sh b/.circleci/smoke_test/docker/build_and_push.sh deleted file mode 100755 index ed67ad3b7a..0000000000 --- a/.circleci/smoke_test/docker/build_and_push.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env bash - -set -euo pipefail - -datestr="$(date "+%Y%m%d")" -image="pytorch/torchtext_smoke_base:smoke_test-${datestr}" -docker build -t "${image}" . -docker push "${image}" diff --git a/.circleci/unittest/linux/scripts/environment.yml b/.circleci/unittest/linux/scripts/environment.yml deleted file mode 100644 index 9400308196..0000000000 --- a/.circleci/unittest/linux/scripts/environment.yml +++ /dev/null @@ -1,19 +0,0 @@ -channels: - - defaults -dependencies: - - codecov - - pip - - pip: - - dataclasses - - nltk - - requests - - revtok - - pytest - - pytest-cov - - pytest-pythonpath - - sacremoses - - spacy - - tqdm - - expecttest - - https://github.com/explosion/spacy-models/releases/download/de_core_news_sm-3.0.0/de_core_news_sm-3.0.0.tar.gz#egg=de_core_news_sm==3.0.0 - - https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-3.0.0/en_core_web_sm-3.0.0.tar.gz#egg=en_core_web_sm==3.0.0 diff --git a/.circleci/unittest/linux/scripts/install.sh b/.circleci/unittest/linux/scripts/install.sh deleted file mode 100755 index b0fed7d8b0..0000000000 --- a/.circleci/unittest/linux/scripts/install.sh +++ /dev/null @@ -1,41 +0,0 @@ -#!/usr/bin/env bash - -unset PYTORCH_VERSION -unset TORCHDATA_VERSION -# For unittest, nightly PyTorch is used as the following section, -# so no need to set PYTORCH_VERSION. -# In fact, keeping PYTORCH_VERSION forces us to hardcode PyTorch version in config. - -set -e - -case "$(uname -s)" in - Darwin*) os=MacOSX;; - *) os=Linux -esac - -eval "$(./conda/bin/conda shell.bash hook)" -conda activate ./env - -printf "* Installing PyTorch\n" -( - if [ "${os}" == MacOSX ] ; then - # TODO: this can be removed as soon as linking issue could be resolved - # see https://github.com/pytorch/pytorch/issues/62424 from details - MKL_CONSTRAINT='mkl==2021.2.0' - else - MKL_CONSTRAINT='' - fi - set -x - conda install -y -c "pytorch-${UPLOAD_CHANNEL}" ${CONDA_CHANNEL_FLAGS} ${MKL_CONSTRAINT} pytorch cpuonly -) - - -printf "Installing torchdata nightly with portalocker\n" -pip install "portalocker>=2.0.0" -pip install --pre torchdata --extra-index-url https://download.pytorch.org/whl/nightly/cpu - -printf "* Installing torchtext\n" -python setup.py develop - -printf "* Installing parameterized\n" -pip install parameterized diff --git a/.circleci/unittest/linux/scripts/post_process.sh b/.circleci/unittest/linux/scripts/post_process.sh deleted file mode 100755 index a84a0dea55..0000000000 --- a/.circleci/unittest/linux/scripts/post_process.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env bash - -set -e - -eval "$(./conda/bin/conda shell.bash hook)" -conda activate ./env - -codecov diff --git a/.circleci/unittest/linux/scripts/run_test.sh b/.circleci/unittest/linux/scripts/run_test.sh deleted file mode 100755 index 3b44c3af62..0000000000 --- a/.circleci/unittest/linux/scripts/run_test.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/env bash - -set -e - -eval "$(./conda/bin/conda shell.bash hook)" -conda activate ./env - -python -m torch.utils.collect_env -cd test -pytest --cov=torchtext --junitxml=test-results/junit.xml -v --durations 20 torchtext_unittest diff --git a/.circleci/unittest/linux/scripts/setup_env.sh b/.circleci/unittest/linux/scripts/setup_env.sh deleted file mode 100755 index ddb920ef8d..0000000000 --- a/.circleci/unittest/linux/scripts/setup_env.sh +++ /dev/null @@ -1,49 +0,0 @@ -#!/usr/bin/env bash - -# This script is for setting up environment in which unit test is ran. -# To speed up the CI time, the resulting environment is cached. -# -# Do not install PyTorch and torchtext here, otherwise they also get cached. - -set -e - -this_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" -root_dir="$(git rev-parse --show-toplevel)" -conda_dir="${root_dir}/conda" -env_dir="${root_dir}/env" - -cd "${root_dir}" - -case "$(uname -s)" in - Darwin*) os=MacOSX;; - *) os=Linux -esac - -# 1. Install conda at ./conda -if [ ! -d "${conda_dir}" ]; then - printf "* Installing conda\n" - curl --silent -L -o miniconda.sh "http://repo.continuum.io/miniconda/Miniconda3-latest-${os}-x86_64.sh" - bash ./miniconda.sh -b -f -p "${conda_dir}" -fi -eval "$(${conda_dir}/bin/conda shell.bash hook)" - -# 2. Create test environment at ./env -if [ ! -d "${env_dir}" ]; then - printf "* Creating a test environment\n" - conda create --prefix "${env_dir}" -y python="$PYTHON_VERSION" -fi -conda activate "${env_dir}" - - -# 3. Install minimal build tools -pip --quiet install cmake>=3.18.0 ninja - -# 4. Install Conda dependencies -printf "* Installing dependencies (except PyTorch)\n" -conda env update --file "${this_dir}/environment.yml" --prune - -# 5. Download -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 diff --git a/.circleci/unittest/windows/scripts/environment.yml b/.circleci/unittest/windows/scripts/environment.yml deleted file mode 100644 index b86ded6ada..0000000000 --- a/.circleci/unittest/windows/scripts/environment.yml +++ /dev/null @@ -1,21 +0,0 @@ -channels: - - defaults -dependencies: - - codecov - - pip - - setuptools == 58.0.4 - - spacy - - pip: - - dataclasses - - nltk - - requests - - revtok - - pytest - - pytest-cov - - pytest-pythonpath - - sacremoses - - tqdm - - certifi - - expecttest - - https://github.com/explosion/spacy-models/releases/download/de_core_news_sm-3.0.0/de_core_news_sm-3.0.0.tar.gz#egg=de_core_news_sm==3.0.0 - - https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-3.0.0/en_core_web_sm-3.0.0.tar.gz#egg=en_core_web_sm==3.0.0 diff --git a/.circleci/unittest/windows/scripts/install.sh b/.circleci/unittest/windows/scripts/install.sh deleted file mode 100644 index 4c8aec444f..0000000000 --- a/.circleci/unittest/windows/scripts/install.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/usr/bin/env bash - -unset PYTORCH_VERSION -unset TORCHDATA_VERSION -# For unittest, nightly PyTorch is used as the following section, -# so no need to set PYTORCH_VERSION. -# In fact, keeping PYTORCH_VERSION forces us to hardcode PyTorch version in config. - -set -e - -this_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" -root_dir="$(git rev-parse --show-toplevel)" - -cd "${root_dir}" - -eval "$(./conda/Scripts/conda.exe 'shell.bash' 'hook')" -conda activate ./env - -printf "* Installing PyTorch\n" -conda install -y -c "pytorch-${UPLOAD_CHANNEL}" ${CONDA_CHANNEL_FLAGS} pytorch cpuonly - -printf "* Installing torchdata nightly with portalocker\n" -pip install "portalocker>=2.0.0" -pip install --pre torchdata --extra-index-url https://download.pytorch.org/whl/nightly/cpu - -printf "* Installing pywin32_postinstall script\n" -curl --output pywin32_postinstall.py https://raw.githubusercontent.com/mhammond/pywin32/main/pywin32_postinstall.py -python pywin32_postinstall.py -install - -printf "* Installing torchtext\n" -"$root_dir/packaging/vc_env_helper.bat" python setup.py develop - -printf "* Installing parameterized\n" -pip install parameterized diff --git a/.circleci/unittest/windows/scripts/install_conda.bat b/.circleci/unittest/windows/scripts/install_conda.bat deleted file mode 100644 index 6052ad08b1..0000000000 --- a/.circleci/unittest/windows/scripts/install_conda.bat +++ /dev/null @@ -1 +0,0 @@ -start /wait "" "%miniconda_exe%" /S /InstallationType=JustMe /RegisterPython=0 /AddToPath=0 /D=%tmp_conda% diff --git a/.circleci/unittest/windows/scripts/post_process.sh b/.circleci/unittest/windows/scripts/post_process.sh deleted file mode 100644 index b132113194..0000000000 --- a/.circleci/unittest/windows/scripts/post_process.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env bash - -set -e - -eval "$(./conda/Scripts/conda.exe 'shell.bash' 'hook')" -conda activate ./env - -codecov diff --git a/.circleci/unittest/windows/scripts/run_test.sh b/.circleci/unittest/windows/scripts/run_test.sh deleted file mode 100644 index b8a62f2c56..0000000000 --- a/.circleci/unittest/windows/scripts/run_test.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/env bash - -set -e - -eval "$(./conda/Scripts/conda.exe 'shell.bash' 'hook')" -conda activate ./env - -python -m torch.utils.collect_env -cd test -pytest --cov=torchtext --junitxml=test-results/junit.xml -v --durations 20 torchtext_unittest diff --git a/.circleci/unittest/windows/scripts/setup_env.sh b/.circleci/unittest/windows/scripts/setup_env.sh deleted file mode 100644 index 130f14a094..0000000000 --- a/.circleci/unittest/windows/scripts/setup_env.sh +++ /dev/null @@ -1,47 +0,0 @@ -#!/usr/bin/env bash - -# This script is for setting up environment in which unit test is ran. -# To speed up the CI time, the resulting environment is cached. -# -# Do not install PyTorch and torchtext here, otherwise they also get cached. - -set -e - -this_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" -root_dir="$(git rev-parse --show-toplevel)" -conda_dir="${root_dir}/conda" -env_dir="${root_dir}/env" - -cd "${root_dir}" - -# 1. Install conda at ./conda -if [ ! -d "${conda_dir}" ]; then - printf "* Installing conda\n" - export tmp_conda="$(echo $conda_dir | tr '/' '\\')" - export miniconda_exe="$(echo $root_dir | tr '/' '\\')\\miniconda.exe" - curl --output miniconda.exe https://repo.anaconda.com/miniconda/Miniconda3-latest-Windows-x86_64.exe -O - "$this_dir/install_conda.bat" - unset tmp_conda - unset miniconda_exe -fi -eval "$(${conda_dir}/Scripts/conda.exe 'shell.bash' 'hook')" - -# 2. Create test environment at ./env -if [ ! -d "${env_dir}" ]; then - printf "* Creating a test environment\n" - conda create --prefix "${env_dir}" -y python="$PYTHON_VERSION" -fi -conda activate "${env_dir}" - -# 3. Install minimal build tools -pip --quiet install cmake>=3.18.0 ninja - -# 4. Install Conda dependencies -printf "* Installing dependencies (except PyTorch)\n" -conda env update --file "${this_dir}/environment.yml" --prune - -# 5. Download -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 diff --git a/.circleci/utils/test_sort_yaml.py b/.circleci/utils/test_sort_yaml.py deleted file mode 100755 index 14a51ec974..0000000000 --- a/.circleci/utils/test_sort_yaml.py +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env python3 - -""" -To compare new version with previous: - - ./regenerate.sh - meld <(git show HEAD:./config.yml | ./sort-yaml.py) <(cat config.yml | ./sort-yaml.py) -""" - - -import sys - -import yaml - -sys.stdout.write(yaml.dump(yaml.safe_load(sys.stdin, Loader=yaml.FullLoader), sort_keys=True)) From a224d53fcaf20bc3763f32ca9c0c985beeb13671 Mon Sep 17 00:00:00 2001 From: Omkar Salpekar Date: Tue, 30 May 2023 11:12:25 -0700 Subject: [PATCH 3/5] Revert "Deleting CircleCI directory entirely" This reverts commit f47af2fde1c3fb8dcfd2cc1864c640aa0754f52c. --- .circleci/build_docs/commit_docs.sh | 35 ++++++ .circleci/config.yml | 101 ++++++++++++++++++ .circleci/config.yml.in | 101 ++++++++++++++++++ .circleci/regenerate.py | 33 ++++++ .circleci/smoke_test/docker/Dockerfile | 33 ++++++ .circleci/smoke_test/docker/build_and_push.sh | 8 ++ .../unittest/linux/scripts/environment.yml | 19 ++++ .circleci/unittest/linux/scripts/install.sh | 41 +++++++ .../unittest/linux/scripts/post_process.sh | 8 ++ .circleci/unittest/linux/scripts/run_test.sh | 10 ++ .circleci/unittest/linux/scripts/setup_env.sh | 49 +++++++++ .../unittest/windows/scripts/environment.yml | 21 ++++ .circleci/unittest/windows/scripts/install.sh | 34 ++++++ .../windows/scripts/install_conda.bat | 1 + .../unittest/windows/scripts/post_process.sh | 8 ++ .../unittest/windows/scripts/run_test.sh | 10 ++ .../unittest/windows/scripts/setup_env.sh | 47 ++++++++ .circleci/utils/test_sort_yaml.py | 15 +++ 18 files changed, 574 insertions(+) create mode 100755 .circleci/build_docs/commit_docs.sh create mode 100644 .circleci/config.yml create mode 100644 .circleci/config.yml.in create mode 100755 .circleci/regenerate.py create mode 100644 .circleci/smoke_test/docker/Dockerfile create mode 100755 .circleci/smoke_test/docker/build_and_push.sh create mode 100644 .circleci/unittest/linux/scripts/environment.yml create mode 100755 .circleci/unittest/linux/scripts/install.sh create mode 100755 .circleci/unittest/linux/scripts/post_process.sh create mode 100755 .circleci/unittest/linux/scripts/run_test.sh create mode 100755 .circleci/unittest/linux/scripts/setup_env.sh create mode 100644 .circleci/unittest/windows/scripts/environment.yml create mode 100644 .circleci/unittest/windows/scripts/install.sh create mode 100644 .circleci/unittest/windows/scripts/install_conda.bat create mode 100644 .circleci/unittest/windows/scripts/post_process.sh create mode 100644 .circleci/unittest/windows/scripts/run_test.sh create mode 100644 .circleci/unittest/windows/scripts/setup_env.sh create mode 100755 .circleci/utils/test_sort_yaml.py diff --git a/.circleci/build_docs/commit_docs.sh b/.circleci/build_docs/commit_docs.sh new file mode 100755 index 0000000000..11297f9521 --- /dev/null +++ b/.circleci/build_docs/commit_docs.sh @@ -0,0 +1,35 @@ +#!/usr/bin/env bash + +set -ex + + +if [ "$2" == "" ]; then + echo call as "$0" "" "" + echo where src is the root of the built documentation git checkout and + echo branch should be "main" or "1.7" or so + exit 1 +fi + +src=$1 +target=$2 + +echo "committing docs from ${src} to ${target}" + +pushd $src +git checkout gh-pages +mkdir -p ./"${target}" +rm -rf ./"${target}"/* +cp -r "${src}/docs/build/html/"* ./"$target" +if [ "${target}" == "main" ]; then + mkdir -p ./_static + rm -rf ./_static/* + cp -r "${src}/docs/build/html/_static/"* ./_static + git add --all ./_static || true +fi +git add --all ./"${target}" || true +git config user.email "soumith+bot@pytorch.org" +git config user.name "pytorchbot" +# If there aren't changes, don't make a commit; push is no-op +git commit -m "auto-generating sphinx docs" || true +git remote add https https://github.com/pytorch/text.git +git push -u https gh-pages diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 0000000000..791c80eabc --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,101 @@ +version: 2.1 + +# How to test the Linux jobs: +# - Install CircleCI local CLI: https://circleci.com/docs/2.0/local-cli/ +# - circleci config process .circleci/config.yml > gen.yml && circleci local execute -c gen.yml --job binary_linux_wheel_py3.8 +# - Replace binary_linux_wheel_py3.8 with the name of the job you want to test. +# Job names are 'name:' key. + +orbs: + win: circleci/windows@2.0.0 + +executors: + windows-cpu: + machine: + resource_class: windows.xlarge + image: windows-server-2019-vs2019:stable + shell: bash.exe + +commands: + designate_upload_channel: + description: "inserts the correct upload channel into ${BASH_ENV}" + steps: + - run: + name: adding UPLOAD_CHANNEL to BASH_ENV + command: | + our_upload_channel=nightly + # On tags upload to test instead + if [[ -n "${CIRCLE_TAG}" ]] || [[ ${CIRCLE_BRANCH} =~ release/* ]]; then + our_upload_channel=test + fi + echo "export UPLOAD_CHANNEL=${our_upload_channel}" >> ${BASH_ENV} + load_conda_channel_flags: + description: "Determines whether we need extra conda channels" + steps: + - run: + name: Adding CONDA_CHANNEL_FLAGS to BASH_ENV + command: | + CONDA_CHANNEL_FLAGS="" + +binary_common: &binary_common + parameters: + # Edit these defaults to do a release + build_version: + description: "version number of release binary; by default, build a nightly" + type: string + default: "" + pytorch_version: + description: "PyTorch version to build against; by default, use a nightly" + type: string + default: "" + torchdata_version: + description: "TorchData version to build against; by default, use a nightly" + type: string + default: "" + # Don't edit these + python_version: + description: "Python version to build against (e.g., 3.8)" + type: string + environment: + PYTHON_VERSION: << parameters.python_version >> + BUILD_VERSION: << parameters.build_version >> + PYTORCH_VERSION: << parameters.pytorch_version >> + TORCHDATA_VERSION: << parameters.torchdata_version >> + CU_VERSION: cpu + MACOSX_DEPLOYMENT_TARGET: 10.9 + +jobs: + circleci_consistency: + docker: + - image: cimg/python:3.8 + steps: + - checkout + - run: + name: Install check utilities + command: pip install --user --progress-bar=off jinja2 pyyaml + - run: + name: Check CircleCI config consistency + command: python .circleci/regenerate.py && git diff --quiet + - run: + when: on_fail + name: .circleci/config.yml not in sync with config.yml.in! Run '$ python .circleci/regenerate.py' to fix this. + command: exit 1 + + stylecheck: + <<: *binary_common + docker: + - image: "pytorch/manylinux-cuda102" + resource_class: medium + steps: + - checkout + - designate_upload_channel + - run: + name: Setup + command: .circleci/unittest/linux/scripts/setup_env.sh + - run: + name: Run style check + command: .circleci/unittest/linux/scripts/run_style_checks.sh +workflows: + lint: + jobs: + - circleci_consistency diff --git a/.circleci/config.yml.in b/.circleci/config.yml.in new file mode 100644 index 0000000000..791c80eabc --- /dev/null +++ b/.circleci/config.yml.in @@ -0,0 +1,101 @@ +version: 2.1 + +# How to test the Linux jobs: +# - Install CircleCI local CLI: https://circleci.com/docs/2.0/local-cli/ +# - circleci config process .circleci/config.yml > gen.yml && circleci local execute -c gen.yml --job binary_linux_wheel_py3.8 +# - Replace binary_linux_wheel_py3.8 with the name of the job you want to test. +# Job names are 'name:' key. + +orbs: + win: circleci/windows@2.0.0 + +executors: + windows-cpu: + machine: + resource_class: windows.xlarge + image: windows-server-2019-vs2019:stable + shell: bash.exe + +commands: + designate_upload_channel: + description: "inserts the correct upload channel into ${BASH_ENV}" + steps: + - run: + name: adding UPLOAD_CHANNEL to BASH_ENV + command: | + our_upload_channel=nightly + # On tags upload to test instead + if [[ -n "${CIRCLE_TAG}" ]] || [[ ${CIRCLE_BRANCH} =~ release/* ]]; then + our_upload_channel=test + fi + echo "export UPLOAD_CHANNEL=${our_upload_channel}" >> ${BASH_ENV} + load_conda_channel_flags: + description: "Determines whether we need extra conda channels" + steps: + - run: + name: Adding CONDA_CHANNEL_FLAGS to BASH_ENV + command: | + CONDA_CHANNEL_FLAGS="" + +binary_common: &binary_common + parameters: + # Edit these defaults to do a release + build_version: + description: "version number of release binary; by default, build a nightly" + type: string + default: "" + pytorch_version: + description: "PyTorch version to build against; by default, use a nightly" + type: string + default: "" + torchdata_version: + description: "TorchData version to build against; by default, use a nightly" + type: string + default: "" + # Don't edit these + python_version: + description: "Python version to build against (e.g., 3.8)" + type: string + environment: + PYTHON_VERSION: << parameters.python_version >> + BUILD_VERSION: << parameters.build_version >> + PYTORCH_VERSION: << parameters.pytorch_version >> + TORCHDATA_VERSION: << parameters.torchdata_version >> + CU_VERSION: cpu + MACOSX_DEPLOYMENT_TARGET: 10.9 + +jobs: + circleci_consistency: + docker: + - image: cimg/python:3.8 + steps: + - checkout + - run: + name: Install check utilities + command: pip install --user --progress-bar=off jinja2 pyyaml + - run: + name: Check CircleCI config consistency + command: python .circleci/regenerate.py && git diff --quiet + - run: + when: on_fail + name: .circleci/config.yml not in sync with config.yml.in! Run '$ python .circleci/regenerate.py' to fix this. + command: exit 1 + + stylecheck: + <<: *binary_common + docker: + - image: "pytorch/manylinux-cuda102" + resource_class: medium + steps: + - checkout + - designate_upload_channel + - run: + name: Setup + command: .circleci/unittest/linux/scripts/setup_env.sh + - run: + name: Run style check + command: .circleci/unittest/linux/scripts/run_style_checks.sh +workflows: + lint: + jobs: + - circleci_consistency diff --git a/.circleci/regenerate.py b/.circleci/regenerate.py new file mode 100755 index 0000000000..f3962ee084 --- /dev/null +++ b/.circleci/regenerate.py @@ -0,0 +1,33 @@ +#!/usr/bin/env python3 + +""" +This script should use a very simple, functional programming style. +Avoid Jinja macros in favor of native Python functions. + +Don't go overboard on code generation; use Python only to generate +content that can't be easily declared statically using CircleCI's YAML API. + +Data declarations (e.g. the nested loops for defining the configuration matrix) +should be at the top of the file for easy updating. + +See this comment for design rationale: +https://github.com/pytorch/vision/pull/1321#issuecomment-531033978 +""" + +import os.path + +import jinja2 +from jinja2 import select_autoescape + + +if __name__ == "__main__": + d = os.path.dirname(__file__) + env = jinja2.Environment( + loader=jinja2.FileSystemLoader(d), + lstrip_blocks=True, + autoescape=select_autoescape(enabled_extensions=("html", "xml")), + ) + + with open(os.path.join(d, "config.yml"), "w") as f: + f.write(env.get_template("config.yml.in").render()) + f.write("\n") diff --git a/.circleci/smoke_test/docker/Dockerfile b/.circleci/smoke_test/docker/Dockerfile new file mode 100644 index 0000000000..ba6f4fb020 --- /dev/null +++ b/.circleci/smoke_test/docker/Dockerfile @@ -0,0 +1,33 @@ +# this Dockerfile is for torchtext smoke test, it will be created periodically via CI system +# if you need to do it locally, follow below steps once you have Docker installed +# to test the build use : docker build . -t torchtext/smoketest +# to upload the Dockerfile use build_and_push.sh script + +FROM ubuntu:latest + +RUN apt-get -qq update && apt-get -qq -y install curl bzip2 sox libsox-dev libsox-fmt-all \ + && curl -sSL https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -o /tmp/miniconda.sh \ + && bash /tmp/miniconda.sh -bfp /usr/local \ + && rm -rf /tmp/miniconda.sh \ + && conda install -c conda-forge gcc \ + && conda install -y python=3 \ + && conda update conda \ + && apt-get -qq -y remove curl bzip2 \ + && apt-get -qq -y autoremove \ + && apt-get autoclean \ + && rm -rf /var/lib/apt/lists/* /var/log/dpkg.log \ + && conda clean --all --yes + +ENV PATH /opt/conda/bin:$PATH + + +RUN conda create -y --name python3.8 python=3.8 +RUN conda create -y --name python3.9 python=3.9 +RUN conda create -y --name python3.10 python=3.10 + +SHELL [ "/bin/bash", "-c" ] +RUN echo "source /usr/local/etc/profile.d/conda.sh" >> ~/.bashrc +RUN source /usr/local/etc/profile.d/conda.sh && conda activate python3.8 && conda install -y numpy +RUN source /usr/local/etc/profile.d/conda.sh && conda activate python3.9 && conda install -y numpy +RUN source /usr/local/etc/profile.d/conda.sh && conda activate python3.10 && conda install -y numpy +CMD [ "/bin/bash"] diff --git a/.circleci/smoke_test/docker/build_and_push.sh b/.circleci/smoke_test/docker/build_and_push.sh new file mode 100755 index 0000000000..ed67ad3b7a --- /dev/null +++ b/.circleci/smoke_test/docker/build_and_push.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash + +set -euo pipefail + +datestr="$(date "+%Y%m%d")" +image="pytorch/torchtext_smoke_base:smoke_test-${datestr}" +docker build -t "${image}" . +docker push "${image}" diff --git a/.circleci/unittest/linux/scripts/environment.yml b/.circleci/unittest/linux/scripts/environment.yml new file mode 100644 index 0000000000..9400308196 --- /dev/null +++ b/.circleci/unittest/linux/scripts/environment.yml @@ -0,0 +1,19 @@ +channels: + - defaults +dependencies: + - codecov + - pip + - pip: + - dataclasses + - nltk + - requests + - revtok + - pytest + - pytest-cov + - pytest-pythonpath + - sacremoses + - spacy + - tqdm + - expecttest + - https://github.com/explosion/spacy-models/releases/download/de_core_news_sm-3.0.0/de_core_news_sm-3.0.0.tar.gz#egg=de_core_news_sm==3.0.0 + - https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-3.0.0/en_core_web_sm-3.0.0.tar.gz#egg=en_core_web_sm==3.0.0 diff --git a/.circleci/unittest/linux/scripts/install.sh b/.circleci/unittest/linux/scripts/install.sh new file mode 100755 index 0000000000..b0fed7d8b0 --- /dev/null +++ b/.circleci/unittest/linux/scripts/install.sh @@ -0,0 +1,41 @@ +#!/usr/bin/env bash + +unset PYTORCH_VERSION +unset TORCHDATA_VERSION +# For unittest, nightly PyTorch is used as the following section, +# so no need to set PYTORCH_VERSION. +# In fact, keeping PYTORCH_VERSION forces us to hardcode PyTorch version in config. + +set -e + +case "$(uname -s)" in + Darwin*) os=MacOSX;; + *) os=Linux +esac + +eval "$(./conda/bin/conda shell.bash hook)" +conda activate ./env + +printf "* Installing PyTorch\n" +( + if [ "${os}" == MacOSX ] ; then + # TODO: this can be removed as soon as linking issue could be resolved + # see https://github.com/pytorch/pytorch/issues/62424 from details + MKL_CONSTRAINT='mkl==2021.2.0' + else + MKL_CONSTRAINT='' + fi + set -x + conda install -y -c "pytorch-${UPLOAD_CHANNEL}" ${CONDA_CHANNEL_FLAGS} ${MKL_CONSTRAINT} pytorch cpuonly +) + + +printf "Installing torchdata nightly with portalocker\n" +pip install "portalocker>=2.0.0" +pip install --pre torchdata --extra-index-url https://download.pytorch.org/whl/nightly/cpu + +printf "* Installing torchtext\n" +python setup.py develop + +printf "* Installing parameterized\n" +pip install parameterized diff --git a/.circleci/unittest/linux/scripts/post_process.sh b/.circleci/unittest/linux/scripts/post_process.sh new file mode 100755 index 0000000000..a84a0dea55 --- /dev/null +++ b/.circleci/unittest/linux/scripts/post_process.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash + +set -e + +eval "$(./conda/bin/conda shell.bash hook)" +conda activate ./env + +codecov diff --git a/.circleci/unittest/linux/scripts/run_test.sh b/.circleci/unittest/linux/scripts/run_test.sh new file mode 100755 index 0000000000..3b44c3af62 --- /dev/null +++ b/.circleci/unittest/linux/scripts/run_test.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env bash + +set -e + +eval "$(./conda/bin/conda shell.bash hook)" +conda activate ./env + +python -m torch.utils.collect_env +cd test +pytest --cov=torchtext --junitxml=test-results/junit.xml -v --durations 20 torchtext_unittest diff --git a/.circleci/unittest/linux/scripts/setup_env.sh b/.circleci/unittest/linux/scripts/setup_env.sh new file mode 100755 index 0000000000..ddb920ef8d --- /dev/null +++ b/.circleci/unittest/linux/scripts/setup_env.sh @@ -0,0 +1,49 @@ +#!/usr/bin/env bash + +# This script is for setting up environment in which unit test is ran. +# To speed up the CI time, the resulting environment is cached. +# +# Do not install PyTorch and torchtext here, otherwise they also get cached. + +set -e + +this_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" +root_dir="$(git rev-parse --show-toplevel)" +conda_dir="${root_dir}/conda" +env_dir="${root_dir}/env" + +cd "${root_dir}" + +case "$(uname -s)" in + Darwin*) os=MacOSX;; + *) os=Linux +esac + +# 1. Install conda at ./conda +if [ ! -d "${conda_dir}" ]; then + printf "* Installing conda\n" + curl --silent -L -o miniconda.sh "http://repo.continuum.io/miniconda/Miniconda3-latest-${os}-x86_64.sh" + bash ./miniconda.sh -b -f -p "${conda_dir}" +fi +eval "$(${conda_dir}/bin/conda shell.bash hook)" + +# 2. Create test environment at ./env +if [ ! -d "${env_dir}" ]; then + printf "* Creating a test environment\n" + conda create --prefix "${env_dir}" -y python="$PYTHON_VERSION" +fi +conda activate "${env_dir}" + + +# 3. Install minimal build tools +pip --quiet install cmake>=3.18.0 ninja + +# 4. Install Conda dependencies +printf "* Installing dependencies (except PyTorch)\n" +conda env update --file "${this_dir}/environment.yml" --prune + +# 5. Download +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 diff --git a/.circleci/unittest/windows/scripts/environment.yml b/.circleci/unittest/windows/scripts/environment.yml new file mode 100644 index 0000000000..b86ded6ada --- /dev/null +++ b/.circleci/unittest/windows/scripts/environment.yml @@ -0,0 +1,21 @@ +channels: + - defaults +dependencies: + - codecov + - pip + - setuptools == 58.0.4 + - spacy + - pip: + - dataclasses + - nltk + - requests + - revtok + - pytest + - pytest-cov + - pytest-pythonpath + - sacremoses + - tqdm + - certifi + - expecttest + - https://github.com/explosion/spacy-models/releases/download/de_core_news_sm-3.0.0/de_core_news_sm-3.0.0.tar.gz#egg=de_core_news_sm==3.0.0 + - https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-3.0.0/en_core_web_sm-3.0.0.tar.gz#egg=en_core_web_sm==3.0.0 diff --git a/.circleci/unittest/windows/scripts/install.sh b/.circleci/unittest/windows/scripts/install.sh new file mode 100644 index 0000000000..4c8aec444f --- /dev/null +++ b/.circleci/unittest/windows/scripts/install.sh @@ -0,0 +1,34 @@ +#!/usr/bin/env bash + +unset PYTORCH_VERSION +unset TORCHDATA_VERSION +# For unittest, nightly PyTorch is used as the following section, +# so no need to set PYTORCH_VERSION. +# In fact, keeping PYTORCH_VERSION forces us to hardcode PyTorch version in config. + +set -e + +this_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" +root_dir="$(git rev-parse --show-toplevel)" + +cd "${root_dir}" + +eval "$(./conda/Scripts/conda.exe 'shell.bash' 'hook')" +conda activate ./env + +printf "* Installing PyTorch\n" +conda install -y -c "pytorch-${UPLOAD_CHANNEL}" ${CONDA_CHANNEL_FLAGS} pytorch cpuonly + +printf "* Installing torchdata nightly with portalocker\n" +pip install "portalocker>=2.0.0" +pip install --pre torchdata --extra-index-url https://download.pytorch.org/whl/nightly/cpu + +printf "* Installing pywin32_postinstall script\n" +curl --output pywin32_postinstall.py https://raw.githubusercontent.com/mhammond/pywin32/main/pywin32_postinstall.py +python pywin32_postinstall.py -install + +printf "* Installing torchtext\n" +"$root_dir/packaging/vc_env_helper.bat" python setup.py develop + +printf "* Installing parameterized\n" +pip install parameterized diff --git a/.circleci/unittest/windows/scripts/install_conda.bat b/.circleci/unittest/windows/scripts/install_conda.bat new file mode 100644 index 0000000000..6052ad08b1 --- /dev/null +++ b/.circleci/unittest/windows/scripts/install_conda.bat @@ -0,0 +1 @@ +start /wait "" "%miniconda_exe%" /S /InstallationType=JustMe /RegisterPython=0 /AddToPath=0 /D=%tmp_conda% diff --git a/.circleci/unittest/windows/scripts/post_process.sh b/.circleci/unittest/windows/scripts/post_process.sh new file mode 100644 index 0000000000..b132113194 --- /dev/null +++ b/.circleci/unittest/windows/scripts/post_process.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash + +set -e + +eval "$(./conda/Scripts/conda.exe 'shell.bash' 'hook')" +conda activate ./env + +codecov diff --git a/.circleci/unittest/windows/scripts/run_test.sh b/.circleci/unittest/windows/scripts/run_test.sh new file mode 100644 index 0000000000..b8a62f2c56 --- /dev/null +++ b/.circleci/unittest/windows/scripts/run_test.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env bash + +set -e + +eval "$(./conda/Scripts/conda.exe 'shell.bash' 'hook')" +conda activate ./env + +python -m torch.utils.collect_env +cd test +pytest --cov=torchtext --junitxml=test-results/junit.xml -v --durations 20 torchtext_unittest diff --git a/.circleci/unittest/windows/scripts/setup_env.sh b/.circleci/unittest/windows/scripts/setup_env.sh new file mode 100644 index 0000000000..130f14a094 --- /dev/null +++ b/.circleci/unittest/windows/scripts/setup_env.sh @@ -0,0 +1,47 @@ +#!/usr/bin/env bash + +# This script is for setting up environment in which unit test is ran. +# To speed up the CI time, the resulting environment is cached. +# +# Do not install PyTorch and torchtext here, otherwise they also get cached. + +set -e + +this_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" +root_dir="$(git rev-parse --show-toplevel)" +conda_dir="${root_dir}/conda" +env_dir="${root_dir}/env" + +cd "${root_dir}" + +# 1. Install conda at ./conda +if [ ! -d "${conda_dir}" ]; then + printf "* Installing conda\n" + export tmp_conda="$(echo $conda_dir | tr '/' '\\')" + export miniconda_exe="$(echo $root_dir | tr '/' '\\')\\miniconda.exe" + curl --output miniconda.exe https://repo.anaconda.com/miniconda/Miniconda3-latest-Windows-x86_64.exe -O + "$this_dir/install_conda.bat" + unset tmp_conda + unset miniconda_exe +fi +eval "$(${conda_dir}/Scripts/conda.exe 'shell.bash' 'hook')" + +# 2. Create test environment at ./env +if [ ! -d "${env_dir}" ]; then + printf "* Creating a test environment\n" + conda create --prefix "${env_dir}" -y python="$PYTHON_VERSION" +fi +conda activate "${env_dir}" + +# 3. Install minimal build tools +pip --quiet install cmake>=3.18.0 ninja + +# 4. Install Conda dependencies +printf "* Installing dependencies (except PyTorch)\n" +conda env update --file "${this_dir}/environment.yml" --prune + +# 5. Download +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 diff --git a/.circleci/utils/test_sort_yaml.py b/.circleci/utils/test_sort_yaml.py new file mode 100755 index 0000000000..14a51ec974 --- /dev/null +++ b/.circleci/utils/test_sort_yaml.py @@ -0,0 +1,15 @@ +#!/usr/bin/env python3 + +""" +To compare new version with previous: + + ./regenerate.sh + meld <(git show HEAD:./config.yml | ./sort-yaml.py) <(cat config.yml | ./sort-yaml.py) +""" + + +import sys + +import yaml + +sys.stdout.write(yaml.dump(yaml.safe_load(sys.stdin, Loader=yaml.FullLoader), sort_keys=True)) From 394cda390beaec50f4b258e95461e0811042809e Mon Sep 17 00:00:00 2001 From: Omkar Salpekar Date: Tue, 30 May 2023 11:14:48 -0700 Subject: [PATCH 4/5] Remove CCI configs --- .circleci/config.yml | 101 ---------------------------------------- .circleci/config.yml.in | 101 ---------------------------------------- .circleci/regenerate.py | 33 ------------- 3 files changed, 235 deletions(-) delete mode 100644 .circleci/config.yml delete mode 100644 .circleci/config.yml.in delete mode 100755 .circleci/regenerate.py diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index 791c80eabc..0000000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,101 +0,0 @@ -version: 2.1 - -# How to test the Linux jobs: -# - Install CircleCI local CLI: https://circleci.com/docs/2.0/local-cli/ -# - circleci config process .circleci/config.yml > gen.yml && circleci local execute -c gen.yml --job binary_linux_wheel_py3.8 -# - Replace binary_linux_wheel_py3.8 with the name of the job you want to test. -# Job names are 'name:' key. - -orbs: - win: circleci/windows@2.0.0 - -executors: - windows-cpu: - machine: - resource_class: windows.xlarge - image: windows-server-2019-vs2019:stable - shell: bash.exe - -commands: - designate_upload_channel: - description: "inserts the correct upload channel into ${BASH_ENV}" - steps: - - run: - name: adding UPLOAD_CHANNEL to BASH_ENV - command: | - our_upload_channel=nightly - # On tags upload to test instead - if [[ -n "${CIRCLE_TAG}" ]] || [[ ${CIRCLE_BRANCH} =~ release/* ]]; then - our_upload_channel=test - fi - echo "export UPLOAD_CHANNEL=${our_upload_channel}" >> ${BASH_ENV} - load_conda_channel_flags: - description: "Determines whether we need extra conda channels" - steps: - - run: - name: Adding CONDA_CHANNEL_FLAGS to BASH_ENV - command: | - CONDA_CHANNEL_FLAGS="" - -binary_common: &binary_common - parameters: - # Edit these defaults to do a release - build_version: - description: "version number of release binary; by default, build a nightly" - type: string - default: "" - pytorch_version: - description: "PyTorch version to build against; by default, use a nightly" - type: string - default: "" - torchdata_version: - description: "TorchData version to build against; by default, use a nightly" - type: string - default: "" - # Don't edit these - python_version: - description: "Python version to build against (e.g., 3.8)" - type: string - environment: - PYTHON_VERSION: << parameters.python_version >> - BUILD_VERSION: << parameters.build_version >> - PYTORCH_VERSION: << parameters.pytorch_version >> - TORCHDATA_VERSION: << parameters.torchdata_version >> - CU_VERSION: cpu - MACOSX_DEPLOYMENT_TARGET: 10.9 - -jobs: - circleci_consistency: - docker: - - image: cimg/python:3.8 - steps: - - checkout - - run: - name: Install check utilities - command: pip install --user --progress-bar=off jinja2 pyyaml - - run: - name: Check CircleCI config consistency - command: python .circleci/regenerate.py && git diff --quiet - - run: - when: on_fail - name: .circleci/config.yml not in sync with config.yml.in! Run '$ python .circleci/regenerate.py' to fix this. - command: exit 1 - - stylecheck: - <<: *binary_common - docker: - - image: "pytorch/manylinux-cuda102" - resource_class: medium - steps: - - checkout - - designate_upload_channel - - run: - name: Setup - command: .circleci/unittest/linux/scripts/setup_env.sh - - run: - name: Run style check - command: .circleci/unittest/linux/scripts/run_style_checks.sh -workflows: - lint: - jobs: - - circleci_consistency diff --git a/.circleci/config.yml.in b/.circleci/config.yml.in deleted file mode 100644 index 791c80eabc..0000000000 --- a/.circleci/config.yml.in +++ /dev/null @@ -1,101 +0,0 @@ -version: 2.1 - -# How to test the Linux jobs: -# - Install CircleCI local CLI: https://circleci.com/docs/2.0/local-cli/ -# - circleci config process .circleci/config.yml > gen.yml && circleci local execute -c gen.yml --job binary_linux_wheel_py3.8 -# - Replace binary_linux_wheel_py3.8 with the name of the job you want to test. -# Job names are 'name:' key. - -orbs: - win: circleci/windows@2.0.0 - -executors: - windows-cpu: - machine: - resource_class: windows.xlarge - image: windows-server-2019-vs2019:stable - shell: bash.exe - -commands: - designate_upload_channel: - description: "inserts the correct upload channel into ${BASH_ENV}" - steps: - - run: - name: adding UPLOAD_CHANNEL to BASH_ENV - command: | - our_upload_channel=nightly - # On tags upload to test instead - if [[ -n "${CIRCLE_TAG}" ]] || [[ ${CIRCLE_BRANCH} =~ release/* ]]; then - our_upload_channel=test - fi - echo "export UPLOAD_CHANNEL=${our_upload_channel}" >> ${BASH_ENV} - load_conda_channel_flags: - description: "Determines whether we need extra conda channels" - steps: - - run: - name: Adding CONDA_CHANNEL_FLAGS to BASH_ENV - command: | - CONDA_CHANNEL_FLAGS="" - -binary_common: &binary_common - parameters: - # Edit these defaults to do a release - build_version: - description: "version number of release binary; by default, build a nightly" - type: string - default: "" - pytorch_version: - description: "PyTorch version to build against; by default, use a nightly" - type: string - default: "" - torchdata_version: - description: "TorchData version to build against; by default, use a nightly" - type: string - default: "" - # Don't edit these - python_version: - description: "Python version to build against (e.g., 3.8)" - type: string - environment: - PYTHON_VERSION: << parameters.python_version >> - BUILD_VERSION: << parameters.build_version >> - PYTORCH_VERSION: << parameters.pytorch_version >> - TORCHDATA_VERSION: << parameters.torchdata_version >> - CU_VERSION: cpu - MACOSX_DEPLOYMENT_TARGET: 10.9 - -jobs: - circleci_consistency: - docker: - - image: cimg/python:3.8 - steps: - - checkout - - run: - name: Install check utilities - command: pip install --user --progress-bar=off jinja2 pyyaml - - run: - name: Check CircleCI config consistency - command: python .circleci/regenerate.py && git diff --quiet - - run: - when: on_fail - name: .circleci/config.yml not in sync with config.yml.in! Run '$ python .circleci/regenerate.py' to fix this. - command: exit 1 - - stylecheck: - <<: *binary_common - docker: - - image: "pytorch/manylinux-cuda102" - resource_class: medium - steps: - - checkout - - designate_upload_channel - - run: - name: Setup - command: .circleci/unittest/linux/scripts/setup_env.sh - - run: - name: Run style check - command: .circleci/unittest/linux/scripts/run_style_checks.sh -workflows: - lint: - jobs: - - circleci_consistency diff --git a/.circleci/regenerate.py b/.circleci/regenerate.py deleted file mode 100755 index f3962ee084..0000000000 --- a/.circleci/regenerate.py +++ /dev/null @@ -1,33 +0,0 @@ -#!/usr/bin/env python3 - -""" -This script should use a very simple, functional programming style. -Avoid Jinja macros in favor of native Python functions. - -Don't go overboard on code generation; use Python only to generate -content that can't be easily declared statically using CircleCI's YAML API. - -Data declarations (e.g. the nested loops for defining the configuration matrix) -should be at the top of the file for easy updating. - -See this comment for design rationale: -https://github.com/pytorch/vision/pull/1321#issuecomment-531033978 -""" - -import os.path - -import jinja2 -from jinja2 import select_autoescape - - -if __name__ == "__main__": - d = os.path.dirname(__file__) - env = jinja2.Environment( - loader=jinja2.FileSystemLoader(d), - lstrip_blocks=True, - autoescape=select_autoescape(enabled_extensions=("html", "xml")), - ) - - with open(os.path.join(d, "config.yml"), "w") as f: - f.write(env.get_template("config.yml.in").render()) - f.write("\n") From fb89a4ea946dbef0ccc3a8361ee1390ad3c2df58 Mon Sep 17 00:00:00 2001 From: Omkar Salpekar Date: Tue, 30 May 2023 11:15:26 -0700 Subject: [PATCH 5/5] Remove unused scripts --- .circleci/build_docs/commit_docs.sh | 35 ------------------- .circleci/smoke_test/docker/Dockerfile | 33 ----------------- .circleci/smoke_test/docker/build_and_push.sh | 8 ----- .circleci/utils/test_sort_yaml.py | 15 -------- 4 files changed, 91 deletions(-) delete mode 100755 .circleci/build_docs/commit_docs.sh delete mode 100644 .circleci/smoke_test/docker/Dockerfile delete mode 100755 .circleci/smoke_test/docker/build_and_push.sh delete mode 100755 .circleci/utils/test_sort_yaml.py diff --git a/.circleci/build_docs/commit_docs.sh b/.circleci/build_docs/commit_docs.sh deleted file mode 100755 index 11297f9521..0000000000 --- a/.circleci/build_docs/commit_docs.sh +++ /dev/null @@ -1,35 +0,0 @@ -#!/usr/bin/env bash - -set -ex - - -if [ "$2" == "" ]; then - echo call as "$0" "" "" - echo where src is the root of the built documentation git checkout and - echo branch should be "main" or "1.7" or so - exit 1 -fi - -src=$1 -target=$2 - -echo "committing docs from ${src} to ${target}" - -pushd $src -git checkout gh-pages -mkdir -p ./"${target}" -rm -rf ./"${target}"/* -cp -r "${src}/docs/build/html/"* ./"$target" -if [ "${target}" == "main" ]; then - mkdir -p ./_static - rm -rf ./_static/* - cp -r "${src}/docs/build/html/_static/"* ./_static - git add --all ./_static || true -fi -git add --all ./"${target}" || true -git config user.email "soumith+bot@pytorch.org" -git config user.name "pytorchbot" -# If there aren't changes, don't make a commit; push is no-op -git commit -m "auto-generating sphinx docs" || true -git remote add https https://github.com/pytorch/text.git -git push -u https gh-pages diff --git a/.circleci/smoke_test/docker/Dockerfile b/.circleci/smoke_test/docker/Dockerfile deleted file mode 100644 index ba6f4fb020..0000000000 --- a/.circleci/smoke_test/docker/Dockerfile +++ /dev/null @@ -1,33 +0,0 @@ -# this Dockerfile is for torchtext smoke test, it will be created periodically via CI system -# if you need to do it locally, follow below steps once you have Docker installed -# to test the build use : docker build . -t torchtext/smoketest -# to upload the Dockerfile use build_and_push.sh script - -FROM ubuntu:latest - -RUN apt-get -qq update && apt-get -qq -y install curl bzip2 sox libsox-dev libsox-fmt-all \ - && curl -sSL https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -o /tmp/miniconda.sh \ - && bash /tmp/miniconda.sh -bfp /usr/local \ - && rm -rf /tmp/miniconda.sh \ - && conda install -c conda-forge gcc \ - && conda install -y python=3 \ - && conda update conda \ - && apt-get -qq -y remove curl bzip2 \ - && apt-get -qq -y autoremove \ - && apt-get autoclean \ - && rm -rf /var/lib/apt/lists/* /var/log/dpkg.log \ - && conda clean --all --yes - -ENV PATH /opt/conda/bin:$PATH - - -RUN conda create -y --name python3.8 python=3.8 -RUN conda create -y --name python3.9 python=3.9 -RUN conda create -y --name python3.10 python=3.10 - -SHELL [ "/bin/bash", "-c" ] -RUN echo "source /usr/local/etc/profile.d/conda.sh" >> ~/.bashrc -RUN source /usr/local/etc/profile.d/conda.sh && conda activate python3.8 && conda install -y numpy -RUN source /usr/local/etc/profile.d/conda.sh && conda activate python3.9 && conda install -y numpy -RUN source /usr/local/etc/profile.d/conda.sh && conda activate python3.10 && conda install -y numpy -CMD [ "/bin/bash"] diff --git a/.circleci/smoke_test/docker/build_and_push.sh b/.circleci/smoke_test/docker/build_and_push.sh deleted file mode 100755 index ed67ad3b7a..0000000000 --- a/.circleci/smoke_test/docker/build_and_push.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env bash - -set -euo pipefail - -datestr="$(date "+%Y%m%d")" -image="pytorch/torchtext_smoke_base:smoke_test-${datestr}" -docker build -t "${image}" . -docker push "${image}" diff --git a/.circleci/utils/test_sort_yaml.py b/.circleci/utils/test_sort_yaml.py deleted file mode 100755 index 14a51ec974..0000000000 --- a/.circleci/utils/test_sort_yaml.py +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env python3 - -""" -To compare new version with previous: - - ./regenerate.sh - meld <(git show HEAD:./config.yml | ./sort-yaml.py) <(cat config.yml | ./sort-yaml.py) -""" - - -import sys - -import yaml - -sys.stdout.write(yaml.dump(yaml.safe_load(sys.stdin, Loader=yaml.FullLoader), sort_keys=True))