Dataset processors and filters
Callable objects passed to HF dataset map() and filter() functions.
lotd.TextTokenizer
Applies template and tokenizes texts in a dataset.
__call__
__call__(texts: List[str]) -> Dict[str, List[List[int]]]
Tokenizes a batch of text samples.
| Parameters: |
|
|---|
| Returns: |
|
|---|
__init__
__init__(tokenizer: Union[PreTrainedTokenizer, PreTrainedTokenizerFast], template: str = '[CLS]{{text}}[SEP]', max_length: Union[int, None] = None) -> None
Initializes the dataset tokenizer.
| Parameters: |
|
|---|
lotd.ChatTokenizer
Applies chat template and tokenizes messages in a dataset.
__call__
__call__(prompts: Union[List[str], List[List[str]]], responses: Union[List[str], List[List[str]]] = [], system: Union[List[str], None] = None) -> Dict[str, List[List[int]]]
Tokenizes chats.
| Parameters: |
|
|---|
| Returns: |
|
|---|
__init__
__init__(tokenizer: Union[PreTrainedTokenizer, PreTrainedTokenizerFast], max_length: Union[int, None] = None) -> None
Initializes the dataset chat tokenizer.
| Parameters: |
|
|---|
lotd.LengthFilter
Filters datasets by max and min length of input_ids.
__call__
__call__(input_ids: List[List[int]]) -> List[bool]
Processes a batch of input_ids.
__init__
__init__(min_length: int = 0, max_length: Union[int, None] = None) -> None
Initializes the collator.
| Parameters: |
|
|---|