是否可以将从 SentenceTransformer 派生的句子表示解码回句子?
请参阅文档中的示例
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)
我想解码表示以获得句子
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'