File tree Expand file tree Collapse file tree
FlagEmbedding/abc/evaluation Expand file tree Collapse file tree Original file line number Diff line number Diff 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 )
Original file line number Diff line number Diff line change @@ -131,6 +131,8 @@ Here is an example for evaluation:
131131
132132``` shell
133133pip install beir
134+ mkdir eval_beir
135+ cd eavl_beir
134136```
135137
136138``` shell
You can’t perform that action at this time.
0 commit comments