-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Description
Issue Type
Bug
Source
binary
Keras Version
TensorFlow Version: 2.19.0 keras Version: 3.11.3 keras_hub Version: 0.21.1
Custom Code
No
OS Platform and Distribution
colab ubuntu
Python version
3.12.11
GPU model and memory
T4
Current Behavior?
Keras Example: English-to-Spanish translation with a sequence-to-sequence Transformer
Got error when building in decode_sequences(input_sentences):
AttributeError Traceback (most recent call last)
/tmp/ipython-input-257581123.py in <cell line: 0>()
37 for i in range(2):
38 input_sentence = random.choice(test_eng_texts)
---> 39 translated = decode_sequences([input_sentence])
40 translated = translated.numpy()[0].decode("utf-8")
41 translated = (
1 frames
/usr/local/lib/python3.12/dist-packages/tensorflow/python/framework/tensor.py in getattr(self, name)
258 tf.experimental.numpy.experimental_enable_numpy_behavior()
259 """)
--> 260 self.getattribute(name)
261
262 @Property
AttributeError: 'tensorflow.python.framework.ops.EagerTensor' object has no attribute 'to_tensor'
Standalone code to reproduce the issue or tutorial link
Just try to build the example below by clicking "view in colab" .
https://keras.io/examples/nlp/neural_machine_translation_with_keras_hub/
I built it as it is and got error for PIP install so I chhged to keras-hub==0.21.1
!pip install -q --upgrade rouge-score
!pip install -q --upgrade keras-hub==0.21.1
!pip install -q --upgrade keras # Upgrade to Keras 3.
even if I ignore the error and use keras-hub==0.22.1 I still get the same error in the decode_sequences