报错:
![[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-f0V1709r-1669958938904)](https://img-blog.csdnimg.cn/c9a545dda8cd41ea91726852ab85fd1c.png)
报错说是 没有名为’keras.layers.embeddings’的模块。
解决方法:
- 首先查看原始目录embeddings在哪里
![在这里插入图片描述](https://img-blog.csdnimg.cn/900c243b5d3e4c008bd5598e84b22fac.png)
我们发现embeddings存放在tensorflow下的python下的keras下的layers当中
所以当我们导入的时候就需要
把
from keras.layers.embeddings import Embedding
改为
from tensorflow.python.keras.layers.embeddings import Embedding
结果如下:
![在这里插入图片描述](https://img-blog.csdnimg.cn/7237979da5454ac98dbe75d0686ba19e.png)
成功解决!!!