[英]AttributeError: module 'tensorflow.keras.models' has no attribute 'experimental'
I am attempting to use the tf.keras.models.experimental.SharpnessAwareMinimization
class from tf-nightly.我正在尝试使用 tf-nightly 中的
tf.keras.models.experimental.SharpnessAwareMinimization
class。 I installed tf-nightly with pip install tf-nightly
and tf-nightly-gpu with pip install tf-nightly-gpu
.我用
pip install tf-nightly
和 tf-nightly-gpu 安装了pip install tf-nightly-gpu
。
Then, I import tensorflow with import tensorflow as tf
.然后,我将 tensorflow
import tensorflow as tf
。 May I know how to proceed from here?我可以知道如何从这里开始吗?
tf.__vesion__
is 2.9.1 tf.__vesion__
是 2.9.1
I am able to run this code and import SharpnessAwareMinimization
api successfully and it shows below tensorflow version:我能够运行此代码并成功导入
SharpnessAwareMinimization
api,它显示以下 tensorflow 版本:
!pip install tf_nightly
import tensorflow as tf
tf.__version__
from tensorflow.keras.models.experimental import SharpnessAwareMinimization
Output: (I got the same output in Google colab
and Jupyter notebook
) Output:(我在
Google colab
和Jupyter notebook
中得到了相同的 output)
2.11.0-dev20220806
Please run this code again !pip install tf_nightly
and retstart the kernel (runtime).请再次运行此代码
!pip install tf_nightly
并重新启动 kernel(运行时)。 Check again the tensorflow version and let us know if the issue still persists.再次检查 tensorflow 版本,如果问题仍然存在,请告知我们。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.