MCPcopy Create free account
hub / github.com/Agent-RL/ReCall / __init__

Method __init__

src/flashrag/retriever/encoder.py:104–115  ·  view source on GitHub ↗
(self, model_name, model_path, max_length, use_fp16, instruction)

Source from the content-addressed store, hash-verified

102 """
103
104 def __init__(self, model_name, model_path, max_length, use_fp16, instruction):
105 import torch
106 from sentence_transformers import SentenceTransformer
107
108 self.model_name = model_name
109 self.model_path = model_path
110 self.max_length = max_length
111 self.use_fp16 = use_fp16
112 self.instruction = instruction
113 self.model = SentenceTransformer(
114 model_path, trust_remote_code=True, model_kwargs={"torch_dtype": torch.float16 if use_fp16 else torch.float}
115 )
116
117 @torch.inference_mode()
118 def encode(self, query_list: Union[List[str], str], batch_size=64, is_query=True) -> np.ndarray:

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected