Skip to content

Commit b303f7c

Browse files
committed
Merge branch 'new-flagembedding-v1' of github.com:hanhainebula/FlagEmbedding into new-flagembedding-v1
2 parents c65b55b + 2e90c41 commit b303f7c

2 files changed

Lines changed: 9 additions & 4 deletions

File tree

FlagEmbedding/abc/evaluation/utils.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,10 +102,13 @@ def index(
102102
faiss_index = faiss.index_factory(corpus_embeddings.shape[-1], index_factory, faiss.METRIC_INNER_PRODUCT)
103103

104104
if device is None and torch.cuda.is_available():
105-
co = faiss.GpuMultipleClonerOptions()
106-
co.shard = True
107-
co.useFloat16 = True
108-
faiss_index = faiss.index_cpu_to_all_gpus(faiss_index, co)
105+
try:
106+
co = faiss.GpuMultipleClonerOptions()
107+
co.shard = True
108+
co.useFloat16 = True
109+
faiss_index = faiss.index_cpu_to_all_gpus(faiss_index, co)
110+
except:
111+
print('faiss do not support GPU, please uninstall faiss-cpu, faiss-gpu and install faiss-gpu again.')
109112

110113
logger.info('Adding embeddings ...')
111114
corpus_embeddings = corpus_embeddings.astype(np.float32)

examples/evaluation/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,8 @@ Here is an example for evaluation:
131131

132132
```shell
133133
pip install beir
134+
mkdir eval_beir
135+
cd eavl_beir
134136
```
135137

136138
```shell

0 commit comments

Comments
 (0)