paraphrase-xlm-r-multilingual-v1.gguf
import torch
from llama_cpp import Llama
from sentence_transformers import SentenceTransformer
from scipy.spatial.distance import cosine
model = SentenceTransformer(
"paraphrase-xlm-r-multilingual-v1",
model_kwargs={"torch_dtype": torch.float16}
)
llm = Llama.from_pretrained(
"mykor/paraphrase-xlm-r-multilingual-v1.gguf",
filename="paraphrase-xlm-r-multilingual-277M-v1-F16.gguf",
embedding=True,
verbose=False,
)
text = "์์ธ ๋ฌ๋ ์ด๊นจ๋ฅผ ๋ฐ๋ผ์ ๋ค์ ์ ๋ฌผ์ด๊ฐ๋ ์ค๋์ ๋ ๋ฐค์ด ์กฐ์ฉํ ๋๋ฅผ ์์ผ๋ฉด ๋ฌด๋์ ธ๊ฐ๋ ๋ ์์ด๋ฒ๋ฆด ์ ์์ด"
embed1 = model.encode(text)
embed2 = llm.embed(text)
print(cosine(embed1, embed2))
9.908465917951581e-05