Spaces:
Sleeping
Sleeping
Update detree/utils/index.py
Browse files- detree/utils/index.py +1 -5
detree/utils/index.py
CHANGED
|
@@ -32,13 +32,9 @@ class Indexer(object):
|
|
| 32 |
def _create_sharded_index(self):
|
| 33 |
# Determine the number of available GPUs
|
| 34 |
ngpu = faiss.get_num_gpus()
|
| 35 |
-
|
| 36 |
-
# If no GPUs available, use CPU index
|
| 37 |
if ngpu == 0:
|
| 38 |
-
|
| 39 |
return faiss.IndexFlatIP(self.vector_sz)
|
| 40 |
-
|
| 41 |
-
|
| 42 |
# Create an IndexShards object with successive_ids=True to keep ids globally unique
|
| 43 |
index = faiss.IndexShards(self.vector_sz, True, True)
|
| 44 |
# Create a sub-index for each GPU and add it to the IndexShards container
|
|
|
|
| 32 |
def _create_sharded_index(self):
|
| 33 |
# Determine the number of available GPUs
|
| 34 |
ngpu = faiss.get_num_gpus()
|
|
|
|
|
|
|
| 35 |
if ngpu == 0:
|
| 36 |
+
# No GPUs available — use a CPU flat inner-product index
|
| 37 |
return faiss.IndexFlatIP(self.vector_sz)
|
|
|
|
|
|
|
| 38 |
# Create an IndexShards object with successive_ids=True to keep ids globally unique
|
| 39 |
index = faiss.IndexShards(self.vector_sz, True, True)
|
| 40 |
# Create a sub-index for each GPU and add it to the IndexShards container
|