AnswerDotAI / RAGatouille

Easily use and train state of the art late-interaction retrieval methods (ColBERT) in any RAG pipeline. Designed for modularity and ease-of-use, backed by research.
Apache License 2.0
3.09k stars 210 forks source link

faiss-cpu faiss-gpu issue #184

Open jmnian opened 8 months ago

jmnian commented 8 months ago

I encountered this issue when I was trying to index colbert-ir/colbertv2.0:

WARNING! You have a GPU available, but onlyfaiss-cpuis currently installed. This means that indexing will be slow. To make use of your GPU. Please installfaiss-gpuby running: pip uninstall --y faiss-cpu & pip install faiss-gpu

I then run the pip command to uninstall faiss-cpu and install faiss-gpu. Then I got module not found:

File "/WAVE/users/unix/jnian/.local/lib/python3.9/site-packages/ragatouille/models/colbert.py", line 313, in index import faiss ModuleNotFoundError: No module named 'faiss'

bclavie commented 7 months ago

Hey, thank you for flagging!

There seems to be a lot of these issues with faiss and faiss-gpu on PyPi. The root issue being that the latest faiss-gpu wheels on there are aging and not well supported anymore.

The only surefire workaround currently seems to be to make sure they're all uninstalled (pip uninstall faiss-cpu pip uninstall faiss pip uninstall faiss-gpu until there's nothing to uninstall) and then installing faiss-gpu with one of the two officially supported ways: either building from source or installing via conda, as detailed here.

We're looking on transitioning further and further away from faiss due to those quirks and many others, but right now I'm afraid I can't provide a better solution!

HugoCS2002 commented 5 months ago

Does this problem still exist?

abdelkareemkobo commented 3 months ago

Does this problem still exist?

It's still existing. I faced it today and solved with remove all faiss version and install the conda one from the official repo:

# CPU-only version
$ conda install -c pytorch faiss-cpu=1.8.0

# GPU(+CPU) version
$ conda install -c pytorch -c nvidia faiss-gpu=1.8.0

# GPU(+CPU) version with NVIDIA RAFT
$ conda install -c pytorch -c nvidia -c rapidsai -c conda-forge faiss-gpu-raft=1.8.0