File size: 292 Bytes
597fe90
 
 
 
 
 
 
1
2
3
4
5
6
7
8
from sentence_transformers import SentenceTransformer
model = SentenceTransformer('moka-ai/m3e-base')
# model = SentenceTransformer('nghuyong/ernie-3.0-base-zh')

def encode(text: str):
    text = text.replace("\n", " ")
    return model.encode([text], normalize_embeddings=True).tolist()[0]