make batch invariance tests asserts more verbose #319
This file contains hidden or 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
| name: Run Tests | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - develop | |
| pull_request: | |
| branches: | |
| - main | |
| - develop | |
| concurrency: | |
| # github.workflow will be the name of the workflow, e.g. "Run Tests" | |
| # github.ref will be the branch or tag ref, e.g. "refs/heads/main" or, for a PR, "refs/pull/123/merge" | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| # yamllint disable rule:line-length | |
| jobs: | |
| run-tests: | |
| runs-on: ${{ github.event.repository.private && 'self-hosted' || 'ubuntu-latest' }} | |
| strategy: | |
| matrix: | |
| torch-version: [2.2.0, "2.*"] | |
| container: | |
| image: nvidia/cuda:12.4.1-cudnn-devel-ubuntu22.04 | |
| options: ${{ github.event.repository.private && '--gpus all' || ' ' }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Python | |
| run: | | |
| apt update && apt install -y python3 python3-pip git | |
| python3 -m pip install --upgrade pip | |
| - name: Linting | |
| run: | | |
| pip install ruff yamllint | |
| ruff check . | |
| ruff format --check . | |
| yamllint . | |
| - name: Install PyTorch | |
| env: | |
| TORCH: "${{ matrix.torch-version }}" | |
| run: | | |
| # use CPU only on GH runner | |
| if [ "${{ github.event.repository.private }}" = "true" ]; then | |
| pip install torch==${TORCH} --upgrade | |
| else | |
| pip install torch==${TORCH} --index-url https://download.pytorch.org/whl/cpu --upgrade | |
| fi | |
| - name: Install test dependencies | |
| env: | |
| TORCH: "${{ matrix.torch-version }}" | |
| run: | | |
| # install packages that aren't required dependencies but that the tests do need | |
| pip install h5py vesin packaging | |
| #pip install schedulefree #Disabled to reduce CI runtime; uncomment to test ScheduleFreeLightningModule | |
| # install CuEquivariance if CUDA is available | |
| if python3 -c "import torch; exit(0 if torch.cuda.is_available() else 1)"; then | |
| echo "Installing CuEquivariance (CUDA available)" | |
| pip install cuequivariance-torch cuequivariance-ops-torch-cu12 | |
| else | |
| echo "Skipping CuEquivariance installation (CUDA not available)" | |
| fi | |
| # install OpenEquivariance only if torch >= 2.7 and CUDA is available | |
| if python3 -c "import torch; import packaging.version; exit(0 if packaging.version.parse(torch.__version__) >= packaging.version.parse('2.7') else 1)"; then | |
| if python3 -c "import torch; exit(0 if torch.cuda.is_available() else 1)"; then | |
| echo "Installing OpenEquivariance (torch >= 2.7 and CUDA available)" | |
| pip install openequivariance | |
| else | |
| echo "Skipping OpenEquivariance installation (CUDA not available)" | |
| fi | |
| else | |
| echo "Skipping OpenEquivariance installation (torch < 2.7)" | |
| fi | |
| pip install --upgrade-strategy only-if-needed . | |
| pip install pytest pytest-xdist[psutil] | |
| - name: Test with pytest | |
| run: | | |
| # See https://github.com/pytest-dev/pytest/issues/1075 | |
| PYTHONHASHSEED=0 pytest -xv -n auto tests/ | |
| # yamllint enable |