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

BUG: fix bge-reranker-v2-minicpm-layerwise rerank issue #2495

Merged
merged 3 commits into from
Nov 1, 2024

Conversation

hustyichi
Copy link
Contributor

The return value of compute_score() in the bge-reranker-v2-minicpm-layerwise model is a two-dimensional array. Currently, an error message only integer scalar arrays can be converted to a scalar index is reported during execution, so additional processing is required

@XprobeBot XprobeBot added the bug Something isn't working label Oct 29, 2024
@XprobeBot XprobeBot added this to the v0.15 milestone Oct 29, 2024
@hustyichi
Copy link
Contributor Author

Test code


RERANK_MODEL = "BAAI/bge-reranker-v2-minicpm-layerwise"

rerank_model = LayerWiseFlagLLMReranker(RERANK_MODEL, use_fp16=True, device="cuda")

question = "What is the meaning of life?"
passages = [
    "This is a test passage.",
    "This is another test passage.",
]

scores = rerank_model.compute_score(
    [[question, passage] for passage in passages],
    cutoff_layers=[28],
    normalize=True,
)

print(scores)
print(type(scores), type(scores[0]))

The log is:

[[5.225226840386987e-05, 3.120191139396651e-05]]
<class 'list'> <class 'list'>

@XprobeBot XprobeBot modified the milestones: v0.15, v0.16 Oct 30, 2024
Copy link
Contributor

@qinxuye qinxuye left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@qinxuye qinxuye merged commit 07f9325 into xorbitsai:main Nov 1, 2024
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants