Skip to content

Commit 0bc585b

Browse files
author
SamoraHunter
committed
cpu only torch for github runner
1 parent 1908d51 commit 0bc585b

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

.github/workflows/notebook-test.yml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,14 @@ jobs:
1919
- name: Set environment variables
2020
run: |
2121
echo "DEBIAN_FRONTEND=noninteractive" >> $GITHUB_ENV
22+
23+
# Detect if running on GitHub Actions (not Gitea or act)
24+
if [[ "${{ github.server_url }}" == "https://github.com" ]] && [[ -z "${{ env.ACT }}" ]]; then
25+
echo "Running on GitHub - using CPU-only PyTorch"
26+
echo "PIP_EXTRA_INDEX_URL=https://download.pytorch.org/whl/cpu" >> $GITHUB_ENV
27+
echo "TORCH_CPU_ONLY=true" >> $GITHUB_ENV
28+
fi
29+
2230
if [[ "${{ vars.IS_GITEA }}" == "true" ]]; then
2331
echo "Setting thread limits for Gitea runner"
2432
echo "OMP_NUM_THREADS=1" >> $GITHUB_ENV
@@ -95,7 +103,7 @@ jobs:
95103
run: |
96104
cd $GITHUB_WORKSPACE
97105
chmod +x install.sh
98-
# This 'pip' command will now inherit the job-level 'REQUESTS_CA_BUNDLE'
106+
# The install.sh will use PIP_EXTRA_INDEX_URL if set for CPU-only PyTorch
99107
./install.sh
100108
101109
- name: Debug virtual environment
@@ -105,6 +113,9 @@ jobs:
105113
source "$VENV_PATH/bin/activate"
106114
which python
107115
python --version
116+
117+
# Verify PyTorch installation type
118+
python -c "import torch; print(f'PyTorch version: {torch.__version__}'); print(f'CUDA available: {torch.cuda.is_available()}')"
108119
109120
- name: Run tests
110121
run: |

0 commit comments

Comments
 (0)