Skip to content

Commit

Permalink
Merge pull request #7 from jina-ai/fix-single-gpu
Browse files Browse the repository at this point in the history
Allow running on single gpu
  • Loading branch information
violenil authored Feb 4, 2024
2 parents ca23ee0 + 268ae85 commit 4d00b2e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion mteb/abstasks/AbsTaskRetrieval.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def evaluate(
corpus, queries, relevant_docs = self.corpus[split], self.queries[split], self.relevant_docs[split]
model = model if self.is_dres_compatible(model) else DRESModel(model)

if os.getenv("RANK", None) is None:
if os.getenv("RANK", None) is None or os.getenv("MTEB_SINGLE_GPU", "false").lower() == "true":
# Non-distributed
from beir.retrieval.search.dense import DenseRetrievalExactSearch as DRES
model = DRES(
Expand Down
2 changes: 1 addition & 1 deletion mteb/abstasks/BeIRTask.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def load_data(self, eval_splits=None, **kwargs):
USE_HF_DATASETS = False

# TODO @nouamane: move non-distributed to `HFDataLoader`
if os.getenv("RANK", None) is not None:
if os.getenv("RANK", None) is not None and os.getenv("MTEB_SINGLE_GPU", "false").lower() == "false":
if self.description["beir_name"].startswith("cqadupstack"):
raise ImportError("CQADupstack is incompatible with BEIR's HFDataLoader in a distributed setting")
from beir.datasets.data_loader_hf import HFDataLoader
Expand Down

0 comments on commit 4d00b2e

Please sign in to comment.