diff --git a/keras/src/legacy/saving/legacy_h5_format.py b/keras/src/legacy/saving/legacy_h5_format.py index 0e284f5a9db..cc5ef63d97a 100644 --- a/keras/src/legacy/saving/legacy_h5_format.py +++ b/keras/src/legacy/saving/legacy_h5_format.py @@ -519,7 +519,7 @@ def load_weights_from_hdf5_group_by_name(f, model, skip_mismatch=False): ) if "top_level_model_weights" in f: - symbolic_weights = model.trainable_weights + model.non_trainable_weights + symbolic_weights = model._trainable_variables + model._non_trainable_variables weight_values = load_subset_weights_from_hdf5_group( f["top_level_model_weights"] )