Skip to content

ValueError: You are trying to restore a checkpoint from a legacy Keras optimizer into a v2.11+ Optimizer, which can cause errors. Please update the optimizer referenced in your code to be an instance of tf.keras.optimizers.legacy.Optimizer, e.g.: tf.keras.optimizers.legacy.Adadelta. #4

@fazhang-master

Description

@fazhang-master

Step 1/3: Calculating numerical representations for all metabolites.
.....1(a) Calculating input matrices for Graph Neural Network
.....1(b) Calculating numerical metabolite representations using a Graph Neural Network
2023-11-26 02:37:39.868803: I tensorflow/core/platform/cpu_feature_guard.cc:193] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations: AVX AVX2
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
WARNING:absl:lr is deprecated, please use learning_rate instead, or use the legacy optimizer, e.g.,tf.keras.optimizers.legacy.Adadelta.
Traceback (most recent call last):
File "F:\desktop\demo\Kcat生物信息\KM_prediction_function\KM_prediction_function-main\code\km_pre.py", line 28, in
enzyme_list = ["MSIPETQKGVIFYESHGKLEYKDIPVPKPKANELLINVKYSGVCHTDLHAWHGDWPLPVKLPLVGGHEGAGVVVGMGENVKWKIGDYAGIKWLNGSCMACEYCELGNESNCPHADLSGYTHDGSFQQYATADAVQAAHIPQGTDLAQVAPILCAGITVYKALKSANLMAGHWVAISGAAGGLGSLAVQYAKAMGYRVLGIDGGEGKEELFRSIGGEVFIDFTKEKDIVGAVLKATDGGAHGVINVSVSEAAIEASTRYVRANGTTVLVGMPAGAKCCSDVFNQVVKSISIVGSYVGNRADTREALDFFARGLVKSPIKVVGLSTLPEIYEKMEKGQIVGRYVVDTSK"])
File "F:\desktop\demo\Kcat生物信息\KM_prediction_function\KM_prediction_function-main\code\KM_prediction.py", line 23, in KM_predicton
df_met = calculate_gnn_representations(df_met)
File "F:\desktop\demo\Kcat生物信息\KM_prediction_function\KM_prediction_function-main\code\GNN_functions.py", line 25, in calculate_gnn_representations
GNN_representation_fct = loading_GNN(N_max)
File "F:\desktop\demo\Kcat生物信息\KM_prediction_function\KM_prediction_function-main\code\GNN_functions.py", line 40, in loading_GNN
model.load_weights(join(CURRENT_DIR, "..", "data", "saved_models", "GNN", "saved_model_GNN_best_hyperparameters"))
File "I:\conda\envs\KM\lib\site-packages\keras\utils\traceback_utils.py", line 70, in error_handler
raise e.with_traceback(filtered_tb) from None
File "I:\conda\envs\KM\lib\site-packages\keras\optimizers\optimizer_experimental\optimizer.py", line 132, in _create_or_restore_slot_variable
"You are trying to restore a checkpoint from a legacy Keras "
ValueError: You are trying to restore a checkpoint from a legacy Keras optimizer into a v2.11+ Optimizer, which can cause errors. Please update the optimizer referenced in your code to be an instance of tf.keras.optimizers.legacy.Optimizer, e.g.: tf.keras.optimizers.legacy.Adadelta.
WARNING:tensorflow:Detecting that an object or model or tf.train.Checkpoint is being deleted with unrestored values. See the following logs for the specific values in question. To silence these warnings, use status.expect_partial(). See https://www.tensorflow.org/api_docs/python/tf/train/Checkpoint#restorefor details about the status object returned by the restore function.
WARNING:tensorflow:Detecting that an object or model or tf.train.Checkpoint is being deleted with unrestored values. See the following logs for the specific values in question. To silence these warnings, use status.expect_partial(). See https://www.tensorflow.org/api_docs/python/tf/train/Checkpoint#restorefor details about the status object returned by the restore function.
WARNING:tensorflow:Value in checkpoint could not be found in the restored object: (root).optimizer's state 'accum_grad' for (root).layer_with_weights-0.w
WARNING:tensorflow:Value in checkpoint could not be found in the restored object: (root).optimizer's state 'accum_grad' for (root).layer_with_weights-0.w
WARNING:tensorflow:Value in checkpoint could not be found in the restored object: (root).optimizer's state 'accum_grad' for (root).layer_with_weights-1.w
WARNING:tensorflow:Value in checkpoint could not be found in the restored object: (root).optimizer's state 'accum_grad' for (root).layer_with_weights-1.w
WARNING:tensorflow:Value in checkpoint could not be found in the restored object: (root).optimizer's state 'accum_grad' for (root).layer_with_weights-2.gamma
WARNING:tensorflow:Value in checkpoint could not be found in the restored object: (root).optimizer's state 'accum_grad' for (root).layer_with_weights-2.gamma
WARNING:tensorflow:Value in checkpoint could not be found in the restored object: (root).optimizer's state 'accum_grad' for (root).layer_with_weights-2.beta
WARNING:tensorflow:Value in checkpoint could not be found in the restored object: (root).optimizer's state 'accum_grad' for (root).layer_with_weights-2.beta
WARNING:tensorflow:Value in checkpoint could not be found in the restored object: (root).optimizer's state 'accum_grad' for (root).layer_with_weights-3.w
WARNING:tensorflow:Value in checkpoint could not be found in the restored object: (root).optimizer's state 'accum_grad' for (root).layer_with_weights-3.w
WARNING:tensorflow:Value in checkpoint could not be found in the restored object: (root).optimizer's state 'accum_grad' for (root).layer_with_weights-4.gamma
WARNING:tensorflow:Value in checkpoint could not be found in the restored object: (root).optimizer's state 'accum_grad' for (root).layer_with_weights-4.gamma
WARNING:tensorflow:Value in checkpoint could not be found in the restored object: (root).optimizer's state 'accum_grad' for (root).layer_with_weights-4.beta
WARNING:tensorflow:Value in checkpoint could not be found in the restored object: (root).optimizer's state 'accum_grad' for (root).layer_with_weights-4.beta
WARNING:tensorflow:Value in checkpoint could not be found in the restored object: (root).optimizer's state 'accum_grad' for (root).layer_with_weights-5.w
WARNING:tensorflow:Value in checkpoint could not be found in the restored object: (root).optimizer's state 'accum_grad' for (root).layer_with_weights-5.w
WARNING:tensorflow:Value in checkpoint could not be found in the restored object: (root).optimizer's state 'accum_grad' for (root).layer_with_weights-6.gamma
WARNING:tensorflow:Value in checkpoint could not be found in the restored object: (root).optimizer's state 'accum_grad' for (root).layer_with_weights-6.gamma
WARNING:tensorflow:Value in checkpoint could not be found in the restored object: (root).optimizer's state 'accum_grad' for (root).layer_with_weights-6.beta
WARNING:tensorflow:Value in checkpoint could not be found in the restored object: (root).optimizer's state 'accum_grad' for (root).layer_with_weights-6.beta
WARNING:tensorflow:Value in checkpoint could not be found in the restored object: (root).optimizer's state 'accum_grad' for (root).layer_with_weights-7.w
WARNING:tensorflow:Value in checkpoint could not be found in the restored object: (root).optimizer's state 'accum_grad' for (root).layer_with_weights-7.w
WARNING:tensorflow:Value in checkpoint could not be found in the restored object: (root).optimizer's state 'accum_grad' for (root).layer_with_weights-7.b
WARNING:tensorflow:Value in checkpoint could not be found in the restored object: (root).optimizer's state 'accum_grad' for (root).layer_with_weights-7.b
WARNING:tensorflow:Value in checkpoint could not be found in the restored object: (root).optimizer's state 'accum_grad' for (root).layer_with_weights-8.gamma
WARNING:tensorflow:Value in checkpoint could not be found in the restored object: (root).optimizer's state 'accum_grad' for (root).layer_with_weights-8.gamma
WARNING:tensorflow:Value in checkpoint could not be found in the restored object: (root).optimizer's state 'accum_grad' for (root).layer_with_weights-8.beta
WARNING:tensorflow:Value in checkpoint could not be found in the restored object: (root).optimizer's state 'accum_grad' for (root).layer_with_weights-8.beta
WARNING:tensorflow:Value in checkpoint could not be found in the restored object: (root).optimizer's state 'accum_grad' for (root).layer_with_weights-9.w
WARNING:tensorflow:Value in checkpoint could not be found in the restored object: (root).optimizer's state 'accum_grad' for (root).layer_with_weights-9.w
WARNING:tensorflow:Value in checkpoint could not be found in the restored object: (root).optimizer's state 'accum_grad' for (root).layer_with_weights-9.b
WARNING:tensorflow:Value in checkpoint could not be found in the restored object: (root).optimizer's state 'accum_grad' for (root).layer_with_weights-9.b
WARNING:tensorflow:Value in checkpoint could not be found in the restored object: (root).optimizer's state 'accum_grad' for (root).layer_with_weights-10.gamma
WARNING:tensorflow:Value in checkpoint could not be found in the restored object: (root).optimizer's state 'accum_grad' for (root).layer_with_weights-10.gamma
WARNING:tensorflow:Value in checkpoint could not be found in the restored object: (root).optimizer's state 'accum_grad' for (root).layer_with_weights-10.beta
WARNING:tensorflow:Value in checkpoint could not be found in the restored object: (root).optimizer's state 'accum_grad' for (root).layer_with_weights-10.beta
WARNING:tensorflow:Value in checkpoint could not be found in the restored object: (root).optimizer's state 'accum_grad' for (root).layer_with_weights-11.w
WARNING:tensorflow:Value in checkpoint could not be found in the restored object: (root).optimizer's state 'accum_grad' for (root).layer_with_weights-11.w
WARNING:tensorflow:Value in checkpoint could not be found in the restored object: (root).optimizer's state 'accum_grad' for (root).layer_with_weights-11.b
WARNING:tensorflow:Value in checkpoint could not be found in the restored object: (root).optimizer's state 'accum_grad' for (root).layer_with_weights-11.b
WARNING:tensorflow:Value in checkpoint could not be found in the restored object: (root).optimizer's state 'accum_var' for (root).layer_with_weights-0.w
WARNING:tensorflow:Value in checkpoint could not be found in the restored object: (root).optimizer's state 'accum_var' for (root).layer_with_weights-0.w
WARNING:tensorflow:Value in checkpoint could not be found in the restored object: (root).optimizer's state 'accum_var' for (root).layer_with_weights-1.w
WARNING:tensorflow:Value in checkpoint could not be found in the restored object: (root).optimizer's state 'accum_var' for (root).layer_with_weights-1.w
WARNING:tensorflow:Value in checkpoint could not be found in the restored object: (root).optimizer's state 'accum_var' for (root).layer_with_weights-2.gamma
WARNING:tensorflow:Value in checkpoint could not be found in the restored object: (root).optimizer's state 'accum_var' for (root).layer_with_weights-2.gamma
WARNING:tensorflow:Value in checkpoint could not be found in the restored object: (root).optimizer's state 'accum_var' for (root).layer_with_weights-2.beta
WARNING:tensorflow:Value in checkpoint could not be found in the restored object: (root).optimizer's state 'accum_var' for (root).layer_with_weights-2.beta
WARNING:tensorflow:Value in checkpoint could not be found in the restored object: (root).optimizer's state 'accum_var' for (root).layer_with_weights-3.w
WARNING:tensorflow:Value in checkpoint could not be found in the restored object: (root).optimizer's state 'accum_var' for (root).layer_with_weights-3.w
WARNING:tensorflow:Value in checkpoint could not be found in the restored object: (root).optimizer's state 'accum_var' for (root).layer_with_weights-4.gamma
WARNING:tensorflow:Value in checkpoint could not be found in the restored object: (root).optimizer's state 'accum_var' for (root).layer_with_weights-4.gamma
WARNING:tensorflow:Value in checkpoint could not be found in the restored object: (root).optimizer's state 'accum_var' for (root).layer_with_weights-4.beta
WARNING:tensorflow:Value in checkpoint could not be found in the restored object: (root).optimizer's state 'accum_var' for (root).layer_with_weights-4.beta
WARNING:tensorflow:Value in checkpoint could not be found in the restored object: (root).optimizer's state 'accum_var' for (root).layer_with_weights-5.w
WARNING:tensorflow:Value in checkpoint could not be found in the restored object: (root).optimizer's state 'accum_var' for (root).layer_with_weights-5.w
WARNING:tensorflow:Value in checkpoint could not be found in the restored object: (root).optimizer's state 'accum_var' for (root).layer_with_weights-6.gamma
WARNING:tensorflow:Value in checkpoint could not be found in the restored object: (root).optimizer's state 'accum_var' for (root).layer_with_weights-6.gamma
WARNING:tensorflow:Value in checkpoint could not be found in the restored object: (root).optimizer's state 'accum_var' for (root).layer_with_weights-6.beta
WARNING:tensorflow:Value in checkpoint could not be found in the restored object: (root).optimizer's state 'accum_var' for (root).layer_with_weights-6.beta
WARNING:tensorflow:Value in checkpoint could not be found in the restored object: (root).optimizer's state 'accum_var' for (root).layer_with_weights-7.w
WARNING:tensorflow:Value in checkpoint could not be found in the restored object: (root).optimizer's state 'accum_var' for (root).layer_with_weights-7.w
WARNING:tensorflow:Value in checkpoint could not be found in the restored object: (root).optimizer's state 'accum_var' for (root).layer_with_weights-7.b
WARNING:tensorflow:Value in checkpoint could not be found in the restored object: (root).optimizer's state 'accum_var' for (root).layer_with_weights-7.b
WARNING:tensorflow:Value in checkpoint could not be found in the restored object: (root).optimizer's state 'accum_var' for (root).layer_with_weights-8.gamma
WARNING:tensorflow:Value in checkpoint could not be found in the restored object: (root).optimizer's state 'accum_var' for (root).layer_with_weights-8.gamma
WARNING:tensorflow:Value in checkpoint could not be found in the restored object: (root).optimizer's state 'accum_var' for (root).layer_with_weights-8.beta
WARNING:tensorflow:Value in checkpoint could not be found in the restored object: (root).optimizer's state 'accum_var' for (root).layer_with_weights-8.beta
WARNING:tensorflow:Value in checkpoint could not be found in the restored object: (root).optimizer's state 'accum_var' for (root).layer_with_weights-9.w
WARNING:tensorflow:Value in checkpoint could not be found in the restored object: (root).optimizer's state 'accum_var' for (root).layer_with_weights-9.w
WARNING:tensorflow:Value in checkpoint could not be found in the restored object: (root).optimizer's state 'accum_var' for (root).layer_with_weights-9.b
WARNING:tensorflow:Value in checkpoint could not be found in the restored object: (root).optimizer's state 'accum_var' for (root).layer_with_weights-9.b
WARNING:tensorflow:Value in checkpoint could not be found in the restored object: (root).optimizer's state 'accum_var' for (root).layer_with_weights-10.gamma
WARNING:tensorflow:Value in checkpoint could not be found in the restored object: (root).optimizer's state 'accum_var' for (root).layer_with_weights-10.gamma
WARNING:tensorflow:Value in checkpoint could not be found in the restored object: (root).optimizer's state 'accum_var' for (root).layer_with_weights-10.beta
WARNING:tensorflow:Value in checkpoint could not be found in the restored object: (root).optimizer's state 'accum_var' for (root).layer_with_weights-10.beta
WARNING:tensorflow:Value in checkpoint could not be found in the restored object: (root).optimizer's state 'accum_var' for (root).layer_with_weights-11.w
WARNING:tensorflow:Value in checkpoint could not be found in the restored object: (root).optimizer's state 'accum_var' for (root).layer_with_weights-11.w
WARNING:tensorflow:Value in checkpoint could not be found in the restored object: (root).optimizer's state 'accum_var' for (root).layer_with_weights-11.b
WARNING:tensorflow:Value in checkpoint could not be found in the restored object: (root).optimizer's state 'accum_var' for (root).layer_with_weights-11.b

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions