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

Error while running example of creating embeddings #255

Open
ZeyadAttia5 opened this issue Sep 30, 2024 · 0 comments
Open

Error while running example of creating embeddings #255

ZeyadAttia5 opened this issue Sep 30, 2024 · 0 comments

Comments

@ZeyadAttia5
Copy link

Issue: Error while running example of creating embeddings

Description

I encountered an error when attempting to run the example of creating embeddings on the official repository. The output and stack trace are provided below.

Error Output

Traceback (most recent call last):
  File "/run/media/zoz/New Volume/repos/testColbert/.venv/lib64/python3.12/site-packages/torch/utils/cpp_extension.py", line 2105, in _run_ninja_build
    subprocess.run(
  File "/usr/lib64/python3.12/subprocess.py", line 571, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['ninja', '-v']' returned non-zero exit status 1.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/run/media/zoz/New Volume/repos/testColbert/test.py", line 26, in <module>
    main()
  File "/run/media/zoz/New Volume/repos/testColbert/test.py", line 16, in main
    RAG = RAGPretrainedModel.from_pretrained("colbert-ir/colbertv2.0")
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/run/media/zoz/New Volume/repos/testColbert/.venv/lib64/python3.12/site-packages/ragatouille/RAGPretrainedModel.py", line 71, in from_pretrained
    instance.model = ColBERT(
                     ^^^^^^^^
  File "/run/media/zoz/New Volume/repos/testColbert/.venv/lib64/python3.12/site-packages/ragatouille/models/colbert.py", line 84, in __init__
    self.inference_ckpt = Checkpoint(
                          ^^^^^^^^^^^
  File "/run/media/zoz/New Volume/repos/testColbert/.venv/lib64/python3.12/site-packages/colbert/modeling/checkpoint.py", line 19, in __init__
    super().__init__(name, colbert_config)
  File "/run/media/zoz/New Volume/repos/testColbert/.venv/lib64/python3.12/site-packages/colbert/modeling/colbert.py", line 24, in __init__
    ColBERT.try_load_torch_extensions(self.use_gpu)
  File "/run/media/zoz/New Volume/repos/testColbert/.venv/lib64/python3.12/site-packages/colbert/modeling/colbert.py", line 39, in try_load_torch_extensions
    segmented_maxsim_cpp = load(
                           ^^^^^
  File "/run/media/zoz/New Volume/repos/testColbert/.venv/lib64/python3.12/site-packages/torch/utils/cpp_extension.py", line 1312, in load
    return _jit_compile(
           ^^^^^^^^^^^^^
  File "/run/media/zoz/New Volume/repos/testColbert/.venv/lib64/python3.12/site-packages/torch/utils/cpp_extension.py", line 1722, in _jit_compile
    _write_ninja_file_and_build_library(
  File "/run/media/zoz/New Volume/repos/testColbert/.venv/lib64/python3.12/site-packages/torch/utils/cpp_extension.py", line 1834, in _write_ninja_file_and_build_library
    _run_ninja_build(
  File "/run/media/zoz/New Volume/repos/testColbert/.venv/lib64/python3.12/site-packages/torch/utils/cpp_extension.py", line 2121, in _run_ninja_build
    raise RuntimeError(message) from e
RuntimeError: Error building extension 'segmented_maxsim_cpp': [1/1] c++ segmented_maxsim.o -shared -L/run/media/zoz/New Volume/repos/testColbert/.venv/lib64/python3.12/site-packages/torch/lib -lc10 -ltorch_cpu -ltorch -ltorch_python -o segmented_maxsim_cpp.so
FAILED: segmented_maxsim_cpp.so 
c++ segmented_maxsim.o -shared -L/run/media/zoz/New Volume/repos/testColbert/.venv/lib64/python3.12/site-packages/torch/lib -lc10 -ltorch_cpu -ltorch -ltorch_python -o segmented_maxsim_cpp.so
/usr/bin/ld: cannot find Volume/repos/testColbert/.venv/lib64/python3.12/site-packages/torch/lib: No such file or directory
/usr/bin/ld: cannot find -lc10: No such file or directory
/usr/bin/ld: cannot find -ltorch_cpu: No such file or directory
/usr/bin/ld: cannot find -ltorch: No such file or directory
/usr/bin/ld: cannot find -ltorch_python: No such file or directory
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.

INFO: Tried to clean up context but failed!

Steps to Reproduce:

  1. Clone the repository
  2. Set up the environment as per instructions in the README
  3. Run the example for creating embeddings
  4. The error occurs during the attempt to build the extension with Ninja

Environment Details
Python version: 3.12
pip list output:

aiohappyeyeballs                        2.4.2
aiohttp                                 3.10.8
aiosignal                               1.3.1
annotated-types                         0.7.0
anyio                                   4.6.0
attrs                                   24.2.0
beautifulsoup4                          4.12.3
bitarray                                2.9.2
blinker                                 1.8.2
catalogue                               2.0.10
certifi                                 2024.8.30
charset-normalizer                      3.3.2
click                                   8.1.7
Colbert                                 0.40
colbert-ai                              0.2.19
dataclasses-json                        0.6.7
datasets                                3.0.1
Deprecated                              1.2.14
dill                                    0.3.8
dirtyjson                               1.0.8
distro                                  1.9.0
faiss-cpu                               1.8.0.post1
fast-pytorch-kmeans                     0.2.0.1
filelock                                3.16.1
Flask                                   3.0.3
frozenlist                              1.4.1
fsspec                                  2024.6.1
git-python                              1.0.3
gitdb                                   4.0.11
GitPython                               3.1.43
greenlet                                3.1.1
h11                                     0.14.0
httpcore                                1.0.5
httpx                                   0.27.2
huggingface-hub                         0.25.1
icalendar                               6.0.0
idna                                    3.10
itsdangerous                            2.2.0
Jinja2                                  3.1.4
jiter                                   0.5.0
joblib                                  1.4.2
jsonpatch                               1.33
jsonpointer                             3.0.0
langchain                               0.3.1
langchain-core                          0.3.6
langchain-text-splitters                0.3.0
langsmith                               0.1.129
llama-cloud                             0.1.0
llama-index                             0.11.14
llama-index-agent-openai                0.3.4
llama-index-cli                         0.3.1
llama-index-core                        0.11.14
llama-index-embeddings-openai           0.2.5
llama-index-indices-managed-llama-cloud 0.4.0
llama-index-legacy                      0.9.48.post3
llama-index-llms-openai                 0.2.9
llama-index-multi-modal-llms-openai     0.2.1
llama-index-program-openai              0.2.0
llama-index-question-gen-openai         0.2.0
llama-index-readers-file                0.2.2
llama-index-readers-llama-parse         0.3.0
llama-parse                             0.5.6
MarkupSafe                              2.1.5
marshmallow                             3.22.0
mpmath                                  1.3.0
multidict                               6.1.0
multiprocess                            0.70.16
mypy-extensions                         1.0.0
nest-asyncio                            1.6.0
networkx                                3.3
ninja                                   1.11.1.1
nltk                                    3.9.1
numpy                                   1.26.4
nvidia-cublas-cu12                      12.1.3.1
nvidia-cuda-cupti-cu12                  12.1.105
nvidia-cuda-nvrtc-cu12                  12.1.105
nvidia-cuda-runtime-cu12                12.1.105
nvidia-cudnn-cu12                       9.1.0.70
nvidia-cufft-cu12                       11.0.2.54
nvidia-curand-cu12                      10.3.2.106
nvidia-cusolver-cu12                    11.4.5.107
nvidia-cusparse-cu12                    12.1.0.106
nvidia-nccl-cu12                        2.20.5
nvidia-nvjitlink-cu12                   12.6.68
nvidia-nvtx-cu12                        12.1.105
onnx                                    1.16.2
openai                                  1.50.2
orjson                                  3.10.7
packaging                               24.1
pandas                                  2.2.3
pillow                                  10.4.0
pip                                     24.2
protobuf                                5.28.2
pyarrow                                 17.0.0
pydantic                                2.9.2
pydantic_core                           2.23.4
pynvml                                  11.5.3
pypdf                                   4.3.1
python-dateutil                         2.9.0.post0
python-dotenv                           1.0.1
pytz                                    2024.2
PyYAML                                  6.0.2
RAGatouille                             0.0.8.post4
regex                                   2024.9.11
requests                                2.32.3
safetensors                             0.4.5
scikit-learn                            1.5.2
scipy                                   1.14.1
sentence-transformers                   2.7.0
setuptools                              75.1.0
six                                     1.16.0
smmap                                   5.0.1
sniffio                                 1.3.1
soupsieve                               2.6
SQLAlchemy                              2.0.35
srsly                                   2.4.8
striprtf                                0.0.26
sympy                                   1.13.3
tenacity                                8.5.0
threadpoolctl                           3.5.0
tiktoken                                0.7.0
tokenizers                              0.20.0
torch                                   2.4.1
tqdm                                    4.66.5
transformers                            4.45.1
triton                                  3.0.0
typing_extensions                       4.12.2
typing-inspect                          0.9.0
tzdata                                  2024.2
ujson                                   5.10.0
voyager                                 2.0.9
Werkzeug                                3.0.4
wrapt                                   1.16.0
xxhash                                  3.5.0
yarl                                    1.13.1

Additional Information:

  • Ninja Build Log Snippet:
[1/1] c++ segmented_maxsim.o -shared -L/run/media/zoz/New Volume/repos/testColbert/.venv/lib64/python3.12/site-packages/torch/lib -lc10 -ltorch_cpu -ltorch -ltorch_python -o segmented_maxsim_cpp.so
FAILED: segmented_maxsim_cpp.so 
c++ segmented_maxsim.o -shared -L/run/media/zoz/New Volume/repos/testColbert/.venv/lib64/python3.12/site-packages/torch/lib -lc10 -ltorch_cpu -ltorch -ltorch_python -o segmented_maxsim_cpp.so
/usr/bin/ld: cannot find Volume/repos/testColbert/.venv/lib64/python3.12/site-packages/torch/lib: No such file or directory
/usr/bin/ld: cannot find -lc10: No such file or directory
/usr/bin/ld: cannot find -ltorch_cpu: No such file or directory
/usr/bin/ld: cannot find -ltorch: No such file or directory
/usr/bin/ld: cannot find -ltorch_python: No such file or directory
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
  • torch files:
.venv/lib64/python3.12/site-packages/torch/lib/libc10_cuda.so
.venv/lib64/python3.12/site-packages/torch/lib/libc10.so
.venv/lib64/python3.12/site-packages/torch/lib/libcaffe2_nvrtc.so
.venv/lib64/python3.12/site-packages/torch/lib/libcusparseLt-f80c68d1.so.0
.venv/lib64/python3.12/site-packages/torch/lib/libgomp-a34b3233.so.1
.venv/lib64/python3.12/site-packages/torch/lib/libshm.so
.venv/lib64/python3.12/site-packages/torch/lib/libtorch_cpu.so
.venv/lib64/python3.12/site-packages/torch/lib/libtorch_cuda_linalg.so
.venv/lib64/python3.12/site-packages/torch/lib/libtorch_cuda.so
.venv/lib64/python3.12/site-packages/torch/lib/libtorch_global_deps.so
.venv/lib64/python3.12/site-packages/torch/lib/libtorch_python.so
.venv/lib64/python3.12/site-packages/torch/lib/libtorch.so

Attempted Solutions:

  • Verified that the Torch library is installed correctly.
  • Confirmed that the torch/lib directory exists in the specified path.
  • Tried reinstalling Torch and Ragatouille.
  • Ensured that Ninja is properly installed and accessible in the environment.

Request for Assistance:

Could you please help identify the root cause of this linking error and suggest possible solutions or workarounds? Any insights into properly configuring the environment for building the ColBERT extensions with Ragatouille would be greatly appreciated.

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

1 participant