graph LR
MonoT5["MonoT5"]
T5BatchTokenizer["T5BatchTokenizer"]
QueryDocumentBatch["QueryDocumentBatch"]
encode["encode"]
greedy_decode["greedy_decode"]
MonoT5 -- "creates" --> QueryDocumentBatch
MonoT5 -- "calls" --> encode
MonoT5 -- "calls" --> greedy_decode
MonoT5 -- "uses" --> T5BatchTokenizer
encode -- "processes" --> QueryDocumentBatch
encode -- "provides input to" --> greedy_decode
The Reranking Module subsystem is primarily defined by the beir/reranking/models/mono_t5.py file, which encapsulates the MonoT5 model and its associated utilities for re-ranking.
The central orchestrator of the re-ranking process. It initializes the T5 model and tokenizer, manages the re-ranking workflow, and provides the primary interface for users to perform re-ranking by encapsulating input preparation, model inference, and score prediction.
Related Classes/Methods:
A specialized tokenizer class designed for efficient batch processing of text inputs (queries and documents), optimized for compatibility with T5 models. It prepares raw text into token IDs and attention masks required by the model.
Related Classes/Methods:
A data structure that represents a structured batch of query-document pairs. It standardizes the input format for the re-ranking model, facilitating efficient and organized processing.
Related Classes/Methods:
This component is responsible for transforming the QueryDocumentBatch into a numerical format (e.g., token IDs, attention masks) suitable for input to the MonoT5 model. It acts as the pre-processing step before model inference.
Related Classes/Methods:
This component executes the actual inference or prediction step using the MonoT5 model. It takes the encoded input and generates re-ranked scores or outputs, representing the core re-ranking logic.
Related Classes/Methods: