embeddings-api / model.py
lwdgit's picture
initial commit
597fe90
raw
history blame
292 Bytes
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]