Skip to content

Get build error for: decoder = keras.Model([decoder_inputs, encoded_seq_inputs], decoder_outputs) (keras Version: 3.10.0) #2175

@alrahimi

Description

@alrahimi

An issue with English-to-Spanish translation with a sequence-to-sequence Transformer:
https://keras.io/examples/nlp/neural_machine_translation_with_transformer

Section:
Next, we assemble the end-to-end model.

Statement:
decoder = keras.Model([decoder_inputs, encoded_seq_inputs], decoder_outputs)

build error:
ValueError: inputs not connected to outputs

I had built and tested English-to-Spanish translation successfully with no change except for the location of the input files
Then I used the latest version of TF and keras:
TensorFlow Version: 2.19.0
keras Version: 3.10.0
And got the error above

My fix:
I just removed the encoded_seq_inputs arguments from the keras.Model in the above for now!:

Define the decoder model with only the decoder_inputs

decoder = keras.Model(decoder_inputs, decoder_outputs)

Seems to work
Regards

Example of exception when building:
ValueError Traceback (most recent call last)
/tmp/ipython-input-2933432692.py in <cell line: 0>()
16 #AR got error:encoded_seq_inputs was not connected to the outputs
17 #decoder = keras.Model([decoder_inputs, encoded_seq_inputs], decoder_outputs)
---> 18 decoder = keras.Model([decoder_inputs,encoded_seq_inputs], decoder_outputs)
19 print(decoder.summary())
20

2 frames
/usr/local/lib/python3.12/dist-packages/keras/src/ops/function.py in init(self, inputs, outputs, name)
87 and not input._keras_history.operation._outbound_nodes
88 ):
---> 89 raise ValueError("inputs not connected to outputs")
90
91 @Property

ValueError: inputs not connected to outputs

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions