[英]AttributeError: module 'tensorflow.keras.models' has no attribute 'sequential'
[英]AttributeError: module 'tensorflow.keras.models' has no attribute 'experimental'
我正在尝试使用 tf-nightly 中的tf.keras.models.experimental.SharpnessAwareMinimization
class。 我用pip install tf-nightly
和 tf-nightly-gpu 安装了pip install tf-nightly-gpu
。
然后,我将 tensorflow import tensorflow as tf
。 我可以知道如何从这里开始吗?
tf.__vesion__
是 2.9.1
我能够运行此代码并成功导入SharpnessAwareMinimization
api,它显示以下 tensorflow 版本:
!pip install tf_nightly
import tensorflow as tf
tf.__version__
from tensorflow.keras.models.experimental import SharpnessAwareMinimization
Output:(我在Google colab
和Jupyter notebook
中得到了相同的 output)
2.11.0-dev20220806
请再次运行此代码!pip install tf_nightly
并重新启动 kernel(运行时)。 再次检查 tensorflow 版本,如果问题仍然存在,请告知我们。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.