Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix to weight loading/saving for compatibility with Keras 3 #2042

Merged
merged 6 commits into from
Apr 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions extra_tests/regression_checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"trainable_prepro": 61,
"no_lagrange": 27,
"no_csr": 613,
"single_dense": 316,
}


Expand Down
3 changes: 1 addition & 2 deletions extra_tests/regression_fits/central.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ trvlseed: 3
nnseed: 2
mcseed: 1

load: "weights.h5"
#save: "weights.h5"
load: "weights.weights.h5"

parameters: # This defines the parameter dictionary that is passed to the Model Trainer
nodes_per_layer: [15, 10, 8]
Expand Down
20 changes: 10 additions & 10 deletions extra_tests/regression_fits/central_16.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,24 +71,24 @@
],
"timing": {
"walltime": {
"Total": 31.048200607299805,
"Total": 29.638298988342285,
"start": 0.0,
"replica_set": 0.2651939392089844,
"replica_fitted": 31.04806661605835,
"replica_set_to_replica_fitted": 30.782872676849365
"replica_set": 0.2522115707397461,
"replica_fitted": 29.6381618976593,
"replica_set_to_replica_fitted": 29.385950326919556
},
"cputime": {
"Total": 32.180306728,
"Total": 31.201514887000002,
"start": 0.0,
"replica_set": 0.5742407289999996,
"replica_fitted": 32.180171014,
"replica_set_to_replica_fitted": 31.605930285000003
"replica_set": 0.5735468639999999,
"replica_fitted": 31.201376138,
"replica_set_to_replica_fitted": 30.627829274
}
},
"version": {
"tensorflow": "2.16.1, mkl=??",
"numpy": "1.26.4",
"nnpdf": "4.0.9.post199.dev0+1fe20fa4d",
"validphys": "4.0.9.post199.dev0+1fe20fa4d"
"nnpdf": "4.0.9.post446.dev0+264ada234",
"validphys": "4.0.9.post446.dev0+264ada234"
}
}
3 changes: 1 addition & 2 deletions extra_tests/regression_fits/diagonal.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ nnseed: 2
mcseed: 1
diagonal_basis: True

load: "weights.h5"
#save: "weights.h5"
load: "weights.weights.h5"

parameters: # This defines the parameter dictionary that is passed to the Model Trainer
nodes_per_layer: [15, 10, 8]
Expand Down
20 changes: 10 additions & 10 deletions extra_tests/regression_fits/diagonal_45.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,24 +71,24 @@
],
"timing": {
"walltime": {
"Total": 29.06363534927368,
"Total": 29.0417582988739,
"start": 0.0,
"replica_set": 0.25472235679626465,
"replica_fitted": 29.063465118408203,
"replica_set_to_replica_fitted": 28.80874276161194
"replica_set": 0.24686527252197266,
"replica_fitted": 29.04159164428711,
"replica_set_to_replica_fitted": 28.794726371765137
},
"cputime": {
"Total": 30.465482574,
"Total": 30.396234212999996,
"start": 0.0,
"replica_set": 0.5778199490000002,
"replica_fitted": 30.465310533,
"replica_set_to_replica_fitted": 29.887490584000002
"replica_set": 0.5666455580000003,
"replica_fitted": 30.396064907,
"replica_set_to_replica_fitted": 29.829419349
}
},
"version": {
"tensorflow": "2.16.1, mkl=??",
"numpy": "1.26.4",
"nnpdf": "4.0.9.post199.dev0+1fe20fa4d",
"validphys": "4.0.9.post199.dev0+1fe20fa4d"
"nnpdf": "4.0.9.post446.dev0+264ada234",
"validphys": "4.0.9.post446.dev0+264ada234"
}
}
2 changes: 1 addition & 1 deletion extra_tests/regression_fits/feature_scaling.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ trvlseed: 3
nnseed: 2
mcseed: 1

load: "weights_feature.h5"
load: "weights_feature.weights.h5"

parameters: # This defines the parameter dictionary that is passed to the Model Trainer
nodes_per_layer: [15, 10, 8]
Expand Down
20 changes: 10 additions & 10 deletions extra_tests/regression_fits/feature_scaling_81.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,24 +71,24 @@
],
"timing": {
"walltime": {
"Total": 30.279093980789185,
"Total": 29.385473251342773,
"start": 0.0,
"replica_set": 0.3903789520263672,
"replica_fitted": 30.278961420059204,
"replica_set_to_replica_fitted": 29.888582468032837
"replica_set": 0.2618255615234375,
"replica_fitted": 29.38529133796692,
"replica_set_to_replica_fitted": 29.12346577644348
},
"cputime": {
"Total": 31.561038845999995,
"Total": 30.624417034000004,
"start": 0.0,
"replica_set": 0.7120741859999997,
"replica_fitted": 31.560904756,
"replica_set_to_replica_fitted": 30.84883057
"replica_set": 0.5652710770000002,
"replica_fitted": 30.62423277,
"replica_set_to_replica_fitted": 30.058961692999997
}
},
"version": {
"tensorflow": "2.16.1, mkl=??",
"numpy": "1.26.4",
"nnpdf": "4.0.9.post199.dev0+1fe20fa4d",
"validphys": "4.0.9.post199.dev0+1fe20fa4d"
"nnpdf": "4.0.9.post446.dev0+264ada234",
"validphys": "4.0.9.post446.dev0+264ada234"
}
}
2 changes: 1 addition & 1 deletion extra_tests/regression_fits/flavour.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ trvlseed: 3
nnseed: 2
mcseed: 1

load: "weights_flavour.h5"
load: "weights_flavour.weights.h5"

parameters: # This defines the parameter dictionary that is passed to the Model Trainer
nodes_per_layer: [15, 10, 8]
Expand Down
20 changes: 10 additions & 10 deletions extra_tests/regression_fits/flavour_29.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,24 +71,24 @@
],
"timing": {
"walltime": {
"Total": 7.113682270050049,
"Total": 7.07843017578125,
"start": 0.0,
"replica_set": 0.2767362594604492,
"replica_fitted": 7.113603353500366,
"replica_set_to_replica_fitted": 6.836867094039917
"replica_set": 0.2522542476654053,
"replica_fitted": 7.078283309936523,
"replica_set_to_replica_fitted": 6.826029062271118
},
"cputime": {
"Total": 7.535886518999999,
"Total": 7.514604531,
"start": 0.0,
"replica_set": 0.594062321,
"replica_fitted": 7.535805837999999,
"replica_set_to_replica_fitted": 6.941743516999999
"replica_set": 0.5747256410000006,
"replica_fitted": 7.514455934000001,
"replica_set_to_replica_fitted": 6.939730293
}
},
"version": {
"tensorflow": "2.16.1, mkl=??",
"numpy": "1.26.4",
"nnpdf": "4.0.9.post199.dev0+1fe20fa4d",
"validphys": "4.0.9.post199.dev0+1fe20fa4d"
"nnpdf": "4.0.9.post446.dev0+264ada234",
"validphys": "4.0.9.post446.dev0+264ada234"
}
}
3 changes: 1 addition & 2 deletions extra_tests/regression_fits/no_csr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ nnseed: 2
mcseed: 1
sum_rules: "ALLBUTCSR"

#load: "weights.h5"
save: "weights_casymm.h5"
save: "weights_casymm.weights.h5"

parameters: # This defines the parameter dictionary that is passed to the Model Trainer
nodes_per_layer: [15, 10, 9]
Expand Down
20 changes: 10 additions & 10 deletions extra_tests/regression_fits/no_csr_613.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,24 +77,24 @@
],
"timing": {
"walltime": {
"Total": 27.68090558052063,
"Total": 27.847703218460083,
"start": 0.0,
"replica_set": 0.26375412940979004,
"replica_fitted": 27.68082618713379,
"replica_set_to_replica_fitted": 27.417072057724
"replica_set": 0.2785060405731201,
"replica_fitted": 27.847578287124634,
"replica_set_to_replica_fitted": 27.569072246551514
},
"cputime": {
"Total": 28.59983451,
"Total": 28.899172986,
"start": 0.0,
"replica_set": 0.5861168649999993,
"replica_fitted": 28.599753618999998,
"replica_set_to_replica_fitted": 28.013636754
"replica_set": 0.5995310260000002,
"replica_fitted": 28.899045308,
"replica_set_to_replica_fitted": 28.299514282
}
},
"version": {
"tensorflow": "2.16.1, mkl=??",
"numpy": "1.26.4",
"nnpdf": "4.0.9.post199.dev0+1fe20fa4d",
"validphys": "4.0.9.post199.dev0+1fe20fa4d"
"nnpdf": "4.0.9.post446.dev0+264ada234",
"validphys": "4.0.9.post446.dev0+264ada234"
}
}
3 changes: 1 addition & 2 deletions extra_tests/regression_fits/no_lagrange.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ trvlseed: 3
nnseed: 2
mcseed: 1

load: "weights.h5"
#save: "weights.h5"
load: "weights.weights.h5"

parameters: # This defines the parameter dictionary that is passed to the Model Trainer
nodes_per_layer: [15, 10, 8]
Expand Down
20 changes: 10 additions & 10 deletions extra_tests/regression_fits/no_lagrange_27.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,24 +71,24 @@
],
"timing": {
"walltime": {
"Total": 34.43342328071594,
"Total": 33.39091753959656,
"start": 0.0,
"replica_set": 0.25362443923950195,
"replica_fitted": 34.433255195617676,
"replica_set_to_replica_fitted": 34.179630756378174
"replica_set": 0.2545652389526367,
"replica_fitted": 33.390822649002075,
"replica_set_to_replica_fitted": 33.13625741004944
},
"cputime": {
"Total": 34.948388623,
"Total": 34.736605786000005,
"start": 0.0,
"replica_set": 0.5769920379999993,
"replica_fitted": 34.948218866,
"replica_set_to_replica_fitted": 34.371226828000005
"replica_set": 0.566752718,
"replica_fitted": 34.736509046,
"replica_set_to_replica_fitted": 34.169756328
}
},
"version": {
"tensorflow": "2.16.1, mkl=??",
"numpy": "1.26.4",
"nnpdf": "4.0.9.post199.dev0+1fe20fa4d",
"validphys": "4.0.9.post199.dev0+1fe20fa4d"
"nnpdf": "4.0.9.post446.dev0+264ada234",
"validphys": "4.0.9.post446.dev0+264ada234"
}
}
3 changes: 1 addition & 2 deletions extra_tests/regression_fits/no_msr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@ nnseed: 2
mcseed: 1
sum_rules: "VSR"

load: "weights.h5"
#save: "weights.h5"
load: "weights.weights.h5"

parameters: # This defines the parameter dictionary that is passed to the Model Trainer
nodes_per_layer: [15, 10, 8]
Expand Down
20 changes: 10 additions & 10 deletions extra_tests/regression_fits/no_msr_92.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,24 +71,24 @@
],
"timing": {
"walltime": {
"Total": 42.30840301513672,
"Total": 41.017494440078735,
"start": 0.0,
"replica_set": 0.28534770011901855,
"replica_fitted": 42.30820417404175,
"replica_set_to_replica_fitted": 42.02285647392273
"replica_set": 0.2511754035949707,
"replica_fitted": 41.01731038093567,
"replica_set_to_replica_fitted": 40.7661349773407
},
"cputime": {
"Total": 43.76437747,
"Total": 42.594483392,
"start": 0.0,
"replica_set": 0.6081680240000003,
"replica_fitted": 43.764176815,
"replica_set_to_replica_fitted": 43.156008791000005
"replica_set": 0.5723506120000001,
"replica_fitted": 42.594297225,
"replica_set_to_replica_fitted": 42.021946613
}
},
"version": {
"tensorflow": "2.16.1, mkl=??",
"numpy": "1.26.4",
"nnpdf": "4.0.9.post199.dev0+1fe20fa4d",
"validphys": "4.0.9.post199.dev0+1fe20fa4d"
"nnpdf": "4.0.9.post446.dev0+264ada234",
"validphys": "4.0.9.post446.dev0+264ada234"
}
}
3 changes: 1 addition & 2 deletions extra_tests/regression_fits/no_sumrules.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@ nnseed: 2
mcseed: 1
sum_rules: False

load: "weights.h5"
#save: "weights.h5"
load: "weights.weights.h5"

parameters: # This defines the parameter dictionary that is passed to the Model Trainer
nodes_per_layer: [15, 10, 8]
Expand Down
20 changes: 10 additions & 10 deletions extra_tests/regression_fits/no_sumrules_18.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,24 +71,24 @@
],
"timing": {
"walltime": {
"Total": 36.92449688911438,
"Total": 36.68100190162659,
"start": 0.0,
"replica_set": 0.2836623191833496,
"replica_fitted": 36.92424249649048,
"replica_set_to_replica_fitted": 36.64058017730713
"replica_set": 0.41010546684265137,
"replica_fitted": 36.6807975769043,
"replica_set_to_replica_fitted": 36.270692110061646
},
"cputime": {
"Total": 38.32987047,
"Total": 37.817408023,
"start": 0.0,
"replica_set": 0.5956230580000001,
"replica_fitted": 38.329614022,
"replica_set_to_replica_fitted": 37.733990964
"replica_set": 0.7309529969999993,
"replica_fitted": 37.817202128999995,
"replica_set_to_replica_fitted": 37.086249132
}
},
"version": {
"tensorflow": "2.16.1, mkl=??",
"numpy": "1.26.4",
"nnpdf": "4.0.9.post199.dev0+1fe20fa4d",
"validphys": "4.0.9.post199.dev0+1fe20fa4d"
"nnpdf": "4.0.9.post446.dev0+264ada234",
"validphys": "4.0.9.post446.dev0+264ada234"
}
}
3 changes: 1 addition & 2 deletions extra_tests/regression_fits/no_vsr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@ nnseed: 2
mcseed: 1
sum_rules: "MSR"

load: "weights.h5"
#save: "weights.h5"
load: "weights.weights.h5"

parameters: # This defines the parameter dictionary that is passed to the Model Trainer
nodes_per_layer: [15, 10, 8]
Expand Down
Loading