Update index.py
This commit is contained in:
parent
89d167a2f8
commit
50042f6655
4
index.py
4
index.py
@ -98,7 +98,9 @@ def main():
|
||||
)
|
||||
|
||||
model = BGEM3FlagModel(MODEL_NAME, device="cpu")
|
||||
emb = model.encode(new_docs, batch_size=BATCH, return_dict=False)
|
||||
emb_out = model.encode(new_docs, batch_size=BATCH)
|
||||
# FlagEmbedding renvoie soit un ndarray, soit un dict {"embedding": …}
|
||||
emb = emb_out["embedding"] if isinstance(emb_out, dict) else emb_out
|
||||
emb = emb.astype("float32")
|
||||
emb /= np.linalg.norm(emb, axis=1, keepdims=True) + 1e-12
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user