Getting sentence embeddings with sentence_transformers I have a text column in my data frame which contains paragraph(s) having multiple and variable sentences in each instance/example/row of the dataframe. Then, I created the sentence tokens of that paragraph using sent_tokenizer of nltk and put it into another column.
So my data frame looks like this:
index       text                                              class

0           [&quot;Hello i live in berlin&quot;, 'I'm xxx']                                                          1
1           [&quot;My name is xx&quot;, &quot;I have a cat&quot;, &quot;Love is life&quot;]                                              0

now when I'm using:
from sentence_transformers import SentenceTransformer
model = SentenceTransformer('distilbert-base-nli-stsb-mean-tokens')
sentences = df['text']
sentences = sentences.tolist()
embeddings = model.encode(sentences)

I'm getting:
TypeError: expected string or bytes-like object

The encode  method is not taking a list of list of sentences as an argument.
The encode method only works with single sentences as strings, i.e., you need to call it for each sentence independently:
embeddings = [model.encode(s) for s in sentences]