Sentence Similarity
sentence-transformers
PyTorch
ONNX
Safetensors
OpenVINO
xlm-roberta
mteb
Sentence Transformers
Eval Results (legacy)
text-embeddings-inference
Instructions to use Hiveurban/multilingual-e5-base with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- sentence-transformers
How to use Hiveurban/multilingual-e5-base with sentence-transformers:
from sentence_transformers import SentenceTransformer model = SentenceTransformer("Hiveurban/multilingual-e5-base") sentences = [ "The weather is lovely today.", "It's so sunny outside!", "He drove to the stadium." ] embeddings = model.encode(sentences) similarities = model.similarity(embeddings, embeddings) print(similarities.shape) # [3, 3] - Notebooks
- Google Colab
- Kaggle
File size: 495 Bytes
9d2cd90 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | import json
import numpy as np
from typing import List, Union
def input_fn(input_data, content_type):
data = json.loads(input_data)
return data['inputs']
def predict_fn(data: Union[List[str], str], model):
outputs = model(data, padding=False, truncation=True)
embeddings = [np.array(r[0]).mean(axis=0).tolist() for r in outputs]
return embeddings
def output_fn(prediction, accept):
return json.dumps(
obj={
"outputs": prediction
}
)
|