nemo_curator.stages.text.models.model
nemo_curator.stages.text.models.model
Module Contents
Classes
API
Bases: ProcessingStage[DocumentBatch, DocumentBatch]
Base class for Hugging Face model inference.
Parameters:
The identifier of the Hugging Face model.
The Hugging Face cache directory. Defaults to None.
Hugging Face token for downloading the model, if needed. Defaults to None.
The size of the batch for model inference. Defaults to 256.
Whether to sort the input data by the length of the input tokens. Sorting is encouraged to improve the performance of the inference model. Defaults to True.
The side to pad the input tokens. Defaults to “right”.
If provided, clips the input tokens before the forward pass. Defaults to None.
Whether to unpack the inference batch with **kwargs. Defaults to False.
Whether to use autocast. When True, we trade off minor accuracy for faster inference. Defaults to True.
Yields a generator of model inputs for the next batch. We only move the batch to the GPU to reduce the memory overhead.
Parameters:
The Pandas DataFrame (with input_ids and attention_mask) to process.