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