![](/img/trans.png)
[英]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.