Skip to content

CW efficiency improvement and bug fix, add CW binary search version, early stop PGD version, support L0 and Linf for CW and CWBS, rewrite FAB attack, fix MI-FGSM bug, rewrite JSMA. #269

CW efficiency improvement and bug fix, add CW binary search version, early stop PGD version, support L0 and Linf for CW and CWBS, rewrite FAB attack, fix MI-FGSM bug, rewrite JSMA.

CW efficiency improvement and bug fix, add CW binary search version, early stop PGD version, support L0 and Linf for CW and CWBS, rewrite FAB attack, fix MI-FGSM bug, rewrite JSMA. #269

# Modified from https://github.com/pmeier/light-the-torch
# Modified from https://github.com/pytorch/ignite/blob/master/.github/workflows/pytorch-version-tests.yml
name: build-coverage
on:
push:
branches: [ master ]
paths:
- code_coverage/**
- torchattacks/**
pull_request:
branches: [ master ]
paths:
- code_coverage/**
- torchattacks/**
jobs:
build-coverage:
strategy:
max-parallel: 10
fail-fast: false
matrix:
os:
- ubuntu-latest
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
# Bugs: 3.10 will become 3.1 if without quotes -> https://github.com/actions/setup-python/issues/695
# For ubuntu 22.04: https://raw.githubusercontent.com/actions/python-versions/main/versions-manifest.json
pytorch-version: ["1.9.1", "1.10.1", "1.11.0", "1.12.1", "1.13.1", "2.0.1", "2.1.2", "2.2.0"]
# 1.5.1, 1.4.0 Model load error in robustbench.
# 1.8.1, 1.7.1, 1.6.0 'padding==same' error in TIFGSM
exclude:
# https://github.com/pytorch/vision#installation
# pytorch 2.2 support python from 3.8 to 3.11
- pytorch-version: "2.2.0"
python-version: "3.7"
# pytorch 2.1 support python from 3.8 to 3.11
- pytorch-version: "2.1.2"
python-version: "3.7"
# pytorch 2.0 support python from 3.8 to 3.11
- pytorch-version: "2.0.1"
python-version: "3.7"
# pytorch 1.13 support python from 3.7.2 to 3.10
- pytorch-version: "1.13.1"
python-version: "3.11"
# pytorch 1.12 support python from 3.7 to 3.10
- pytorch-version: "1.12.1"
python-version: "3.11"
# pytorch 1.11 support python from 3.7 to 3.10
- pytorch-version: "1.11.0"
python-version: "3.11"
# pytorch 1.10 support python from 3.6 to 3.9
- pytorch-version: "1.10.1"
python-version: "3.10"
- pytorch-version: "1.10.1"
python-version: "3.11"
# pytorch 1.9 support python from 3.6 to 3.9
- pytorch-version: "1.9.1"
python-version: "3.10"
- pytorch-version: "1.9.1"
python-version: "3.11"
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Reinstall setuptools
run: |
python -m pip install --upgrade pip
pip install --upgrade --force-reinstall setuptools==59.8.0
- name: Install dependencies
run: |
pip install pytest pytest-cov
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Set up PyTorch ${{ matrix.pytorch-version }}
run: |
python -m pip install torch==${{ matrix.pytorch-version }} torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cpu
export CUDA_VISIBLE_DEVICES=""
- name: Run pytest
run: |
pytest --cov . --cov-report=xml
- name: Upload coverage reports to Codecov
run: |
# Replace `linux` below with the appropriate OS
# Options are `alpine`, `linux`, `macos`, `windows`
curl -Os https://uploader.codecov.io/latest/linux/codecov
chmod +x codecov
./codecov -t ${CODECOV_TOKEN}