Skip to content

The embedding is called twice #44

@Chen-Zile12

Description

@Chen-Zile12

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions