Skip to content

Commit 9f8e37a

Browse files
[MINOR] Move Package Dependencies for Python Testing
This commit divides the installation of packages into a part that installs all generally needed packages and one part that is only installed for specific test runs like Scuro. Additionally, torch hub get's cached which reduces setup time.
1 parent 0736c68 commit 9f8e37a

File tree

2 files changed

+22
-10
lines changed

2 files changed

+22
-10
lines changed

.github/workflows/python.yml

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ jobs:
4646
test:
4747
runs-on: ${{ matrix.os }}
4848
timeout-minutes: 60
49+
env:
50+
TORCH_HOME: ${{ github.workspace }}/.torch # cache root for hub/checkpoints
4951
strategy:
5052
fail-fast: false
5153
matrix:
@@ -110,15 +112,6 @@ jobs:
110112
requests \
111113
pandas \
112114
unittest-parallel \
113-
torchvision \
114-
transformers \
115-
opencv-python \
116-
torch \
117-
librosa \
118-
h5py \
119-
gensim \
120-
opt-einsum \
121-
nltk
122115
123116
- name: Build Python Package
124117
run: |
@@ -150,9 +143,29 @@ jobs:
150143
cd src/main/python
151144
./tests/federated/runFedTest.sh
152145
146+
- name: Cache Torch Hub
147+
if: ${{ matrix.test_mode == 'scuro' }}
148+
id: torch-cache
149+
uses: actions/cache@v4
150+
with:
151+
path: .torch
152+
key: ${{ runner.os }}-torch-${{ hashFiles('requirements.txt') }}
153+
restore-keys: |
154+
${{ runner.os }}-torch-
155+
153156
- name: Run Scuro Python Tests
154157
if: ${{ matrix.test_mode == 'scuro' }}
155158
run: |
159+
pip install \
160+
torchvision \
161+
transformers \
162+
opencv-python \
163+
torch \
164+
librosa \
165+
h5py \
166+
gensim \
167+
opt-einsum \
168+
nltk
156169
cd src/main/python
157170
python -m unittest discover -s tests/scuro -p 'test_*.py'
158171

src/main/python/systemds/utils/helpers.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
from importlib.util import find_spec
2424
from itertools import chain
2525
from typing import Dict, Iterable
26-
import torch
2726
from systemds.utils.consts import MODULE_NAME
2827

2928

0 commit comments

Comments
 (0)