Commit 0e9f3312 authored by 赵威's avatar 赵威

update return type

parent a713bd45
...@@ -68,7 +68,7 @@ def save_faiss_index(load_file, save_path): ...@@ -68,7 +68,7 @@ def save_faiss_index(load_file, save_path):
ids_np = np.array(ids).astype("int") ids_np = np.array(ids).astype("int")
features_np = np.array(features).astype("float32") features_np = np.array(features).astype("float32")
index = faiss.IndexHNSWFlat(128, 32) index = faiss.IndexHNSWFlat(128, 32)
print("trained: " + index.is_trained) print("trained: " + str(index.is_trained))
index2 = faiss.IndexIDMap(index) index2 = faiss.IndexIDMap(index)
index2.add_with_ids(features_np, ids_np) index2.add_with_ids(features_np, ids_np)
faiss.write_index(index2, save_path) faiss.write_index(index2, save_path)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment