Downloads · 30 days
57
1% of all-time downloads
mm/japanese-e5-mistral-7b_slerp_gguf
japanese-e5-mistral-7b_slerp_gguf is a machine learning model from mm. Use it for the machine learning task on the model card, and read the license before you ship it in a product. The card lists the license as mit.
GGUF conversion of oshizo/japanese-e5-mistral-7bslerp
Downloads · 30 days
57
1% of all-time downloads
All-time downloads
4.9K
Public
Repo size
43.9 GB
Likes
0
Public
Click a slice to open those files.
.gguf43.9 GB · 100%
From the Hugging Face model README
GGUF conversion of oshizo/japanese-e5-mistral-7b_slerp
Avaiable formats:
Requires: llama-cpp-python
from functools import partial
import numpy as np
from llama_cpp import Llama
max_length = 512
model = Llama.from_pretrained(
repo_id="mm/japanese-e5-mistral-7b_slerp_gguf",
filename="*Q4_K.gguf", # Choose from the avaiable formats,
embedding=True,
n_ctx=max_length,
n_batch=max_length,
verbose=False,
)
model.tokenize = partial(model.tokenize, special=True)
def calc_emb(s: str):
if len(model.tokenize(s.encode())) > max_length - 1:
print(
"The output will be calculated with truncation because of the length exceeding."
)
v = model.embed(s + "</s>", normalize=True, truncate=True)
return np.asarray(v[-1])
s = "今日の天気は?"
t = "本日の天候は?"
print(f"cossim({s}, {t}) = {(calc_emb(s) * calc_emb(t)).sum()}")