导入错误:无法从部分初始化的模块“keras.saving.legacy.serialization”中导入名称“currentalize_keras_object”

mzmfm0qo  于 2023-10-19  发布在  其他
关注(0)|答案(1)|浏览(136)

我的代码有问题,需要帮助来解决。TensorFlow 2.12.0版

import tensorflow as tf

(train_image, train_labels), (test_image, test_labels) = tf.keras.datasets.mnist.load_data()

我有:

ImportError: cannot import name 'deserialize_keras_object' from partially initialized module 'keras.saving.legacy.serialization' (most likely due to a circular import) (/home/jude/anaconda3/envs/tf/lib/python3.11/site-packages/keras/saving/legacy/serialization.py)

这是什么,我如何解决这个问题?

lmvvr0a8

lmvvr0a81#

pip uninstall tensorflow
pip install tensorflow==2.12.0

from tensorflow.keras.datasets import mnist
(train_image, train_labels), (test_image, test_labels) = mnist.load_data()

相关问题