I'm trying to load my pandas dataframe (df) into a Tensorflow dataset with the following command:
target = df['label']
features = df['encoded_sentence']
dataset = tf.data.Dataset.from_tensor_slices((features.values, target.values))
Here's an excerpt from my pandas dataframe:
+-------+-----------------------+------------------+
| label | sentence | encoded_sentence |
+-------+-----------------------+------------------+
| 0 | Hello world | [5, 7] |
+-------+-----------------------+------------------+
| 1 | my name is john smith | [1, 9, 10, 2, 6] |
+-------+-----------------------+------------------+
| 1 | Hello! My name is | [5, 3, 9, 10] |
+-------+-----------------------+------------------+
| 0 | foo baar | [8, 4] |
+-------+-----------------------+------------------+
# df.dtypes gives me:
label int8
sentence object
encoded_sentencee object
But it keeps giving me a Value Error:
ValueError: Failed to convert a NumPy array to a Tensor (Unsupported object type list).
Can anyone tell me how to use the encoded sentences in my Tensorflow dataset? Help would be greatly appreciated!