run-llama / llama_index

LlamaIndex is a data framework for your LLM applications
https://docs.llamaindex.ai
MIT License
36.63k stars 5.24k forks source link

[Bug]: segmentation fault #13470

Open laozhai507 opened 6 months ago

laozhai507 commented 6 months ago

Bug Description

When execute HuggingFaceEmbedding(model_name='BAAI/bge-large-en-v1.5'), the script exits abnormally.

Version

0.10.36

Steps to Reproduce

Simply execute HuggingFaceEmbedding(model_name='BAAI/bge-large-en-v1.5').

Relevant Logs/Tracbacks

python loading.py          
...
[1]    12295 segmentation fault  python loading.py
dosubot[bot] commented 6 months ago

Hey @laozhai507! 👋 I'm Dosu, a friendly bot here to help you squash bugs, answer your questions, and guide you on contributing while we wait for a human maintainer to chime in. I've just caught sight of your issue with the HuggingFaceEmbedding call. Hang tight; I'm diving into the details and will get back to you with some insights shortly! 🤖🔍

logan-markewich commented 6 months ago

I think this is more of an issue with your env / OS? This works fine on Google colab and my Mac for example

laozhai507 commented 6 months ago

That's weird... My OS is MacOS 14.4.1 with M2 Max, env is 3.11.9. Could you please advise me how to solve this issue? Thanks a lot! @logan-markewich

dosubot[bot] commented 6 months ago

To address the segmentation fault you're encountering with HuggingFaceEmbedding(model_name='BAAI/bge-large-en-v1.5'), let's focus on a few targeted steps:

  1. Check Transformers Library Version: Ensure your Transformers library is at least version 4.37.0 but less than 5.0.0, as this range is compatible with LlamaIndex v0.10.36. Update if necessary.

  2. Python Version Compatibility: You're using Python 3.11.9, which might not be fully supported by all your dependencies. Consider downgrading to Python 3.8 or 3.9, as these versions are more commonly supported and could potentially resolve the issue.

  3. Environment Testing: Given your MacOS 14.4.1 with M2 Max setup, try running your script in a different environment, such as a Linux-based system, to rule out any specific incompatibilities with your current setup.

  4. Enable Debugging: For more insight into the crash, enable DEBUG logging level in your application and use LlamaDebugHandler for detailed error messages and tracebacks. This can provide more clues as to what might be causing the segmentation fault.

These steps should help in diagnosing and potentially resolving the segmentation fault issue. If the problem persists, providing more detailed information about your setup, including the exact versions of your dependencies, could help in further troubleshooting.

#### Details **Sources** - [[Bug]: segmentation fault](https://github.com/run-llama/llama_index/issues/11598) - [llama-index-integrations/embeddings/llama-index-embeddings-huggingface-itrex/pyproject.toml](https://github.com/run-llama/llama_index/blob/main/llama-index-integrations/embeddings/llama-index-embeddings-huggingface-itrex/pyproject.toml) - [llama-index-integrations/llms/llama-index-llms-ipex-llm/llama_index/llms/ipex_llm/base.py](https://github.com/run-llama/llama_index/blob/main/llama-index-integrations/llms/llama-index-llms-ipex-llm/llama_index/llms/ipex_llm/base.py) - [benchmarks/embeddings/bench_embeddings.py](https://github.com/run-llama/llama_index/blob/main/benchmarks/embeddings/bench_embeddings.py) - [llama-index-legacy/llama_index/legacy/embeddings/huggingface.py](https://github.com/run-llama/llama_index/blob/main/llama-index-legacy/llama_index/legacy/embeddings/huggingface.py) - [llama-index-integrations/embeddings/llama-index-embeddings-huggingface/llama_index/embeddings/huggingface/base.py](https://github.com/run-llama/llama_index/blob/main/llama-index-integrations/embeddings/llama-index-embeddings-huggingface/llama_index/embeddings/huggingface/base.py) - [llama-index-integrations/llms/llama-index-llms-nvidia-tensorrt/pyproject.toml](https://github.com/run-llama/llama_index/blob/main/llama-index-integrations/llms/llama-index-llms-nvidia-tensorrt/pyproject.toml) - [llama-index-integrations/embeddings/llama-index-embeddings-ipex-llm/llama_index/embeddings/ipex_llm/utils.py](https://github.com/run-llama/llama_index/blob/main/llama-index-integrations/embeddings/llama-index-embeddings-ipex-llm/llama_index/embeddings/ipex_llm/utils.py) - [docs/docs/understanding/tracing_and_debugging/tracing_and_debugging.md](https://github.com/run-llama/llama_index/blob/main/docs/docs/understanding/tracing_and_debugging/tracing_and_debugging.md) - [llama-index-core/llama_index/core/callbacks/llama_debug.py](https://github.com/run-llama/llama_index/blob/main/llama-index-core/llama_index/core/callbacks/llama_debug.py) - [llama-index-integrations/postprocessor/llama-index-postprocessor-colbert-rerank/pyproject.toml](https://github.com/run-llama/llama_index/blob/main/llama-index-integrations/postprocessor/llama-index-postprocessor-colbert-rerank/pyproject.toml)
**About Dosu** This response is meant to be useful and save you time. It is **not meant to be a precise solution**, but rather a starting point for your own research. Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.

To continue the conversation, mention @dosu.

laozhai507 commented 6 months ago

python 3.9 has same error, will try linux later @dosu

dosubot[bot] commented 6 months ago

If downgrading to Python 3.9 didn't resolve the issue, it's good that you're considering testing on Linux next. In the meantime, ensure that your Transformers library is indeed within the specified version range compatible with your current setup. Additionally, if you haven't already, try updating all related dependencies to their latest versions that are still within the compatibility range for LlamaIndex v0.10.36. This includes libraries that HuggingFaceEmbedding might depend on, directly or indirectly.

After updating dependencies, if the issue persists on MacOS, testing on Linux will be a crucial step. It will help determine if the problem is specific to the MacOS environment or if it's more broadly related to the code or library versions. When you do test on Linux, ensure that the environment is as similar as possible to your MacOS setup in terms of Python version and installed libraries to accurately pinpoint the cause.

Lastly, if the segmentation fault still occurs on Linux, consider enabling core dumps to capture and analyze the crash details. This can provide valuable insights into what's happening at the moment of the crash. To enable core dumps, you can use the command ulimit -c unlimited before running your script in the terminal. After a crash, you'll find a core dump file in the directory where you ran the script, which can be analyzed with debugging tools like gdb in Linux.

Keep us posted on your findings after testing on Linux, and if there are any new error messages or behaviors observed, please share them for further assistance.

#### Details **About Dosu** This response is meant to be useful and save you time. It is **not meant to be a precise solution**, but rather a starting point for your own research. Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.

To continue the conversation, mention @dosu.