Update index.py

This commit is contained in:
Stéphan Peccini 2025-05-18 18:17:13 +02:00
parent 58f7cbf669
commit 96a083fd72

View File

@ -47,7 +47,7 @@ def main():
print(f"Découpé {len(docs)} passages, génération des embeddings…") print(f"Découpé {len(docs)} passages, génération des embeddings…")
model = BGEM3FlagModel(MODEL_NAME, device="cpu") model = BGEM3FlagModel(MODEL_NAME, device="cpu")
emb = model.encode(docs, batch_size=64, normalize_embeddings=True) emb = model.encode(docs, batch_size=64, normalize=True)
index = faiss.IndexFlatIP(emb.shape[1]) index = faiss.IndexFlatIP(emb.shape[1])
index.add(emb.astype("float32")) index.add(emb.astype("float32"))