Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SONAR installation issue on colab and kaggle #49

Open
nitishpandey04 opened this issue Dec 12, 2024 · 6 comments
Open

SONAR installation issue on colab and kaggle #49

nitishpandey04 opened this issue Dec 12, 2024 · 6 comments

Comments

@nitishpandey04
Copy link

I am following the installation instructions given here. But running pip install sonar-space is overwriting the specific pytorch implementation I have installed following the set of variants given here.

That is the reason fairseq2 is not working afterwords I guess, because sonar-space is overwriting the pytorch version other than what is required according to the variants table of fairseq2.

Please help, how to install SONAR in cloud notebooks like colab and kaggle?

@nitishpandey04
Copy link
Author

Reproduce on Kaggle CPU notebook:

pip install sonar-space

Run imports:
from sonar.inference_pipelines.text import TextToEmbeddingModelPipeline
from sonar.models.blaser.loader import load_blaser_model

Throws error:
No moduled named fairseq2

Install fairseq2 on CPU:
!pip install fairseq2 --extra-index-url https://fair.pkg.atmeta.com/fairseq2/whl/pt2.4.0/cpu

Run imports again:
from sonar.inference_pipelines.text import TextToEmbeddingModelPipeline
from sonar.models.blaser.loader import load_blaser_model

Throws error:
ImportError: cannot import name 'default_asset_store' from 'fairseq2.assets' (/opt/conda/lib/python3.10/site-packages/fairseq2/assets/__init__.py)

how to resolve? I am following the recommended installation instructions given at github repos of sonar and fairseq2

@t1waz
Copy link

t1waz commented Dec 15, 2024

pls resolve, same for me

@elbayadm
Copy link

Hi, @nitishpandey04, @t1waz!
As of #47 SONAR depends on fairseq2 0.3.0 rc1.
With Pytorch 2.5.1 and a variant from cpu, cu118, cu121 or cu124:

variant=cpu
pip install torch==2.5.1 --extra-index-url https://download.pytorch.org/whl/${variant}
pip install fairseq2==v0.3.0rc1 --pre --extra-index-url  https://fair.pkg.atmeta.com/fairseq2/whl/rc/pt2.5.1/${variant}

Then pip install sonar-space.

If you prefer another version of Pytorch, then I believe all of the versions in the HEAD section here are available in 0.3.0 rc1; simply change to something like:

pip install torch==2.3.0 --extra-index-url https://download.pytorch.org/whl/cpu
pip install fairseq2==v0.3.0rc1 --pre --extra-index-url  https://fair.pkg.atmeta.com/fairseq2/whl/rc/pt2.3.0/cpu

@t1waz
Copy link

t1waz commented Dec 15, 2024

@elbayadm, just checked the CPU variant - it's working, thanks a lot for Your help

@nitishpandey04
Copy link
Author

Hi @elbayadm
Thanks for your help. The second example you provided for torch version 2.3.0 is working on kaggle for CPU.
But I want to run it on GPU as I have an HPC with 3 a40 gpus with nvidia-smi showing CUDA Version: 12.2.

I am trying to run on GPU of Kaggle first, then I plan to replicate the process in my GPU with a different Cuda version.

So, when I try on Kaggle GPU, this is happening - kaggle notebook link

Can you please clarity how to install it on GPU variants?

And one more doubt is that the cuda variants mentioned in this are cu118, cu121 or cu124 only. Kaggle P100 has 12.6 and my HPC has 12.2. How do I install it for cuda versions other than 11.8, 12.1 and 12.4?

@elbayadm
Copy link

Hi @nitishpandey04!

It looks like it was an issue with reading the variable ${variant}, this works for me
kaggle notebook

PyTorch binaries ship with their own CUDA runtime, so you shouldn't worry about your machine's nvcc version as long as your GPU is compatible with the variant you select. In your case, A40 GPU is compatible with CUDA version 11.x and above.
It's recommended to choose the latest CUDA version available.

@elbayadm elbayadm reopened this Dec 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants