Index vectors are of type torch.float16 but the device is CPU. Converting to torch.float32. Killed
#2
by
Raphy10-Collab
- opened
Hi!
I tried to use ReLik with cpu but got "Killed"
raphy@raohy:~$ mkdir ReLik
raphy@raohy:~$ cd ReLik
raphy@raohy:~/ReLik$ python3 -m venv .relik_env
raphy@raohy:~/ReLik$ source .relik_env/bin/activate
(.relik_env) raphy@raohy:~/ReLik$
(.relik_env) raphy@raohy:~/ReLik$ pip install relik
Installing collected packages: sentencepiece, pytz, pprintpp, mpmath, cymem, antlr4-python3-runtime, xxhash, wrapt, wasabi, urllib3, tzdata, typing-extensions, tqdm, threadpoolctl, termcolor, sympy, spacy-loggers, spacy-legacy, smmap, six, shellingham, setuptools, setproctitle, safetensors, regex, pyyaml, pygments, pyarrow-hotfix, pyarrow, psutil, protobuf, propcache, platformdirs, packaging, overrides, nvidia-nvtx-cu12, nvidia-nvjitlink-cu12, nvidia-nccl-cu12, nvidia-curand-cu12, nvidia-cufft-cu12, nvidia-cuda-runtime-cu12, nvidia-cuda-nvrtc-cu12, nvidia-cuda-cupti-cu12, nvidia-cublas-cu12, numpy, networkx, murmurhash, multidict, mdurl, MarkupSafe, joblib, idna, fsspec, frozenlist, filelock, dill, colorlog, colorama, cloudpathlib, click, charset-normalizer, certifi, catalogue, attrs, art, annotated-types, aiohappyeyeballs, yarl, srsly, smart-open, sentry-sdk, scipy, requests, python-dateutil, pydantic-core, preshed, omegaconf, nvidia-cusparse-cu12, nvidia-cudnn-cu12, multiprocess, markdown-it-py, marisa-trie, lightning-utilities, jinja2, gitdb, docker-pycreds, blis, aiosignal, scikit-learn, rich, pydantic, pandas, nvidia-cusolver-cu12, language-data, hydra-core, huggingface-hub, gitpython, aiohttp, wandb, typer, torch, tokenizers, langcodes, hydra-colorlog, confection, weasel, transformers, torchmetrics, thinc, datasets, spacy, pytorch-lightning, lightning, relik
Successfully installed MarkupSafe-3.0.2 aiohappyeyeballs-2.4.4 aiohttp-3.11.11 aiosignal-1.3.2 annotated-types-0.7.0 antlr4-python3-runtime-4.9.3 art-6.2 attrs-25.1.0 blis-0.7.11 catalogue-2.0.10 certifi-2024.12.14 charset-normalizer-3.4.1 click-8.1.8 cloudpathlib-0.20.0 colorama-0.4.6 colorlog-6.9.0 confection-0.1.5 cymem-2.0.11 datasets-2.14.7 dill-0.3.7 docker-pycreds-0.4.0 filelock-3.17.0 frozenlist-1.5.0 fsspec-2023.10.0 gitdb-4.0.12 gitpython-3.1.44 huggingface-hub-0.27.1 hydra-colorlog-1.2.0 hydra-core-1.3.2 idna-3.10 jinja2-3.1.5 joblib-1.4.2 langcodes-3.5.0 language-data-1.3.0 lightning-2.3.3 lightning-utilities-0.11.9 marisa-trie-1.2.1 markdown-it-py-3.0.0 mdurl-0.1.2 mpmath-1.3.0 multidict-6.1.0 multiprocess-0.70.15 murmurhash-1.0.12 networkx-3.4.2 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-8.9.2.26 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.8.61 nvidia-nvtx-cu12-12.1.105 omegaconf-2.3.0 overrides-7.7.0 packaging-24.2 pandas-2.2.3 platformdirs-4.3.6 pprintpp-0.4.0 preshed-3.0.9 propcache-0.2.1 protobuf-5.29.3 psutil-6.1.1 pyarrow-19.0.0 pyarrow-hotfix-0.6 pydantic-2.10.6 pydantic-core-2.27.2 pygments-2.19.1 python-dateutil-2.9.0.post0 pytorch-lightning-2.5.0.post0 pytz-2024.2 pyyaml-6.0.2 regex-2024.11.6 relik-1.0.6 requests-2.32.3 rich-13.9.4 safetensors-0.5.2 scikit-learn-1.5.2 scipy-1.15.1 sentencepiece-0.2.0 sentry-sdk-2.20.0 setproctitle-1.3.4 setuptools-75.8.0 shellingham-1.5.4 six-1.17.0 smart-open-7.1.0 smmap-5.0.2 spacy-3.7.5 spacy-legacy-3.0.12 spacy-loggers-1.0.5 srsly-2.5.1 sympy-1.13.3 termcolor-2.4.0 thinc-8.2.5 threadpoolctl-3.5.0 tokenizers-0.19.1 torch-2.3.1 torchmetrics-1.6.1 tqdm-4.67.1 transformers-4.41.2 typer-0.12.5 typing-extensions-4.12.2 tzdata-2025.1 urllib3-2.3.0 wandb-0.17.9 wasabi-1.1.3 weasel-0.4.1 wrapt-1.17.2 xxhash-3.5.0 yarl-1.18.3
(.relik_env) raphy@raohy:~/ReLik$
(.relik_env) raphy@raohy:~/ReLik$ cat EntityLinking.py
from relik import Relik
from relik.inference.data.objects import RelikOutput
relik = Relik.from_pretrained("sapienzanlp/relik-entity-linking-large")
relik_out: RelikOutput = relik("Michael Jordan was one of the best players in the NBA.")
But got "killed" when executing the python script :
(.relik_env) raphy@raohy:~/ReLik$ python3 EntityLinking.py
/home/raphy/ReLik/.relik_env/lib/python3.12/site-packages/torch/cuda/__init__.py:619: UserWarning: Can't initialize NVML
warnings.warn("Can't initialize NVML")
/home/raphy/ReLik/.relik_env/lib/python3.12/site-packages/torch/cuda/__init__.py:749: UserWarning: CUDA initialization: The NVIDIA driver on your system is too old (found version 11040). Please update your GPU driver by downloading and installing a new version from the URL: http://www.nvidia.com/Download/index.aspx Alternatively, go to: https://pytorch.org to install a PyTorch version that has been compiled with your version of the CUDA driver. (Triggered internally at ../c10/cuda/CUDAFunctions.cpp:108.)
return torch._C._cuda_getDeviceCount() if nvml_count < 0 else nvml_count
___ __
/\_ \ __ /\ \
_ __ __ \//\ \ /\_\ \ \ \/'\
/\`'__\ /'__`\ \ \ \ \/\ \ \ \ , <
\ \ \/ /\ __/ \_\ \_ \ \ \ \ \ \\`\
\ \_\ \ \____\ /\____\ \ \_\ \ \_\ \_\
\/_/ \/____/ \/____/ \/_/ \/_/\/_/
/home/raphy/ReLik/.relik_env/lib/python3.12/site-packages/huggingface_hub/file_download.py:795: FutureWarning: `resume_download` is deprecated and will be removed in version 1.0.0. Downloads always resume when possible. If you want to force a new download, use `force_download=True`.
warnings.warn(
[2025-01-26 13:01:11,325] [INFO] [relik.inference.annotator.from_pretrained:700] [PID:14412] [RANK:0] Loading Relik from sapienzanlp/relik-entity-linking-large
[2025-01-26 13:01:11,327] [INFO] [relik.inference.annotator.from_pretrained:701] [PID:14412] [RANK:0] {
'_target_': 'relik.inference.annotator.Relik',
'index': {
'span': {
'_target_': 'relik.retriever.indexers.inmemory.InMemoryDocumentIndex.from_pretrained',
'name_or_path': 'sapienzanlp/relik-retriever-e5-base-v2-aida-blink-wikipedia-index',
},
},
'metadata_fields': [],
'reader': {
'_target_': 'relik.reader.pytorch_modules.span.RelikReaderForSpanExtraction',
'transformer_model': 'sapienzanlp/relik-reader-deberta-v3-large-aida',
'use_nme': True,
},
'retriever': {
'span': {
'_target_': 'relik.retriever.pytorch_modules.model.GoldenRetriever',
'question_encoder': 'sapienzanlp/relik-retriever-e5-base-v2-aida-blink-encoder',
},
},
'task': 'SPAN',
'top_k': 100,
'window_size': 32,
'window_stride': 16,
}
[2025-01-26 13:01:13,794] [INFO] [relik.retriever.indexers.base.from_pretrained:484] [PID:14412] [RANK:0] Loading Index from config:
[2025-01-26 13:01:13,797] [INFO] [relik.retriever.indexers.base.from_pretrained:485] [PID:14412] [RANK:0] {
'_target_': 'relik.retriever.indexers.inmemory.InMemoryDocumentIndex',
'device': 'cpu',
'metadata_fields': ['definition'],
'name_or_path': 'sapienzanlp/relik-retriever-e5-base-v2-aida-blink-wikipedia-index',
'precision': None,
'separator': ' <def> ',
'use_faiss': False,
}
[2025-01-26 13:01:13,798] [INFO] [relik.retriever.indexers.base.from_pretrained:492] [PID:14412] [RANK:0] Loading documents from /home/raphy/.cache/huggingface/hub/models--sapienzanlp--relik-retriever-e5-base-v2-aida-blink-wikipedia-index/snapshots/ffbe8d150afbc59caa3479e53834c027831908be/documents.jsonl
[2025-01-26 13:01:43,987] [INFO] [relik.retriever.indexers.base.from_pretrained:535] [PID:14412] [RANK:0] Loading embeddings from /home/raphy/.cache/huggingface/hub/models--sapienzanlp--relik-retriever-e5-base-v2-aida-blink-wikipedia-index/snapshots/ffbe8d150afbc59caa3479e53834c027831908be/embeddings.pt
[2025-01-26 13:02:02,660] [INFO] [relik.retriever.indexers.inmemory.__init__:65] [PID:14412] [RANK:0] Both documents and embeddings are provided.
[2025-01-26
How to make it work?