Skip to content

[Bug]: [ERROR]Fail to bind LLM used by RAPTOR: division by zero #6685

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

Open
4 tasks done
lianwenke opened this issue Mar 31, 2025 · 4 comments
Open
4 tasks done

[Bug]: [ERROR]Fail to bind LLM used by RAPTOR: division by zero #6685

lianwenke opened this issue Mar 31, 2025 · 4 comments
Labels
🐞 bug Something isn't working, pull request that fix bug.

Comments

@lianwenke
Copy link

Self Checks

  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report (Language Policy).
  • Non-english title submitions will be closed directly ( 非英文标题的提交将会被直接关闭 ) (Language Policy).
  • Please do not modify this template :) and fill in all the required fields.

RAGFlow workspace code commit ID

empty

RAGFlow image version

v15.0

Other environment information

Actual behavior

parse fail

Image

Expected behavior

No response

Steps to reproduce

parse_config:{"chunk_token_num": 128, "delimiter": "\\n!?;\u3002\uff1b\uff01\uff1f", "html4excel": false, "layout_recognize": "DeepDOC", "raptor": {"user_raptor": false, "use_raptor": true, "prompt": "\u8bf7\u603b\u7ed3\u4ee5\u4e0b\u6bb5\u843d\u3002 \u5c0f\u5fc3\u6570\u5b57\uff0c\u4e0d\u8981\u7f16\u9020\u3002 \u6bb5\u843d\u5982\u4e0b\uff1a\n      {cluster_content}\n\u4ee5\u4e0a\u5c31\u662f\u4f60\u9700\u8981\u603b\u7ed3\u7684\u5185\u5bb9\u3002", "max_token": 256, "threshold": 0.1, "max_cluster": 64, "random_seed": 0}, "task_page_size": 12, "auto_keywords": 0, "auto_questions": 0, "graphrag": {"use_graphrag": false}, "pages": [[1, 1024]]}

Additional information

No response

@lianwenke lianwenke added the 🐞 bug Something isn't working, pull request that fix bug. label Mar 31, 2025
Copy link

dosubot bot commented Mar 31, 2025

@lianwenke Hello there! 👋 I'm here to help you with bug fixes, questions, and becoming a contributor. I'm looking forward to assisting you!

The "division by zero" error when binding the LLM used by RAPTOR in RAGFlow image version v15.0 could be caused by identical relevance scores in the res["results"] array. This results in max_rank being equal to min_rank, making the denominator in the normalization step zero. The code should handle this by setting rank to np.zeros_like(rank) when max_rank - min_rank is zero, so the error should not occur unless there is an issue elsewhere in the code or data [1].

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Bug Report | Other

@KevinHuSh
Copy link
Collaborator

Do you have backend error logs?

@lianwenke
Copy link
Author

Do you have backend error logs?

@KevinHuSh

ragflow.log

@liwenju0
Copy link
Contributor

def is_chinese(text):
    if not text:
        return False
    chinese = 0
    for ch in text:
        if '\u4e00' <= ch <= '\u9fff':
            chinese += 1
    if chinese / len(text) > 0.2:
        return True
    return False

The above is the latest code, there will be no divide by zero error, please upgrade the image and take a look

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐞 bug Something isn't working, pull request that fix bug.
Projects
None yet
Development

No branches or pull requests

3 participants