Decode sentence representation derived from SentenceTransformer

Viewed 308

Is it possible to decode a sentence representation derived from SentenceTransformer back to a sentence?

See example from the documentation

from sentence_transformers import SentenceTransformer
model = SentenceTransformer('paraphrase-MiniLM-L6-v2')

#Our sentences we like to encode
sentences = ['This framework generates embeddings for each input sentence',
    'Sentences are passed as a list of string.',
    'The quick brown fox jumps over the lazy dog.']

#Sentences are encoded by calling model.encode()
embeddings = model.encode(sentences)

i would like to decode the representation to get the sentence

embedding = [[-1.76214352e-01  1.20600984e-01 -2.93624014e-01 -2.29858071e-01
  -8.22928399e-02  2.37709314e-01  ... 3.39985073e-0]]
sentence = model.decode(embedding)
print(sentence)
'This framework generates embeddings for each input sentence'
0 Answers
Related