Skip to content

Commit ce25587

Browse files
authored
🧑‍💻 Use cpu-only PyTorch for GitHub Actions (#974)
- Install CPU version for GitHub actions tests - GitHub Actions installs default version of PyTorch which includes cuda libraries. This results in out of space errors. For GitHub actins only CPU version is required.
1 parent 7620358 commit ce25587

File tree

5 files changed

+8
-2
lines changed

5 files changed

+8
-2
lines changed

.github/workflows/conda-env-create.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
runs-on: ${{ matrix.os }}
3434
timeout-minutes: 20
3535
steps:
36-
- uses: actions/checkout@v2
36+
- uses: actions/checkout@v4
3737
- name: Copy requirements files
3838
shell: bash
3939
run: |
@@ -48,3 +48,4 @@ jobs:
4848
run: |
4949
micromamba info
5050
micromamba list
51+
python -c "import torch, numpy; print(torch.__version__, numpy.__version__)"

.github/workflows/mypy-type-check.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ jobs:
3333
sudo apt update
3434
sudo apt-get install -y libopenslide-dev openslide-tools libopenjp2-7 libopenjp2-tools
3535
python -m pip install --upgrade pip
36+
pip install torch torchvision --index-url https://download.pytorch.org/whl/cpu
3637
pip install -r requirements/requirements_dev.txt
3738
3839
- name: Perform type checking

.github/workflows/pip-install.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ jobs:
5555
- name: OpenJPEG Version Information
5656
continue-on-error: true # This -h option has exit code 1 for some reason
5757
run: opj_dump -h
58+
- name: Install CPU-only PyTorch
59+
run: python -m pip install torch torchvision --index-url https://download.pytorch.org/whl/cpu
5860
- name: pip Install From GitHub Repo on Linux and macOS
5961
if: runner.os != 'Windows'
6062
run: python -m pip install git+https://github.com/TissueImageAnalytics/tiatoolbox@${GITHUB_SHA}

.github/workflows/python-package.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ jobs:
3131
sudo apt-get install -y libopenjp2-7 libopenjp2-tools
3232
python -m pip install --upgrade pip
3333
python -m pip install ruff==0.14.7 pytest pytest-cov pytest-runner
34+
pip install torch torchvision --index-url https://download.pytorch.org/whl/cpu
3435
pip install -r requirements/requirements.txt
3536
- name: Cache tiatoolbox static assets
3637
uses: actions/cache@v4
@@ -107,6 +108,7 @@ jobs:
107108
run: |
108109
sudo apt-get install -y libopenslide-dev libopenjp2-7
109110
python -m pip install --upgrade pip
111+
pip install torch torchvision --index-url https://download.pytorch.org/whl/cpu
110112
pip install -r requirements/requirements.txt
111113
pip install build
112114
- name: Build package

requirements/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ SimpleITK>=2.2.1
3232
sphinx>=5.3.0
3333
tifffile>=2022.10.10, <=2025.5.10
3434
timm>=1.0.3
35-
torch>=2.1.0
35+
torch>=2.5.0
3636
torchvision>=0.15.0
3737
tqdm>=4.64.1
3838
umap-learn>=0.5.3

0 commit comments

Comments
 (0)