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

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. #6

Open
fazhang-master opened this issue Dec 4, 2023 · 0 comments

Comments

@fazhang-master
Copy link

I:\conda\envs\KM\python.exe F:\desktop\demo\Kcat生物信息\KM_prediction_function\KM_prediction_function-main\code\km_pre.py
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-12-04 13:18:02.722695: 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 24, 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 28, 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 44, in loading_GNN
model.load_weights('F:\desktop\demo\Kcat生物信息\KM_prediction_function\KM_prediction_function-main\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

Process finished with exit code 1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant