Skip to content

Commit 74d60f2

Browse files
committed
Merge remote-tracking branch 'origin/main' into psteinb-explicit_noise_schedules-1437
Resolved the merge conflicts by aligning the score estimator with the vector-field API changes from main and accepting the deletions of legacy score/NPSE paths. Details: - Cleaned and reconciled ConditionalScoreEstimator imports/init and typing in sbi/neural_nets/estimators/score_estimator.py, keeping beta_min/beta_max and device tracking consistent with the new base. - Dropped deleted legacy files to match main: sbi/inference/trainers/npse/npse.py, sbi/neural_nets/net_builders/score_nets.py, and tests/score_estimator_test.py.
2 parents 833c17b + 649f5d3 commit 74d60f2

File tree

289 files changed

+30308
-10014
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

289 files changed

+30308
-10014
lines changed

.github/codecov.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,21 @@ coverage:
2222
threshold: 2% # allow the coverage to drop by X%, and posting a success status
2323
if_ci_failed: error # will set the status to success only if the CI is successful, alternative: success
2424

25+
# Flag configuration for carryforward
26+
# - 'fast': coverage from fast tests (run on every PR)
27+
# - 'full': coverage from full test suite including slow tests (run on main)
28+
# carryforward ensures slow test coverage from main is included in PR reports
29+
flag_management:
30+
individual_flags:
31+
- name: fast
32+
paths:
33+
- sbi/
34+
carryforward: false
35+
- name: full
36+
paths:
37+
- sbi/
38+
carryforward: true
39+
2540
comment:
2641
layout: "diff, flags, files"
2742
behavior: default # update if exists, otherwise post new

