Skip to content

Commit 12a3919

Browse files
authored
Merge branch 'main' into dev/ba/BIONEMO-2617-support-predict-evo2lora
2 parents d98c7d4 + a29272f commit 12a3919

181 files changed

Lines changed: 39914 additions & 119 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "BioNeMo2 Development Container",
2+
"name": "BioNeMo2 Framework Dev Container",
33
"runArgs": [
44
"--gpus=all",
55
"--shm-size=4g"
@@ -23,8 +23,8 @@
2323
"TMPDIR": "/tmp",
2424
"NUMBA_CACHE_DIR": "/tmp/"
2525
},
26-
"postCreateCommand": "./.devcontainer/postCreateCommand.sh",
27-
"initializeCommand": "./.devcontainer/initializeCommand.sh",
26+
"postCreateCommand": "./.devcontainer/framework/postCreateCommand.sh",
27+
"initializeCommand": "./.devcontainer/framework/initializeCommand.sh",
2828
"remoteUser": "ubuntu",
2929
"customizations": {
3030
"vscode": {
@@ -55,8 +55,7 @@
5555
"python.defaultInterpreterPath": "/usr/bin/python",
5656
"python.testing.pytestEnabled": true,
5757
"python.testing.pytestArgs": [
58-
"sub-packages/",
59-
"scripts/"
58+
"sub-packages/"
6059
],
6160
"python.analysis.typeCheckingMode": "standard"
6261
}
File renamed without changes.
File renamed without changes.

.devcontainer/recipes/Dockerfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
FROM nvcr.io/nvidia/pytorch:25.06-py3
2+
RUN --mount=type=cache,target=/root/.cache/pip \
3+
--mount=type=bind,source=requirements.txt,target=/workspace/requirements.txt \
4+
PIP_CONSTRAINT= pip install -r /workspace/requirements.txt

.devcontainer/recipes/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Dev Container Setup
2+
3+
General-purpose dev container for local recipe development.
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
2+
// README at: https://github.com/devcontainers/templates/tree/main/src/docker-existing-dockerfile
3+
{
4+
"name": "BioNeMo Recipes Dev Container",
5+
"build": {
6+
"dockerfile": "Dockerfile"
7+
},
8+
"mounts": [
9+
"source=${localEnv:HOME}/.cache,target=/home/ubuntu/.cache,type=bind,consistency=cached",
10+
"source=${localEnv:HOME}/.netrc,target=/home/ubuntu/.netrc,type=bind,consistency=cached",
11+
"source=${localEnv:HOME}/.bash_history_devcontainer,target=/home/ubuntu/.bash_history,type=bind,consistency=cached"
12+
],
13+
"postCreateCommand": ".devcontainer/recipes/postCreateCommand.sh",
14+
"remoteUser": "ubuntu",
15+
"runArgs": [
16+
"--gpus=all",
17+
"--shm-size=4g"
18+
],
19+
"customizations": {
20+
"vscode": {
21+
"extensions": [
22+
"ms-python.python",
23+
"charliermarsh.ruff",
24+
"redhat.vscode-yaml",
25+
"ms-toolsai.jupyter",
26+
"eamodio.gitlens",
27+
"tamasfe.even-better-toml",
28+
"streetsidesoftware.code-spell-checker"
29+
]
30+
}
31+
}
32+
}

.devcontainer/recipes/postCreateCommand.sh

Whitespace-only changes.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
accelerate
2+
datasets
3+
deepspeed
4+
hydra-core
5+
torch
6+
megatron-fsdp==0.1.0rc0
7+
torchmetrics
8+
tqdm
9+
transformer_engine
10+
transformers @ git+https://github.com/huggingface/transformers.git
11+
typer
12+
wandb

.github/workflows/unit-tests-framework.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,24 +21,27 @@ concurrency:
2121

2222
jobs:
2323
changed-files:
24-
if: github.event_name != 'schedule'
2524
runs-on: ubuntu-latest
2625
outputs:
2726
any_changed: ${{ steps.changed-files.outputs.any_changed }}
2827
steps:
2928
- uses: actions/checkout@v4
3029
with:
3130
fetch-depth: 0
31+
submodules: "recursive"
3232

3333
- uses: step-security/changed-files@v46
3434
id: changed-files
3535
with:
3636
base_sha: main
3737
files: |
38+
**
3839
!models/**
3940
!recipes/**
4041
!**.md
4142
!.github/**
43+
!.gitignore
44+
!.devcontainer/**
4245
.github/workflows/unit-tests-framework.yml
4346
4447
- name: Show output
@@ -100,7 +103,7 @@ jobs:
100103
- get-pr-labels
101104
- changed-files
102105
runs-on: linux-amd64-cpu16
103-
# We want this to run
106+
# We want this to run on schedule events even if no files have changed
104107
if: ${{ github.event_name == 'schedule' || (!contains(fromJSON(needs.get-pr-labels.outputs.labels || '[]'), 'SKIP_CI') && needs.changed-files.outputs.any_changed == 'true') }}
105108
steps:
106109
- name: Login to Docker Hub
@@ -112,7 +115,7 @@ jobs:
112115
- name: Checkout repository
113116
uses: actions/checkout@v4
114117
with:
115-
submodules: "recursive"
118+
submodules: true
116119

117120
- name: Set up Docker Buildx
118121
uses: docker/setup-buildx-action@v3
Lines changed: 160 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,160 @@
1+
name: "BioNeMo Recipes CI"
2+
3+
on:
4+
push:
5+
branches:
6+
- "pull-request/[0-9]+"
7+
- "dependabot/**"
8+
merge_group:
9+
types: [checks_requested]
10+
schedule:
11+
- cron: "0 9 * * *" # Runs at 9 AM UTC daily (2 AM MST)
12+
13+
defaults:
14+
run:
15+
shell: bash -x -e -u -o pipefail {0}
16+
17+
concurrency:
18+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
19+
cancel-in-progress: true
20+
21+
jobs:
22+
changed-dirs:
23+
runs-on: ubuntu-latest
24+
outputs:
25+
any_changed: ${{ steps.changed-files.outputs.any_changed }}
26+
all_changed_files: ${{ steps.changed-files.outputs.all_changed_files }}
27+
dirs: ${{ steps.set-dirs.outputs.dirs }}
28+
29+
steps:
30+
- id: get-pr-info
31+
if: ${{ startsWith(github.ref_name, 'pull-request/') }}
32+
uses: nv-gha-runners/get-pr-info@main
33+
34+
- uses: actions/checkout@v4
35+
with:
36+
fetch-depth: 0
37+
38+
- name: Get changed files
39+
id: changed-files
40+
uses: step-security/changed-files@v46
41+
with:
42+
json: true
43+
matrix: true
44+
base_sha: main
45+
dir_names: true
46+
dir_names_max_depth: 2
47+
files: |
48+
models/**
49+
recipes/**
50+
51+
- id: set-dirs
52+
name: Determine which directories to run
53+
env:
54+
EVENT_NAME: ${{ github.event_name }}
55+
PR_INFO: ${{ steps.get-pr-info.outputs.pr-info }}
56+
CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }}
57+
run: |
58+
# Get all recipe and model directories
59+
ALL_DIRS=$(ls -d recipes/*/ models/*/ 2>/dev/null | jq -R -s -c 'split("\n")[:-1] | map(rtrimstr("/"))')
60+
61+
# Determine which directories to run: all for schedule, filtered for other events
62+
if [[ "$EVENT_NAME" == "schedule" ]]; then
63+
DIRS=$(echo "$ALL_DIRS")
64+
else
65+
# Check if INCLUDE_ALL_RECIPES label is present
66+
HAS_INCLUDE_ALL_LABEL=false
67+
if [[ "$PR_INFO" != "null" && "$PR_INFO" != "" ]]; then
68+
if echo "$PR_INFO" | jq -e '.labels[]? | select(.name == "INCLUDE_ALL_RECIPES")' > /dev/null 2>&1; then
69+
HAS_INCLUDE_ALL_LABEL=true
70+
echo "Found INCLUDE_ALL_RECIPES label - running all directories"
71+
fi
72+
fi
73+
74+
if [[ "$HAS_INCLUDE_ALL_LABEL" == "true" ]]; then
75+
DIRS=$(echo "$ALL_DIRS")
76+
else
77+
# Filter directories to only those that have changed files
78+
DIRS=$(echo "$ALL_DIRS" | jq -c --argjson changed "$CHANGED_FILES" '
79+
map(select(. as $dir | $changed | index($dir) != null))
80+
')
81+
fi
82+
fi
83+
84+
# Assign Docker images to the selected directories
85+
# Currently, AMPLIFY is the only folder that needs a custom base image, since we have to support both TE and
86+
# xformers-based models for golden value testing. The rest of the models use the default pytorch image.
87+
DIRS_WITH_IMAGES=$(echo "$DIRS" | jq -c '
88+
map({
89+
dir: .,
90+
image: (
91+
if . == "models/amplify" then
92+
"svcbionemo023/bionemo-framework:amplify-model-devcontainer-082025"
93+
else
94+
"nvcr.io/nvidia/pytorch:25.06-py3"
95+
end
96+
)
97+
})
98+
')
99+
echo "dirs=$DIRS_WITH_IMAGES" >> $GITHUB_OUTPUT
100+
- name: Show output
101+
run: |
102+
echo '${{ toJSON(steps.changed-files.outputs) }}'
103+
echo '${{ toJSON(steps.set-dirs.outputs) }}'
104+
shell: bash
105+
106+
unit-tests:
107+
needs: changed-dirs
108+
runs-on: linux-amd64-gpu-l4-latest-1
109+
if: ${{ needs.changed-dirs.outputs.dirs != '[]' }}
110+
container:
111+
image: ${{ matrix.recipe.image }}
112+
strategy:
113+
matrix:
114+
recipe: ${{ fromJson(needs.changed-dirs.outputs.dirs) }}
115+
fail-fast: false
116+
117+
steps:
118+
- name: Setup proxy cache
119+
uses: nv-gha-runners/setup-proxy-cache@main
120+
- name: Checkout repository
121+
uses: actions/checkout@v4
122+
with:
123+
sparse-checkout: "${{ matrix.recipe.dir }}"
124+
sparse-checkout-cone-mode: false
125+
126+
- name: Install dependencies
127+
working-directory: ${{ matrix.recipe.dir }}
128+
#
129+
run: |
130+
if [ -f pyproject.toml ] || [ -f setup.py ]; then
131+
PIP_CONSTRAINT= pip install -e .
132+
echo "Installed ${{ matrix.recipe.dir }} as editable package"
133+
elif [ -f requirements.txt ]; then
134+
PIP_CONSTRAINT= pip install -r requirements.txt
135+
echo "Installed ${{ matrix.recipe.dir }} from requirements.txt"
136+
else
137+
echo "No pyproject.toml, setup.py, or requirements.txt found in ${{ matrix.recipe.dir }}"
138+
exit 1
139+
fi
140+
141+
- name: Run tests
142+
working-directory: ${{ matrix.recipe.dir }}
143+
run: pytest -v .
144+
145+
verify-recipe-tests:
146+
# This job checks the status of the unit-tests matrix and fails if any matrix job failed or was cancelled.
147+
# Use this job as the required check for PRs.
148+
needs: unit-tests
149+
runs-on: ubuntu-latest
150+
if: always()
151+
steps:
152+
- name: Check unit-tests matrix status
153+
run: |
154+
if [[ "${{ needs.unit-tests.result }}" == "failure" || "${{ needs.unit-tests.result }}" == "cancelled" ]]; then
155+
echo "Some unit-tests matrix jobs have failed or been cancelled!"
156+
exit 1
157+
else
158+
echo "All unit-tests matrix jobs have completed successfully or were skipped!"
159+
exit 0
160+
fi

0 commit comments

Comments
 (0)