File size: 292 Bytes
b19a023
6e6e517
 
b19a023
 
 
 
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]