Skip to content

Commit 8676ccd

Browse files
committed
Testing and validating ci with data from huggingface
1 parent efb6abb commit 8676ccd

6 files changed

Lines changed: 113 additions & 5 deletions

File tree

.github/actions/bootstrap-cudnn-ci/action.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,14 @@ runs:
3838
ln -sf /usr/bin/python3 /usr/bin/python
3939
rm -rf /var/lib/apt/lists/*
4040
41+
- name: Install Hugging Face CLI
42+
shell: bash
43+
env:
44+
PIP_BREAK_SYSTEM_PACKAGES: "1"
45+
run: |
46+
set -euo pipefail
47+
pip install --quiet huggingface_hub[hf_xet]
48+
4149
- name: Install uv (pinned)
4250
shell: bash
4351
env:
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
# SPDX-FileCopyrightText: Copyright (c) 2023 - 2026 NVIDIA CORPORATION & AFFILIATES.
2+
# SPDX-FileCopyrightText: All rights reserved.
3+
# SPDX-License-Identifier: Apache-2.0
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
name: Download CI test data
18+
description: |
19+
Download PhysicsNeMo CI test data from a private Hugging Face dataset
20+
repository and export TEST_DATA_DIR for the pytest nfs_data_dir fixture.
21+
22+
inputs:
23+
hf-token:
24+
description: Hugging Face token with read access to the CI data repo
25+
required: true
26+
hf-repo:
27+
description: Hugging Face dataset repo ID
28+
required: false
29+
default: "NVIDIA/PhysicsNeMo-CI-Data"
30+
data-dir:
31+
description: |
32+
Parent directory for the downloaded data. The dataset contents land
33+
in <data-dir>/physicsnemo-data/. Defaults to $RUNNER_TEMP if set, else /tmp.
34+
required: false
35+
default: ""
36+
37+
outputs:
38+
test-data-dir:
39+
description: The parent directory containing physicsnemo-data/ (set as TEST_DATA_DIR)
40+
value: ${{ steps.download.outputs.test_data_dir }}
41+
42+
runs:
43+
using: composite
44+
steps:
45+
- name: Download CI test data from Hugging Face
46+
id: download
47+
shell: bash
48+
env:
49+
HF_TOKEN: ${{ inputs.hf-token }}
50+
# Needed for Ubuntu 24.04+ containers where system python is
51+
# externally-managed (PEP 668).
52+
PIP_BREAK_SYSTEM_PACKAGES: "1"
53+
run: |
54+
set -euo pipefail
55+
data_dir="${{ inputs.data-dir }}"
56+
if [ -z "$data_dir" ]; then
57+
data_dir="${RUNNER_TEMP:-/tmp}"
58+
fi
59+
60+
if ! command -v huggingface-cli >/dev/null 2>&1; then
61+
pip install --quiet huggingface_hub[hf_xet]
62+
fi
63+
huggingface-cli download "${{ inputs.hf-repo }}" \
64+
--repo-type dataset \
65+
--local-dir "${data_dir}/physicsnemo-data" \
66+
--token "$HF_TOKEN"
67+
68+
echo "test_data_dir=${data_dir}" >> "$GITHUB_OUTPUT"
69+
echo "TEST_DATA_DIR=${data_dir}" >> "$GITHUB_ENV"
70+
71+
# Verify the download produced the expected directory structure.
72+
# conftest.py resolves TEST_DATA_DIR/physicsnemo-data/datasets/...
73+
if [ ! -d "${data_dir}/physicsnemo-data/datasets" ]; then
74+
echo "::error::Expected ${data_dir}/physicsnemo-data/datasets/ but it does not exist."
75+
echo "Contents of ${data_dir}/physicsnemo-data/:"
76+
ls -la "${data_dir}/physicsnemo-data/" 2>/dev/null || echo " (directory missing entirely)"
77+
exit 1
78+
fi
79+
echo "Downloaded CI test data to ${data_dir}/physicsnemo-data/"
80+
ls "${data_dir}/physicsnemo-data/datasets/"

.github/workflows/github-nightly-uv.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,11 @@ jobs:
248248
uv-cache-key-suffix: "latest"
249249
extras: ${{ env.EXTRAS_TAG }}
250250

251+
- name: Download CI test data
252+
uses: ./.github/actions/download-ci-data
253+
with:
254+
hf-token: ${{ secrets.HF_CI_DATA_TOKEN }}
255+
251256
- name: Run core tests (collect all for testmon)
252257
run: |
253258
# Workflow-level UV_NO_SYNC=1 + UV_FROZEN=1 keep `uv run` strictly
@@ -287,6 +292,11 @@ jobs:
287292
uv-cache-key-suffix: "latest"
288293
extras: ${{ env.EXTRAS_TAG }}
289294

295+
- name: Download CI test data
296+
uses: ./.github/actions/download-ci-data
297+
with:
298+
hf-token: ${{ secrets.HF_CI_DATA_TOKEN }}
299+
290300
- name: Run core tests for coverage report
291301
run: |
292302
# See note in testmon job re: workflow-level UV_NO_SYNC / UV_FROZEN.

.github/workflows/github-pr.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,11 @@ jobs:
117117
restore-keys: |
118118
${{ env.TESTMON_CACHE_KEY_PREFIX }}-
119119
120+
- name: Download CI test data
121+
uses: ./.github/actions/download-ci-data
122+
with:
123+
hf-token: ${{ secrets.HF_CI_DATA_TOKEN }}
124+
120125
- name: Run core tests (with testmon)
121126
run: |
122127
uv run --no-sync python -m pytest --testmon --ignore-glob="*docs*" --ignore-glob="*examples*"
@@ -164,6 +169,11 @@ jobs:
164169
restore-keys: |
165170
${{ env.COVERAGE_CACHE_KEY_PREFIX }}-
166171
172+
- name: Download CI test data
173+
uses: ./.github/actions/download-ci-data
174+
with:
175+
hf-token: ${{ secrets.HF_CI_DATA_TOKEN }}
176+
167177
- name: Run core tests for coverage report (testmon-selected)
168178
run: |
169179
uv run --no-sync coverage run --rcfile='test/coverage.pytest.rc' -m pytest --testmon --ignore-glob="*docs*" --ignore-glob="*examples*"

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ editable-install:
1010
get-data:
1111
test -n "$(TEST_DATA_DIR)" || { echo "Error: TEST_DATA_DIR should be set"; exit 1; }
1212
mkdir -p $(TEST_DATA_DIR) && \
13-
rm -rf $(TEST_DATA_DIR)/modulus-data && \
14-
git clone https://gitlab-master.nvidia.com/modulus/modulus-data.git $(TEST_DATA_DIR)/modulus-data && \
13+
rm -rf $(TEST_DATA_DIR)/physicsnemo-data && \
14+
git clone https://gitlab-master.nvidia.com/modulus/modulus-data.git $(TEST_DATA_DIR)/physicsnemo-data && \
1515
echo "Test data has been saved in ${TEST_DATA_DIR}"
1616

1717
setup-ci:

test/conftest.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
from packaging.requirements import Requirement
4242
from packaging.version import Version
4343

44-
NFS_DATA_PATH = "/data/nfs/modulus-data"
44+
NFS_DATA_PATH = "/data/nfs/physicsnemo-data"
4545

4646
# Total time per file
4747
file_timings = defaultdict(float)
@@ -93,8 +93,8 @@ def nfs_data_dir(request):
9393
if nfs_data_dir_opt:
9494
data_dir = pathlib.Path(nfs_data_dir_opt)
9595
elif test_data_dir_env:
96-
# get-data clones into $(TEST_DATA_DIR)/modulus-data
97-
data_dir = pathlib.Path(test_data_dir_env) / "modulus-data"
96+
# CI downloads into $(TEST_DATA_DIR)/physicsnemo-data
97+
data_dir = pathlib.Path(test_data_dir_env) / "physicsnemo-data"
9898
else:
9999
data_dir = pathlib.Path(NFS_DATA_PATH)
100100
if not data_dir.exists():

0 commit comments

Comments
 (0)