13 lines
417 B
Python
13 lines
417 B
Python
from sentence_transformers import SentenceTransformer
|
|
import requests
|
|
|
|
|
|
class TextEmbedderGemma:
|
|
def __init__(self, model_path):
|
|
self.model = SentenceTransformer(model_path, trust_remote_code=True, local_files_only=True).to(device="cuda:0")
|
|
|
|
def embed_texts(self, texts:list[str])->list[list[float]]:
|
|
"""
|
|
Embed texts using the model.
|
|
"""
|
|
return self.model.encode(texts) |