Я пытаюсь создать модель для генерации телевизионного сценария, и при запуске следующей модели возникает ошибка входного слоя и слоя внедрения.Я попытался запустить модель без этих двух линий, и она отлично работает.Может кто-нибудь, пожалуйста, помогите мне с ошибкой?
embedding = 300
lstm_size = 128
vocab_size = len(vocab) #8420
seq_len = 100
model = Sequential()
model.add(Input((None, )))
model.add(Embedding(inp, input_dim = vocab_size, output_dim = embedding,
input_length = 1000))
model.add(LSTM(lstm_size, return_sequences = True, return_state = True))
model.add(LSTM(lstm_size, return_sequences = True, return_state = True))
model.add(LSTM(lstm_size, return_sequences = True, return_state = True))
model.add(Flatten())
model.add(Dense(vocab_size))
TypeError Traceback (most recent call last)
<ipython-input-66-695a9250515c> in <module>
19 #model = Model(inp, out)
20 model = Sequential()
---> 21 model.add(Input((None, )))
22 model.add(Embedding(inp, input_dim = vocab_size, output_dim = embedding, input_length = 1000))
23 model.add(LSTM(lstm_size, return_sequences = True, return_state = True))
~\Anaconda3\lib\site-packages\tensorflow\python\training\checkpointable\base.py in _method_wrapper(self, *args, **kwargs)
440 self._setattr_tracking = False # pylint: disable=protected-access
441 try:
--> 442 method(self, *args, **kwargs)
443 finally:
444 self._setattr_tracking = previous_value # pylint: disable=protected-access
~\Anaconda3\lib\site- packages\tensorflow\python\keras\engine\sequential.py in add(self, layer)
143 raise TypeError('The added layer must be '
144 'an instance of class Layer. '
--> 145 'Found: ' + str(layer))
146 self.built = False
147 set_inputs = False
TypeError: The added layer must be an instance of class Layer. Found: Tensor("input_37:0", shape=(?, ?), dtype=float32)
This is coming for the Input layer
and,
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-67-3c663f8df357> in <module>
20 model = Sequential()
21 #model.add(Input((None, )))
---> 22 model.add(Embedding(inp, input_dim = vocab_size, output_dim = embedding, input_length = 1000))
23 model.add(LSTM(lstm_size, return_sequences = True, return_state = True))
24 model.add(LSTM(lstm_size, return_sequences = True, return_state = True))
TypeError: __init__() got multiple values for argument 'input_dim'
this comes for embedding layer.