WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Integrating bayesian layer into n3fit #912

Integrating bayesian layer into n3fit

Integrating bayesian layer into n3fit #912

name: All tests NNPDF
# This workflow collects all tests for the NNPDF framework
# the environment and installation steps are shared as they are using
# the custom actions in .github/actions/
on: [push]
# Define a group based on on branch name (github.head_ref) and .... (github.ref)
# use this group to identify which processes to cancel due to cancel-in-progress
concurrency:
group: ${{ github.head_ref }}-${{ github.ref }}
cancel-in-progress: true
env:
# https://keras.io/getting_started/faq/#how-can-i-obtain-reproducible-results-using-keras-during-development
PYTHONHASHSEED: "0"
NETRC_FILE: ${{ secrets.NETRC_FILE }}
jobs:
run_package_tests:
strategy:
matrix:
os: [ubuntu-latest, macos-14]
python-version: ["3.10", "3.13"]
include:
- os: ubuntu-latest
CONDA_OS: linux-64
fail-fast: false # continue even if some jobs failed
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/install_conda_pip
with:
python-version: ${{ matrix.python-version }}
- name: Test n3fit and validphys
shell: bash -l {0}
run: |
pytest --cov=${PWD} --cov-config=pyproject.toml --mpl --pyargs validphys n3fit --mpl-default-tolerance 24
- name: Keep coverage file
if: startsWith(matrix.python-version, '3.13')
uses: actions/upload-artifact@v4
with:
include-hidden-files: true
name: coverage-package-${{ matrix.os }}
path: .coverage
regression_tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/install_conda_pip
- name: Run regression tests
shell: bash -l {0}
run: |
pytest --cov=${PWD} --cov-config=pyproject.toml extra_tests/regression_checks.py
- name: Keep coverage file
uses: actions/upload-artifact@v4
with:
include-hidden-files: true
name: coverage-regression
path: .coverage
conda_tests:
strategy:
matrix:
os: [ubuntu-latest, macos-14]
fail-fast: false
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with: # conda requires fetching the history of the repo to prepare the package name
fetch-tags: true
fetch-depth: 0
- uses: ./.github/actions/prepare_environment
with:
python-version: "3.13"
- name: Build recipe
shell: bash -l {0}
run: |
conda install conda-build --yes
conda build -q conda-recipe --package-format=1
- name: Keep conda package as artifact
if: ${{ !cancelled() }}
uses: actions/upload-artifact@v4
with:
# Uploads package to the workflow, download url available in the action's log
name: nnpdf-package-${{ github.job }}-${{ strategy.job-index }}.tar.bz2
path: ${{ env.CONDA }}/envs/*/conda-bld/noarch/*.tar.bz2
run_pytorch:
runs-on: ubuntu-latest
env:
KERAS_BACKEND: torch
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.13"
- name: Install nnpdf without LHAPDF
shell: bash -l {0}
run: |
sudo rm -rf /opt/hostedtoolcache/Python/{3.9*}
sudo rm -rf /opt/hostedtoolcache/CodeQL
pip install .[nolha,torch]
# Since there is no LHAPDF in the system, initialize the folder and download pdfsets.index
lhapdf-management update --init
- name: Test we can run one runcard
shell: bash -l {0}
run: |
cd n3fit/runcards/examples
n3fit Basic_runcard.yml 4
cat Basic_runcard/nnfit/*/Basic_runcard.json
- name: Test we can still run postfit
shell: bash -l {0}
run: |
output=$(vp-get fit NNPDF40_nnlo_like_CI_testing_250616)
fit_path=$(echo $output | grep -o "PosixPath('.*')" | cut -d"'" -f2)
mv ${fit_path} .
postfit 50 NNPDF40_nnlo_like_CI_testing_250616
run_jax:
runs-on: ubuntu-latest
env:
KERAS_BACKEND: jax
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.13"
- name: Install nnpdf without LHAPDF
shell: bash -l {0}
run: |
pip install .[nolha,jax]
# Since there is no LHAPDF in the system, initialize the folder and download pdfsets.index
lhapdf-management update --init
- name: Test we can run one runcard
shell: bash -l {0}
run: |
cd n3fit/runcards/examples
n3fit Basic_runcard.yml 42
cat Basic_runcard/nnfit/*/Basic_runcard.json
full_coverage:
needs: [run_package_tests, regression_tests]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/install_conda_pip
with:
nnpdf-extras: ""
- name: Install coverage
run: pip install coverage
- name: Download reports
uses: actions/download-artifact@v4
with:
path: reports
- name: Merge and show
run: |
coverage combine reports/**/.coverage
coverage report -i