gives error ---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
in
1 # Convert src_sequences and tgt_sequences to tensors
2 src_sequences = tf.convert_to_tensor(src_sequences)
----> 3 tgt_sequences = tf.convert_to_tensor(tgt_sequences)
4
5 # Create a dataset object for the preprocessed data
1 frames
/usr/local/lib/python3.8/dist-packages/tensorflow/python/framework/constant_op.py in convert_to_eager_tensor(value, ctx, dtype)
100 dtype = dtypes.as_dtype(dtype).as_datatype_enum
101 ctx.ensure_initialized()
→ 102 return ops.EagerTensor(value, ctx.device_name code
import tensorflow as tf from tensorflow.python.keras.layers import Embedding, LSTM, Dense, Attention from tensorflow.python.keras.models import Sequential src_texts = ['this is a test', 'how are you today'] tgt_texts = ['ceci est un test', 'comment vas-tu aujourd hui'] src_tokenizer = tf.keras.preprocessing.text.Tokenizer() src_tokenizer.fit_on_texts(src_texts) src_sequences = src_tokenizer.texts_to_sequences(src_texts) tgt_tokenizer = tf.keras.preprocessing.text.Tokenizer() tgt_tokenizer.fit_on_texts(tgt_texts) tgt_sequences = tgt_tokenizer.texts_to_sequences(tgt_texts)
src_vocab_size = len(src_tokenizer.word_index) + 1 tgt_vocab_size = len(tgt_tokenizer.word_index) + 1
src_sequences = tf.convert_to_tensor(src_sequences)
tgt_sequences = tf.convert_to_tensor(tgt_sequences)
dataset = tf.data.Dataset.from_tensor_slices((src_sequences, tgt_sequences)).batch(1)
the error retuerned from here.
what’s wrong? please help me…
i’m beginner for this and 14years old.
sorry for bad english…