Feature Extraction
sentence-transformers
PyTorch
ONNX
Safetensors
xlm-roberta
mteb
Sentence Transformers
sentence-similarity
Eval Results (legacy)
text-embeddings-inference
Instructions to use Hiveurban/multilingual-e5-large-pooled with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- sentence-transformers
How to use Hiveurban/multilingual-e5-large-pooled with sentence-transformers:
from sentence_transformers import SentenceTransformer model = SentenceTransformer("Hiveurban/multilingual-e5-large-pooled") 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
input_fn
Browse files- code/inference.py +6 -0
code/inference.py
CHANGED
|
@@ -1,7 +1,13 @@
|
|
|
|
|
| 1 |
import numpy as np
|
| 2 |
from typing import List, Union
|
| 3 |
|
| 4 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
def predict_fn(data: Union[List[str], str], model):
|
| 6 |
outputs = model(data, padding=False, truncation=True)
|
| 7 |
embeddings = [np.array(r[0]).mean(axis=0).tolist() for r in outputs]
|
|
|
|
| 1 |
+
import json
|
| 2 |
import numpy as np
|
| 3 |
from typing import List, Union
|
| 4 |
|
| 5 |
|
| 6 |
+
def input_fn(input_data, content_type):
|
| 7 |
+
data = json.loads(input_data)
|
| 8 |
+
return data['inputs']
|
| 9 |
+
|
| 10 |
+
|
| 11 |
def predict_fn(data: Union[List[str], str], model):
|
| 12 |
outputs = model(data, padding=False, truncation=True)
|
| 13 |
embeddings = [np.array(r[0]).mean(axis=0).tolist() for r in outputs]
|