Sentence Similarity
sentence-transformers
PyTorch
Transformers
English
t5
text-embedding
embeddings
information-retrieval
beir
text-classification
language-model
text-clustering
text-semantic-similarity
text-evaluation
prompt-retrieval
text-reranking
feature-extraction
English
Sentence Similarity
natural_questions
ms_marco
fever
hotpot_qa
mteb
Eval Results
Inference Endpoints
File size: 591 Bytes
98c2017 41c2439 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
from typing import Dict, List, Any
from InstructorEmbedding import INSTRUCTOR
class EndpointHandler():
def __init__(self, path=""):
self.model = INSTRUCTOR(path)
def __call__(self, data: Dict[str, Any]) -> List[Dict[str, Any]]:
instruction = data.get("instruction", "")
document = data.get("document", "")
embedding = self.model.encode([[instruction, document]]).flatten()
return [
{
"embedding": embedding,
"instruction": instruction,
"document": document
}
] |