Spaces:
Paused
Paused
File size: 376 Bytes
50b2d56 |
1 2 3 4 5 6 7 8 9 10 11 |
from sentence_transformers import SentenceTransformer
from chromadb import Documents, Embeddings, EmbeddingFunction
class CustomEmbeddingFunction(EmbeddingFunction):
def __call__(self, text_chunks: Documents) -> Embeddings:
embedding_model = SentenceTransformer(
model_name_or_path="all-mpnet-base-v2",
device="cpu",
)
return embedding_model.encode(text_chunks) |