modulenot found 'keras.layer.embeddings'我不知道如何解决这个问题,即使我正确安装了keras

zz2j4svz  于 2023-03-23  发布在  其他
关注(0)|答案(1)|浏览(396)
import pandas as pd
import numpy as np

import matplotlib.pyplot as plt
 import seaborn as sns
%matplotlib inline
from wordcloud import WordCloud

from bs4 import BeautifulSoup  
import re
import nltk
from nltk.corpus import stopwords 
from nltk.stem.porter import PorterStemmer
from nltk.stem import SnowballStemmer, WordNetLemmatizer
from nltk import sent_tokenize, word_tokenize, pos_tag

from keras.preprocessing import sequence
from keras.utils import np_utils
from keras.models import Sequential
from keras.layers.core import Dense, Dropout, Activation, Lambda
from keras.layers.embeddings import Embedding
from keras.layers.recurrent import LSTM, SimpleRNN, GRU
from keras.preprocessing.text import Tokenizer
from collections import defaultdict
from keras.layers.convolutional import Convolution1D
from keras import backend as K
from keras.layers.embeddings import Embedding
ModuleNotFoundError                       Traceback (most recent call last)
Cell In[6], line 37
 35 from keras.models import Sequential
 36 from keras.layers.core import Dense, Dropout, Activation, Lambda
---> 37 from keras.layers.embeddings import Embedding
 38 from keras.layers.recurrent import LSTM, SimpleRNN, GRU
 39 from keras.preprocessing.text import Tokenizer

ModuleNotFoundError: No module named 'keras.layers.embeddings'

这些错误不断出现,我不知道如何修复这个模块不fount 'keras.layers.embeddind',我尝试了互联网上的每一件事都不能解决这个问题

dgtucam1

dgtucam11#

keras.layers.embeddings.Embedding已移动到keras.layers.Embedding。您可以按以下方式更新代码:

from keras.layers import Embedding

相关问题