MCPcopy Create free account
hub / github.com/AQ-MedAI/MedMemoryBench / __init__

Method __init__

methods/embedding_rag.py:15–26  ·  view source on GitHub ↗
(self, model_name: str)

Source from the content-addressed store, hash-verified

13 """Base class for local embedding models with mean pooling."""
14
15 def __init__(self, model_name: str):
16 import torch
17 from transformers import AutoTokenizer, AutoModel
18 import torch.nn.functional as F
19
20 self.torch = torch
21 self.F = F
22
23 logger.info(f"[Embedding] Loading model: {model_name}")
24 self.tokenizer = AutoTokenizer.from_pretrained(model_name)
25 self.model = AutoModel.from_pretrained(model_name, device_map="auto")
26 self.model.eval()
27
28 def _get_embedding(self, outputs, attention_mask):
29 """Override in subclass for different pooling strategies."""

Callers

nothing calls this directly

Calls 1

infoMethod · 0.65

Tested by

no test coverage detected