Integration Tests (push to "main") #70
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# CI for specifically ensuring integrations work fine (`transformers` mainly) on GPUs | |
# Useful tips: | |
# - `working-directory` should be set to the root of the repo, which is cloned on the actual CI runner. | |
# It follows the directory structure of `actions-runner/_work/{repo_name}/{repo_name}/{cloned_repo} on | |
# prem, but in Actions setting `working-directory` looks just in the `{repo_name}` level. | |
# - New integrations to test should have its own job, and follow a strategy method where we check both | |
# the pypi and github versions. | |
# - Workflow call lets this be called from `build_and_run_tests.yml` | |
# - When using a docker container, it's recommended to set `--shm-size`, we use 16gb. | |
name: Integration Tests (push to "main") | |
on: | |
workflow_call: | |
workflow_dispatch: | |
env: | |
HF_HOME: ~/hf_cache | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
run-trainer-tests: | |
container: | |
image: huggingface/accelerate-gpu:latest | |
options: --gpus all --shm-size "16gb" | |
runs-on: [self-hosted, docker-gpu, multi-gpu, gcp] | |
strategy: | |
fail-fast: false | |
matrix: | |
cuda_visible_devices: [ | |
"0", | |
"0,1" | |
] | |
steps: | |
- name: Update accelerate clone and pip install | |
working-directory: accelerate/ | |
run: | |
source activate accelerate; | |
git config --global --add safe.directory '*'; | |
git checkout main && git fetch && git checkout ${{ github.sha }}; | |
pip install -e .; | |
- name: Update transformers clone & pip install | |
working-directory: transformers/ | |
run: | | |
source activate accelerate | |
git config --global --add safe.directory '*' | |
git checkout main && git pull && git fetch --tags | |
pip install .[torch,deepspeed-testing] | |
pip uninstall comet_ml wandb -y | |
- name: Show installed libraries | |
run: | | |
source activate accelerate; | |
pip freeze | |
- name: Run trainer tests | |
working-directory: transformers/ | |
env: | |
CUDA_VISIBLE_DEVICES: ${{ matrix.cuda_visible_devices }} | |
WANDB_DISABLED: true | |
run: | | |
source activate accelerate; | |
pytest -sv tests/trainer | |
- name: Run deepspeed tests | |
working-directory: transformers/ | |
env: | |
CUDA_VISIBLE_DEVICES: ${{ matrix.cuda_visible_devices }} | |
WANDB_DISABLED: true | |
if: always() | |
run: | | |
source activate accelerate; | |
pytest -sv tests/deepspeed | |
- name: Run transformers examples tests | |
working-directory: transformers/ | |
env: | |
CUDA_VISIBLE_DEVICES: ${{ matrix.cuda_visible_devices }} | |
WANDB_DISABLED: true | |
run: | | |
source activate accelerate; | |
pip install -r examples/pytorch/_tests_requirements.txt | |
pytest -sv examples/pytorch/test_accelerate_examples.py examples/pytorch/test_pytorch_examples.py | |
run-skorch-tests: | |
container: | |
image: huggingface/accelerate-gpu:latest | |
options: --gpus all --shm-size "16gb" | |
runs-on: [self-hosted, docker-gpu, multi-gpu, gcp] | |
strategy: | |
fail-fast: false | |
matrix: | |
skorch-version: [ | |
pypi, | |
github | |
] | |
steps: | |
- name: Update accelerate clone and pip install | |
working-directory: accelerate/ | |
run: | |
source activate accelerate; | |
git config --global --add safe.directory '*'; | |
git checkout main && git fetch && git checkout ${{ github.sha }}; | |
pip install -e .; | |
- name: Update skorch clone & pip install | |
working-directory: skorch/ | |
run: | | |
source activate accelerate | |
git config --global --add safe.directory '*' | |
git checkout master && git pull | |
if [[ ${{ matrix.skorch-version }} = pypi ]]; then | |
git checkout $(git describe --tags `git rev-list --tags --max-count=1`) | |
fi | |
pip install .[testing] | |
pip install flaky | |
- name: Show installed libraries | |
run: | | |
source activate accelerate; | |
pip freeze | |
- name: Run skorch tests | |
working-directory: skorch/ | |
run: | | |
source activate accelerate; | |
pytest -sv -k TestAccelerate |