Revision 99b1f749792a4ce413b20158dab56b447530dae7 authored by Sasha Sheng on 05 April 2021, 00:31:02 UTC, committed by Facebook GitHub Bot on 05 April 2021, 00:31:50 UTC
Summary:
* Clean the API up to prep for moving some of the report/meter updating inside the base_model for pytorch lightning early stopping/checkpointing.

Pull Request resolved: https://github.com/facebookresearch/mmf/pull/844

Reviewed By: vedanuj

Differential Revision: D27486844

Pulled By: ytsheng

fbshipit-source-id: 759fbaccdc1ce2ef2a8e736fa179afeec48b89dc
1 parent 2379d0c
Raw File
config.yml
# Use 2.1 for orbs
version: 2.1

# -------------------------------------------------------------------------------------
# Environments to run the jobs in
# -------------------------------------------------------------------------------------
gpu: &gpu
  environment:
    CUDA_VERSION: "10.2"
  machine:
    image: ubuntu-1604:201903-01
  resource_class: gpu.medium

# -------------------------------------------------------------------------------------
# Re-usable commands
# -------------------------------------------------------------------------------------
cache_key: &cache_key cache-key-{{ .Environment.CIRCLE_JOB }}-{{ checksum ".circleci/config.yml" }}-{{ checksum "setup.py"}}-{{ checksum "requirements.txt"}}

install_dep: &install_dep
  - run:
      name: Install Dependencies
      command: |
        source activate mmf
        pip install --upgrade setuptools
        pip install --upgrade torch torchvision
        pip install --progress-bar off flake8==3.7.9
        pip install --progress-bar off black==19.3b0
        pip install --progress-bar off isort==4.3.21
        pip install --progress-bar off pytest
        pip install --progress-bar off fairscale==0.1.7
        python setup.py clean --all
        python setup.py install
        python -c 'import torch; print("Torch version:", torch.__version__)'
        python -m torch.utils.collect_env


install_repo: &install_repo
  - run:
      name: Install Repository
      command: |
        source activate mmf
        python setup.py build develop

run_unittests: &run_unittests
  - run:
      name: Run Unit Tests
      command: |
        source activate mmf
        cd tests
        pytest --junitxml=test-results/junit.xml -v .

install_nvidia_driver: &install_nvidia_driver
  - run:
      name: Install NVIDIA Driver
      working_directory: ~/
      command: |
        wget -q --no-clobber -P ~/nvidia-downloads 'https://pytorch-ci-utils.s3.us-east-2.amazonaws.com/nvidia-drivers/NVIDIA-Linux-x86_64-440.64.run'
        sudo /bin/bash ~/nvidia-downloads/NVIDIA-Linux-x86_64-440.64.run -s --no-drm
        pyenv versions
        nvidia-smi
        pyenv global 3.7.0

create_conda_env: &create_conda_env
  - run:
      name: Install and Create Conda Environment
      command: |
        curl -o ~/miniconda.sh -O  https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
        chmod +x ~/miniconda.sh
        ~/miniconda.sh -b -p $HOME/miniconda
        rm ~/miniconda.sh
        echo 'export PATH=$HOME/miniconda/bin:$PATH' >> $BASH_ENV
        source $BASH_ENV
        if [ ! -d ~/miniconda/envs/mmf ]
        then
          conda create -y -n mmf python=3.7
        fi
        source activate mmf
        python --version
        which python
        which pip
        pip install --upgrade pip


# -------------------------------------------------------------------------------------
# Jobs to run
# -------------------------------------------------------------------------------------

jobs:
  # GPU config initially taken from detectron2
  gpu_tests:
    <<: *gpu

    working_directory: ~/mmf

    steps:
      - checkout

      # Cache the nvidia driver downloads
      - restore_cache:
          key: nvidia-downloads-v4
      - <<: *install_nvidia_driver
      - save_cache:
          key: nvidia-downloads-v4
          paths:
            - "~/nvidia-downloads/"
      - <<: *create_conda_env
      - restore_cache:
          key: *cache_key
      - <<: *install_dep
      # Cache the miniconda directory that contains dependencies
      - save_cache:
          paths:
            - ~/miniconda/
          key: *cache_key
      - <<: *install_repo
      - <<: *run_unittests
      - store_test_results:
          path: tests/test-results

workflows:
  version: 2
  build:
    jobs:
      - gpu_tests
back to top