Hello, got Torch not compiled with CUDA enabled error while running demo_en.py, I am not familiar with CUDA's relationship with torch, so I am asking any approach to fix it. Btw, I am running on M2 Max chip MacOS 14.5, don't think I have Nvidia GPU in my mac. Do I need to have Nvidia GPUs to run code? If not, what torch version/configurations should I use when installing (or other ways to fix this)?
Below is my error log:
Setting num_proc from 4 back to 1 for the train split to disable multiprocessing as it only contains one shard.
Generating train split: 15000 examples [00:00, 1158391.52 examples/s]
config.json: 100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████| 650/650 [00:00<00:00, 2.73MB/s]
model.safetensors: 100%|███████████████████████████████████████████████████████████████████████████████████████████████████████| 438M/438M [00:31<00:00, 13.7MB/s]
File "/opt/miniconda3/envs/flashrag-env/lib/python3.11/site-packages/torch/nn/modules/module.py", line 915, in <lambda>
return self._apply(lambda t: t.cuda(device))
^^^^^^^^^^^^^^
File "/opt/miniconda3/envs/flashrag-env/lib/python3.11/site-packages/torch/cuda/__init__.py", line 284, in _lazy_init
raise AssertionError("Torch not compiled with CUDA enabled")
AssertionError: Torch not compiled with CUDA enabled
I installed packages in a conda env, below are all my packages in conda.
==== update ====
more traceback below, If I understand correctly, there is a code directly calling cuda, model.cuda() in flashrag/retriever/utils.py which may be related to my issue?
File "/Users/smalldog/Desktop/rag/FlashRAG/flashrag-env/lib/python3.11/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 589, in _run_script
exec(code, module.__dict__)
File "/Users/smalldog/Desktop/rag/FlashRAG/examples/quick_start/demo_en.py", line 44, in <module>
retriever = load_retriever(config)
^^^^^^^^^^^^^^^^^^^^^^
File "/Users/smalldog/Desktop/rag/FlashRAG/flashrag-env/lib/python3.11/site-packages/streamlit/runtime/caching/cache_utils.py", line 168, in wrapper
return cached_func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/smalldog/Desktop/rag/FlashRAG/flashrag-env/lib/python3.11/site-packages/streamlit/runtime/caching/cache_utils.py", line 197, in __call__
return self._get_or_create_cached_value(args, kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/smalldog/Desktop/rag/FlashRAG/flashrag-env/lib/python3.11/site-packages/streamlit/runtime/caching/cache_utils.py", line 224, in _get_or_create_cached_value
return self._handle_cache_miss(cache, value_key, func_args, func_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/smalldog/Desktop/rag/FlashRAG/flashrag-env/lib/python3.11/site-packages/streamlit/runtime/caching/cache_utils.py", line 280, in _handle_cache_miss
computed_value = self._info.func(*func_args, **func_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/smalldog/Desktop/rag/FlashRAG/examples/quick_start/demo_en.py", line 16, in load_retriever
return get_retriever(_config)
^^^^^^^^^^^^^^^^^^^^^^
File "/Users/smalldog/Desktop/rag/FlashRAG/flashrag/utils/utils.py", line 76, in get_retriever
return getattr(
^^^^^^^^
File "/Users/smalldog/Desktop/rag/FlashRAG/flashrag/retriever/retriever.py", line 247, in __init__
self.encoder = Encoder(
^^^^^^^^
File "/Users/smalldog/Desktop/rag/FlashRAG/flashrag/retriever/encoder.py", line 49, in __init__
self.model, self.tokenizer = load_model(model_path=model_path,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/smalldog/Desktop/rag/FlashRAG/flashrag/retriever/utils.py", line 13, in load_model
model.cuda()
Hello, got
Torch not compiled with CUDA enabled
error while runningdemo_en.py
, I am not familiar with CUDA's relationship with torch, so I am asking any approach to fix it. Btw, I am running on M2 Max chip MacOS 14.5, don't think I have Nvidia GPU in my mac. Do I need to have Nvidia GPUs to run code? If not, what torch version/configurations should I use when installing (or other ways to fix this)? Below is my error log:I installed packages in a conda env, below are all my packages in conda.
==== update ==== more traceback below, If I understand correctly, there is a code directly calling cuda,
model.cuda()
inflashrag/retriever/utils.py
which may be related to my issue?Thank you!