Skip to content

Commit 8f56f7a

Browse files
Added tests.
1 parent fe5e695 commit 8f56f7a

File tree

1 file changed

+57
-16
lines changed

1 file changed

+57
-16
lines changed

.github/workflows/gpu-tests.yml

Lines changed: 57 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ on:
44
push:
55
branches:
66
- main
7-
- v*-release
87
pull_request:
98
branches:
109
- main
@@ -14,27 +13,69 @@ on:
1413
jobs:
1514
gpu-tests:
1615
name: Run GPU tests
17-
runs-on: [self-hosted, gpu] # Requires a GPU-enabled runner
16+
runs-on: ubuntu-latest
17+
env:
18+
BEAKER_TOKEN: ${{ secrets.BEAKER_TOKEN }}
1819
steps:
1920
- name: Checkout code
2021
uses: actions/checkout@v4
2122

22-
- name: Install uv
23-
uses: astral-sh/setup-uv@v5
23+
- name: Setup Python
24+
uses: actions/setup-python@v5
2425
with:
25-
version: "0.8.6"
26+
python-version: '3.11'
2627

27-
- name: Set up Python environment
28-
run: uv sync
29-
30-
- name: Verify CUDA availability
28+
- name: Determine current commit SHA (pull request)
29+
if: github.event_name == 'pull_request'
3130
run: |
32-
uv run python -c "import torch; print(f'CUDA available: {torch.cuda.is_available()}'); print(f'CUDA devices: {torch.cuda.device_count()}')"
31+
echo "COMMIT_SHA=${{ github.event.pull_request.head.sha }}" >> $GITHUB_ENV
3332
34-
- name: Run GPU tests
33+
- name: Determine current commit SHA (push)
34+
if: github.event_name != 'pull_request'
3535
run: |
36-
# Run all GPU test files
37-
uv run pytest -xvs tests/*_gpu.py open_instruct/*_gpu.py
38-
env:
39-
CUDA_VISIBLE_DEVICES: 0 # Use first GPU
40-
NCCL_CUMEM_ENABLE: 0
36+
echo "COMMIT_SHA=$GITHUB_SHA" >> $GITHUB_ENV
37+
38+
- name: Setup Beaker
39+
if: env.BEAKER_TOKEN != ''
40+
uses: allenai/setup-beaker@v2
41+
with:
42+
token: ${{ env.BEAKER_TOKEN }}
43+
workspace: ai2/tulu-thinker
44+
45+
- name: Run GPU tests on Beaker
46+
if: env.BEAKER_TOKEN != ''
47+
uses: allenai/[email protected]
48+
with:
49+
spec: |
50+
version: v2
51+
description: Open-Instruct GPU Tests
52+
budget: ai2/oe-training
53+
tasks:
54+
- name: gpu-tests
55+
context:
56+
priority: normal
57+
preemptible: true
58+
resources:
59+
gpuCount: 1
60+
timeout: 10m
61+
constraints:
62+
cluster:
63+
# H100 clusters
64+
- ai2/jupiter-cirrascale-2
65+
- ai2/augusta-google-1
66+
- ai2/ceres-cirrascale
67+
# A100 clusters
68+
- ai2/saturn-cirrascale
69+
command:
70+
- "bash"
71+
- "-c"
72+
- |
73+
git clone https://github.com/${{ github.repository }}.git /workspace &&
74+
cd /workspace &&
75+
git checkout ${{ env.COMMIT_SHA }} &&
76+
pip install uv &&
77+
uv run --frozen pytest -xvs tests/*_gpu.py open_instruct/*_gpu.py
78+
result:
79+
path: /unused
80+
token: ${{ env.BEAKER_TOKEN }}
81+
workspace: ai2/tulu-thinker

0 commit comments

Comments
 (0)