Jump to content

Connect Leeroopedia MCP: Equip your AI agents to search best practices, build plans, verify code, diagnose failures, and look up hyperparameter defaults.

Implementation:FlagOpen FlagEmbedding FlagAutoReranker From Finetuned Validation

From Leeroopedia


Source
FlagEmbedding/inference/auto_reranker.py:L23-81

Summary

This documents using FlagAutoReranker.from_finetuned() specifically for loading fine-tuned reranker checkpoints for validation. The underlying API is the same as FlagAutoReranker.from_finetuned() used for inference, but applied in a validation context.

Key difference: model_name_or_path points to the local fine-tuned directory, and model_class MUST be explicitly specified.

Example

reranker = FlagAutoReranker.from_finetuned(
    model_name_or_path="./fine_tuned_reranker",
    model_class="encoder-only-base"
)
scores = reranker.compute_score([
    ("What is AI?", "Artificial intelligence is..."),
    ("What is AI?", "The weather today...")
])
print(f"Scores: {scores}")

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment