diff --git a/.circleci/config.yml b/.circleci/config.yml index 20fccf2ca..8b49a6ec9 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -7,7 +7,7 @@ # # Check https://circleci.com/docs/2.0/language-python/ for more details # -version: 2 +version: 2.1 # ------------------------------------------------------------------------------------- # Environments to run the jobs in @@ -15,17 +15,17 @@ version: 2 cpu: &cpu docker: - - image: circleci/python:3.8 + - image: circleci/python:3.10 resource_class: medium parallelism: 10 # Number of parallel executors gpu: &gpu environment: - CUDA_VERSION: "11.1" - CUDA_HOME: /usr/local/cuda-11.1 + CUDA_VERSION: "11.6" + CUDA_HOME: /usr/local/cuda-11.6 TERM: xterm machine: - image: ubuntu-1604-cuda-11.1:202012-01 + image: linux-cuda-11:2023.02.1 resource_class: gpu.nvidia.medium.multi # Tesla T4 # ------------------------------------------------------------------------------------- @@ -38,8 +38,8 @@ install_python: &install_python working_directory: ~/ command: | pyenv versions - pyenv install -f 3.7.0 - pyenv global 3.7.0 + pyenv install -f 3.10.6 + pyenv global 3.10.6 install_fairscale: &install_fairscale - run: @@ -47,7 +47,7 @@ install_fairscale: &install_fairscale working_directory: ~/ command: | pip uninstall -y fairscale - pip install fairscale==0.4.6 + pip install fairscale==0.4.13 install_classy_vision: &install_classy_vision - run: @@ -55,7 +55,7 @@ install_classy_vision: &install_classy_vision working_directory: ~/ command: | pip uninstall -y classy_vision - pip install classy-vision@https://github.com/facebookresearch/ClassyVision/tarball/4785d5ee19d3bcedd5b28c1eb51ea1f59188b54d + pip install classy-vision@https://github.com/facebookresearch/ClassyVision/tarball/74e83dd97afbc9371b336304af09548f5080fa9c setup_venv: &setup_venv @@ -75,6 +75,12 @@ setup_venv: &setup_venv pip --version pip install -U setuptools +select_cuda: &select_cuda + - run: + name: Select CUDA + command: | + sudo update-alternatives --set cuda /usr/local/cuda-<< parameters.cuda_version >> + pip_list: &pip_list - run: name: Pip list @@ -86,8 +92,8 @@ install_vissl_dep: &install_vissl_dep name: Install VISSL Dependencies working_directory: ~/vissl command: | - pip install --progress-bar off torch==1.8.1+cu111 torchvision==0.9.1+cu111 -f https://download.pytorch.org/whl/torch_stable.html - pip install --progress-bar off opencv-python==4.5.1.48 + pip install --progress-bar off torch==1.13.1+cu116 torchvision==0.14.1+cu116 -f https://download.pytorch.org/whl/torch_stable.html + pip install --progress-bar off opencv-python==4.7.0.72 pip install --progress-bar off -r requirements.txt # Update this since classy_vision seems to need it. pip install --progress-bar off --upgrade iopath @@ -109,9 +115,9 @@ install_apex_cpu: &install_apex_cpu working_directory: ~/vissl environment: # Variable used by pip install of apex - TORCH_CUDA_ARCH_LIST: "5.0;5.2;5.3" + # TORCH_CUDA_ARCH_LIST: "6.0;6.1;6.2;7.0;7.5;8.0;8.6" command: | - pip install -v --disable-pip-version-check --no-cache-dir apex@https://github.com/NVIDIA/apex/tarball/9ce0a10fb6c2537ef6a59f27b7875e32a9e9b8b8 + pip install -v --disable-pip-version-check --no-cache-dir apex@https://github.com/NVIDIA/apex/tarball/95cea8e3e5b55b0260cc16279f2647412142d53e install_apex_gpu: &install_apex_gpu - run: @@ -119,8 +125,8 @@ install_apex_gpu: &install_apex_gpu working_directory: ~/vissl environment: # Both variables are used by install_apex.sh - CUDA_VER: "11.1" - TORCH_CUDA_ARCH_LIST: "5.0;5.2;5.3" + CUDA_VER: "11.6" + TORCH_CUDA_ARCH_LIST: "6.0;6.1;6.2;7.0;7.5;8.0;8.6" command: | bash ./docker/common/install_apex.sh diff --git a/.github/workflow/workflow.yml b/.github/workflow/workflow.yml new file mode 100644 index 000000000..67f5e3de6 --- /dev/null +++ b/.github/workflow/workflow.yml @@ -0,0 +1,31 @@ +name: CI +on: [push, pull_request] + +# Run linter with github actions for quick feedbacks. +# Run macos tests with github actions. Linux (CPU & GPU) tests currently runs on CircleCI +jobs: + linter: + runs-on: ubuntu-latest + # run on PRs, or commits to facebookresearch (not internal) + if: ${{ github.repository_owner == 'facebookresearch' || github.event_name == 'pull_request' }} + steps: + - uses: actions/checkout@v3 + - name: Set up Python 3.10 + uses: actions/setup-python@v4 + with: + python-version: 3.10 + - name: Install dependencies + # flake8-bugbear flake8-comprehensions are useful but not available internally + run: | + python -m pip install --upgrade pip + python -m pip install flake8==6.0.0 isort==5.12.0 + python -m pip install black==23.1.0 + flake8 --version + - name: Lint + run: | + echo "Running isort" + isort -c -sp . + echo "Running black" + black -l 100 --check . + echo "Running flake8" + flake8 . diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 9839a6f50..ba25e72f9 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -5,7 +5,7 @@ default_language_version: repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v3.4.0 + rev: v4.4.0 hooks: - id: trailing-whitespace - id: check-ast @@ -16,19 +16,19 @@ repos: - repo: https://github.com/psf/black # rev: 19.3b0 # Replace by any tag/version: https://github.com/psf/black/tags - rev: 22.3.0 + rev: 23.1.0 hooks: - id: black language_version: python3 # Should be a command that runs python3.6+ - repo: https://gitlab.com/pycqa/flake8 - rev: 3.9.0 + rev: 6.0.0 hooks: - id: flake8 args: ['--max-line-length=88', '--ignore=E501,E203,E266,W503,E741'] - repo: https://github.com/pycqa/isort - rev: 5.8.0 + rev: 5.12.0 hooks: - id: isort name: isort (python) diff --git a/docker/common/install_apex.sh b/docker/common/install_apex.sh index f29596a8b..191f08aff 100755 --- a/docker/common/install_apex.sh +++ b/docker/common/install_apex.sh @@ -22,7 +22,7 @@ nvcc --version export TORCH_CUDA_ARCH_LIST=${TORCH_CUDA_ARCH_LIST} # install apex now (note that we recommend a specific apex version for stability) -pip install -v --no-cache-dir --global-option="--cpp_ext" --global-option="--cuda_ext" apex@https://github.com/NVIDIA/apex/tarball/9ce0a10fb6c2537ef6a59f27b7875e32a9e9b8b8 +pip install -v --no-cache-dir --global-option="--cpp_ext" --global-option="--cuda_ext" apex@https://github.com/NVIDIA/apex/tarball/95cea8e3e5b55b0260cc16279f2647412142d53e popd diff --git a/docker/common/install_conda.sh b/docker/common/install_conda.sh index bab7f0313..e5fc55d7a 100755 --- a/docker/common/install_conda.sh +++ b/docker/common/install_conda.sh @@ -25,7 +25,7 @@ popd export PATH=/opt/conda/bin:$PATH ## Follow the steps below to create and activate a conda environment. -conda create --name vissl_env python=3.6 +conda create --name vissl_env python=3.10 bash -c "source activate vissl_env" export PATH="/opt/conda/envs/vissl_env/bin:${PATH}" diff --git a/docker/conda/Dockerfile b/docker/conda/Dockerfile index c49f3858c..854056971 100644 --- a/docker/conda/Dockerfile +++ b/docker/conda/Dockerfile @@ -1,8 +1,8 @@ ARG CUDA_VER ARG CUDA_SUFFIX -# we always use cudnn version 7 -FROM nvidia/cuda:${CUDA_VER}-cudnn7-devel +# we always use cudnn version 8 +FROM nvidia/cuda:${CUDA_VER}-cudnn8-devel ENV DEBIAN_FRONTEND noninteractive @@ -24,7 +24,7 @@ RUN ./install_conda.sh && rm install_conda.sh ENV PATH="/opt/conda/bin:${PATH}" # install PyTorch. -RUN conda install pytorch==1.9.1 torchvision cudatoolkit=${CUDA_VER} -c pytorch -c conda-forge +RUN conda install pytorch==1.13.1 torchvision cudatoolkit=${CUDA_VER} -c pytorch -c conda-forge # install apex RUN conda install apex -c vissl diff --git a/requirements.txt b/requirements.txt index 7d934ac22..bb01c8598 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,13 +1,13 @@ # Keep this sorted for easy search. # Keep versions pinned for testing reproducibility. -cython==0.29.22 -fvcore==0.1.3.post20210317 -iopath==0.1.9 -hydra-core==1.0.7 -numpy==1.19.5 -parameterized==0.7.4 -scikit-learn==0.24.1 -submitit==1.3.3 -tabulate==0.8.9 -timm==0.6.11 -pandas +cython==0.29.33 +fvcore==0.1.5.post20221221 +iopath==0.1.10 +hydra-core==1.3.2 +numpy==1.23.5 +parameterized==0.8.1 +scikit-learn==1.2.1 +submitit==1.4.5 +tabulate==0.9.0 +timm==0.6.12 +pandas==1.5.3