nemo_automodel.components.datasets.llm.retrieval_collator
nemo_automodel.components.datasets.llm.retrieval_collator
Module Contents
Classes
Functions
API
Collator for encoder retrieval training.
This collator handles tokenization of queries and documents at batch time, which is more memory-efficient than pre-tokenization and allows for dynamic padding based on batch max length.
Based on EncoderCollator from nemo-retriever-research but adapted for Automodel.
Collate a batch of examples.
Parameters:
List of examples, each with ‘question’, ‘doc_text’, ‘doc_image’ keys
Returns: Dict[str, torch.Tensor]
Dictionary with:
Convert dictionary of lists to list of dictionaries.
Merge query and document batches into a single dictionary.
Adapted from nemo-retriever-research/src/loaders/loader_utils.py
Bases: DataCollatorWithPadding
Collate query-document pairs for cross-encoder reranking.
Expose one method of a multimodal processor as a dataloader collator.
Collate retrieval examples with the resolved processor method.
Parameters:
Retrieval examples for one local batch.
Returns: dict[str, object]
Processor-produced tensor batch.
Stable 63-bit int for corpus doc id strings (for in-batch duplicate masking).
Unpack document lists into individual examples.
Turns a method of a processor into a collator function.
Parameters:
The processor instance.
The name of the processor method to turn into a collator function.
Returns: Callable[[list[dict[str, object]]], dict[str, object]]
A collator for vision/multimodal retrieval datasets.