Skip to content

lint fine-tuning docs #322

lint fine-tuning docs

lint fine-tuning docs #322

Workflow file for this run

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:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install pre-commit
run: pip install pre-commit
- name: Run pre-commit
run: pre-commit run --all-files --show-diff-on-failure
run-tests:
needs: lint
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: 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