.github/workflows/build_docs.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ jobs:
3636
run: |
3737
cd mkdocs
3838
uv run jupyter nbconvert --to markdown ../docs/tutorials/*.ipynb --output-dir docs/tutorials/
39+
uv run jupyter nbconvert --to markdown ../docs/advanced_tutorials/*.ipynb --output-dir docs/tutorials/
40+
uv run jupyter nbconvert --to markdown ../docs/how_to_guide/09_sampler_interface.ipynb --output-dir docs/tutorials/
3941
4042
- name: Configure Git user for bot
4143
run: |

.github/workflows/cd.yml

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,24 +29,34 @@ jobs:
2929
fetch-depth: 0
3030
lfs: false
3131

32-
- name: Install uv and set the python version
33-
uses: astral-sh/setup-uv@v5
32+
- name: Set up Python
33+
uses: actions/setup-python@v5
3434
with:
3535
python-version: ${{ matrix.python-version }}
36+
37+
- name: Set up uv
38+
uses: astral-sh/setup-uv@v5
39+
with:
3640
enable-cache: true
3741
cache-dependency-glob: "pyproject.toml"
3842

3943
- name: Install dependencies with uv
4044
run: uv sync --extra dev
4145

4246
- name: Run the fast and the slow CPU tests with coverage
43-
run: uv run pytest -v -x -n auto -m "not gpu" --cov=sbi --cov-report=xml tests/
47+
run: uv run pytest -v -x -n auto -m "not gpu" --cov=sbi --cov-report=xml --junitxml=junit.xml -o junit_family=legacy tests/
4448

4549
- name: Upload coverage to Codecov
46-
uses: codecov/codecov-action@v4-beta
50+
uses: codecov/codecov-action@v4
4751
with:
4852
env_vars: OS,PYTHON
4953
file: ./coverage.xml
50-
flags: unittests
54+
flags: full
5155
name: codecov-sbi-all-cpu
5256
token: ${{ secrets.CODECOV_TOKEN }}
57+
58+
- name: Upload test results to Codecov
59+
if: ${{ !cancelled() }}
60+
uses: codecov/test-results-action@v1
61+
with:
62+
token: ${{ secrets.CODECOV_TOKEN }}

.github/workflows/ci.yml

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,19 @@ jobs:
3131
fetch-depth: 0
3232
lfs: false
3333

34-
- name: Install uv and set the python version
35-
uses: astral-sh/setup-uv@v5
34+
- name: Set up Python
35+
uses: actions/setup-python@v5
3636
with:
3737
python-version: ${{ matrix.python-version }}
38+
39+
- name: Set up uv
40+
uses: astral-sh/setup-uv@v5
41+
with:
3842
enable-cache: true
3943
cache-dependency-glob: "pyproject.toml"
4044

4145
- name: Install dependencies with uv
42-
run: |
43-
uv pip install torch --extra-index-url https://download.pytorch.org/whl/cpu
44-
uv pip install -e .[dev]
46+
run: uv sync --extra dev
4547

4648
- name: Cache uv dependencies
4749
uses: actions/cache@v4
@@ -51,26 +53,20 @@ jobs:
5153
restore-keys: |
5254
uv-${{ runner.os }}-${{ matrix.python-version }}-
5355
54-
# - name: Cache testmon data
55-
# uses: actions/cache@v4
56-
# with:
57-
# path: .testmondata
58-
# key: testmon-${{ runner.os }}-${{ matrix.python-version }}-${{ github.ref }}
59-
# restore-keys: |
60-
# testmon-${{ runner.os }}-${{ matrix.python-version }}-
61-
62-
# - name: Fix file permissions for testmondata
63-
# run: |
64-
# [ -f .testmondata ] && chmod u+w .testmondata || true
65-
6656
- name: Run fast CPU tests with coverage
67-
run: uv run pytest -v -n auto -m "not slow and not gpu" --cov=sbi --cov-report=xml --splitting-algorithm least_duration --splits ${{ matrix.split_size }} --group ${{ matrix.group_number }} tests/ #--testmon-forceselect
57+
run: uv run pytest -v -n auto -m "not slow and not gpu" --cov=sbi --cov-report=xml --junitxml=junit.xml -o junit_family=legacy --splitting-algorithm least_duration --splits ${{ matrix.split_size }} --group ${{ matrix.group_number }} tests/
6858

6959
- name: Upload coverage to Codecov
7060
uses: codecov/codecov-action@v4
7161
with:
7262
env_vars: OS,PYTHON
7363
file: ./coverage.xml
74-
flags: unittests
64+
flags: fast
7565
name: codecov-sbi-fast-cpu
7666
token: ${{ secrets.CODECOV_TOKEN }}
67+
68+
- name: Upload test results to Codecov
69+
if: ${{ !cancelled() }}
70+
uses: codecov/test-results-action@v1
71+
with:
72+
token: ${{ secrets.CODECOV_TOKEN }}
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: License Header Check
2+
3+
on: [pull_request, workflow_dispatch]
4+
5+
defaults:
6+
run:
7+
shell: bash
8+
9+
jobs:
10+
check-license-headers:
11+
name: Check License Headers
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v4
17+
with:
18+
fetch-depth: 0
19+
lfs: false
20+
21+
- name: Check license headers
22+
run: |
23+
expected_header_1="# This file is part of sbi, a toolkit for simulation-based inference. sbi is licensed"
24+
expected_header_2="# under the Apache License Version 2.0, see <https://www.apache.org/licenses/>"
25+
26+
invalid_files=()
27+
28+
while IFS= read -r file; do
29+
file_header_1=$(head -n 1 "$file")
30+
file_header_2=$(head -n 2 "$file" | tail -n 1)
31+
32+
invalid=false
33+
34+
# Check the first line
35+
if [ "$file_header_1" != "$expected_header_1" ]; then
36+
invalid=true
37+
fi
38+
39+
# Check the second line
40+
if [ "$file_header_2" != "$expected_header_2" ]; then
41+
invalid=true
42+
fi
43+
44+
# If either line is invalid, add to the list
45+
if [ "$invalid" = true ]; then
46+
invalid_files+=("$file")
47+
fi
48+
49+
done < <(find sbi tests -name "*.py" -type f)
50+
51+
# Report results
52+
if [ ${#invalid_files[@]} -ne 0 ]; then
53+
echo "❌ Missing or incorrect license headers in the following files:"
54+
for file in "${invalid_files[@]}"; do
55+
echo " $file"
56+
done
57+
echo "Make sure the following two lines are provided and correctly spelled at the very start of all above listed files"
58+
echo "$expected_header_1"
59+
echo "$expected_header_2"
60+
exit 1
61+
else
62+
echo "✅ All files have the correct license headers."
63+
exit 0
64+
fi

.github/workflows/publish.yml

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -71,19 +71,18 @@ jobs:
7171
name: python-package-distributions
7272
path: dist/
7373
- name: Sign the dists with Sigstore
74-
uses: sigstore/gh-action-sigstore-python@v2.1.1
74+
uses: sigstore/gh-action-sigstore-python@v3.0.0
7575
with:
7676
inputs: >-
7777
./dist/*.tar.gz
7878
./dist/*.whl
79-
- name: Create GitHub Release
79+
- name: Ensure GitHub Release exists (no-op if already exists)
8080
env:
8181
GITHUB_TOKEN: ${{ github.token }}
82-
run: >-
83-
gh release create
84-
'${{ github.ref_name }}'
85-
--repo '${{ github.repository }}'
86-
--notes ""
82+
run: |
83+
# If a release for this tag already exists (e.g., created via GH UI), skip creation.
84+
gh release view '${{ github.ref_name }}' --repo '${{ github.repository }}' >/dev/null 2>&1 || \
85+
gh release create '${{ github.ref_name }}' --repo '${{ github.repository }}' --notes ""
8786
- name: Upload artifact signatures to GitHub Release
8887
env:
8988
GITHUB_TOKEN: ${{ github.token }}

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@
22
.sbi_env/
33
*sbi-logs/
44
/docs/site/*
5+
/docs/reference/_autosummary/*
56

67
# Development files and python cache
78
/*.pyc
89
/*.egg
910
/*.egg-info
11+
.venv*
1012

1113
# Notebook checkpoints
1214
.ipynb_checkpoints
@@ -100,3 +102,7 @@ target/
100102
# uv
101103
uv.lock
102104
.python-version
105+
106+
# Serena cache
107+
.serena/
108+
.claude/

0 commit comments

Comments
 (0)