Commit a713bd45 authored by 赵威's avatar 赵威

update np types

parent 5478c0c1
......@@ -65,14 +65,10 @@ def save_faiss_index(load_file, save_path):
ids.append(tmp[0])
features.append(np.array(json.loads(tmp[1])))
ids_np = np.array(ids).astype("float32")
features_np = np.array(features).astype("int")
print(ids_np)
print(ids.dtype)
print(features_np)
print(features_np.dtype)
index = faiss.IndexHNSW(128, 32)
print(index.is_trained)
ids_np = np.array(ids).astype("int")
features_np = np.array(features).astype("float32")
index = faiss.IndexHNSWFlat(128, 32)
print("trained: " + index.is_trained)
index2 = faiss.IndexIDMap(index)
index2.add_with_ids(features_np, ids_np)
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