-
Notifications
You must be signed in to change notification settings - Fork 94
The embedding is called twice #44
Copy link
Copy link
Open
Description
AutoSchemaKG\atlas_rag\vectorstore\create_graph_index.py
def compute_text_embeddings(text_list, sentence_encoder: BaseEmbeddingModel, batch_size = 40, normalize_embeddings: bool = False):
"""Separated text embedding computation"""
text_embeddings = []
for i in tqdm(range(0, len(text_list), batch_size), desc="Encoding texts"):
batch = text_list[i:i + batch_size]
**embeddings = sentence_encoder.encode(batch, normalize_embeddings=normalize_embeddings)**
if isinstance(embeddings, torch.Tensor):
embeddings = embeddings.cpu().numpy()
**text_embeddings.extend(sentence_encoder.encode(batch, normalize_embeddings = normalize_embeddings))**
return text_embeddings
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels