castorini / pygaggle

a gaggle of deep neural architectures for text ranking and question answering, designed for Pyserini
http://pygaggle.ai/
Apache License 2.0
340 stars 100 forks source link

JSimpleSearcherResult import problem #284

Open galuscakova opened 2 years ago

galuscakova commented 2 years ago

I am trying to run T5 reranking using Pygaggle and these instructions: https://github.com/castorini/pygaggle and I am getting a following error:

2022-06-07 17:35:05 [INFO] loader: Loading faiss with AVX2 support.
2022-06-07 17:35:05 [INFO] loader: Could not load library with AVX2 support due to:
ModuleNotFoundError("No module named 'faiss.swigfaiss_avx2'")
2022-06-07 17:35:05 [INFO] loader: Loading faiss.
2022-06-07 17:35:06 [INFO] loader: Successfully loaded faiss.
Traceback (most recent call last):
  File "/usr/lib/python3.7/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/data1/home/mrim/galuscap/tools/environments/reranking/.reranking/lib/python3.7/site-packages/pygaggle/run/evaluate_document_ranker.py", line 11, in <module>
    from pygaggle.rerank.base import Reranker
  File "/data1/home/mrim/galuscap/tools/environments/reranking/.reranking/lib/python3.7/site-packages/pygaggle/rerank/base.py", line 4, in <module>
    from pyserini.search import JSimpleSearcherResult
ImportError: cannot import name 'JSimpleSearcherResult' from 'pyserini.search' (/data1/home/mrim/galuscap/tools/environments/reranking/.reranking/lib/python3.7/site-packages/pyserini/search/__init__.py)

I guess it is a problem in the mismatch between Pygaggle and Pyserini versions? At least, I was able to get this running by using older Pyserini version. However, that version, didn't seem to support the latest models such as MSMARCO v2 trained models. Is there please any other way how to fix this?

manveertamber commented 2 years ago

Could you confirm the pyserini version you have installed with which you got it running? You can check using pip list.

galuscakova commented 2 years ago

Sure, I am running the pyserini version 0.17.0 and pygaggle version 0.0.3.1.

manveertamber commented 2 years ago

So you were able to get it running with Pyserini version 0.17.0? That is the latest version. I was just able to run T5 reranking from the README with Pyserini 0.17.0 myself.

manveertamber commented 2 years ago

@galuscakova I think I see your problem. Make sure to install pygaggle using https://github.com/castorini/pygaggle#additional-instructions instead of pip install. Does that help?

galuscakova commented 2 years ago

Yes, this helped. Thank you for such a fast help!