abrah926 commited on
Commit
14a2007
Β·
verified Β·
1 Parent(s): c007e39

creating file

Browse files
Files changed (1) hide show
  1. check_faiss.py +21 -0
check_faiss.py ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import faiss
2
+
3
+ index_path = "my_embeddings" # Adjust if saved elsewhere
4
+
5
+ try:
6
+ index = faiss.read_index(index_path)
7
+ print(f"πŸ“Š FAISS index contains {index.ntotal} vectors.")
8
+
9
+ # βœ… Check embedding dimensions
10
+ d = index.d
11
+ print(f"βœ… Embedding dimension: {d}")
12
+
13
+ # βœ… Retrieve and print a few embeddings
14
+ if index.ntotal > 0:
15
+ vectors = index.reconstruct_n(0, min(5, index.ntotal)) # Get first 5 embeddings
16
+ print(f"🧐 Sample embeddings: {vectors}")
17
+ else:
18
+ print("⚠️ No embeddings found in FAISS index!")
19
+
20
+ except Exception as e:
21
+ print(f"❌ ERROR: Failed to load FAISS index - {e}")