Skip to content

Commit

Permalink
Merge pull request #1920 from NNPDF/granular_version_inconsistency
Browse files Browse the repository at this point in the history
Be less strict and more granular when defining inconsistent version
  • Loading branch information
scarlehoff authored Jan 25, 2024
2 parents 151fa66 + 34e0edc commit b86feb9
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions validphys2/src/validphys/fitdata.py
Original file line number Diff line number Diff line change
Expand Up @@ -537,14 +537,21 @@ def print_systype_overlap(groups_commondata, group_dataset_inputs_by_metadata):

@table
def fit_code_version(fit):
"""Returns table with the code version from ``replica_1/{fitname}.json`` files."""
"""Returns table with the code version from ``replica_1/{fitname}.json`` files.
Note that the version for thensorflow distinguishes between the mkl=on and off version
"""
vinfo = {}
for json_path in fit.path.glob(f"nnfit/replica_*/{fit.name}.json"):
tmp = json.loads(json_path.read_text(encoding="utf-8")).get("version")
if (vinfo and vinfo != tmp) or tmp is None:
# if there's at least a replica without information, then they are all inconsistent
if tmp is None:
vinfo = {i: "inconsistent" for i in tmp}
break
vinfo = tmp
elif not vinfo:
vinfo = tmp
for k, v in tmp.items():
# If any value has changed for any replica, set it as inconsistent
vinfo[k] = v if v == vinfo[k] else "inconsistent"

return pd.DataFrame(vinfo.items(), columns=["module", fit.name]).set_index("module")

Expand Down

0 comments on commit b86feb9

Please sign in to comment.