Unverified Commit 342ff6eb authored by Jia's avatar Jia Committed by GitHub
Browse files

Update comments in class BatchEncoding (#15932)

parent e02f95b2
...@@ -160,16 +160,17 @@ class TokenSpan(NamedTuple): ...@@ -160,16 +160,17 @@ class TokenSpan(NamedTuple):
class BatchEncoding(UserDict): class BatchEncoding(UserDict):
""" """
Holds the output of the [`~tokenization_utils_base.PreTrainedTokenizerBase.encode_plus`] and Holds the output of the [`~tokenization_utils_base.PreTrainedTokenizerBase.__call__`],
[`~tokenization_utils_base.PreTrainedTokenizerBase.batch_encode`] methods (tokens, attention_masks, etc). [`~tokenization_utils_base.PreTrainedTokenizerBase.encode_plus`] and
[`~tokenization_utils_base.PreTrainedTokenizerBase.batch_encode_plus`] methods (tokens, attention_masks, etc).
This class is derived from a python dictionary and can be used as a dictionary. In addition, this class exposes This class is derived from a python dictionary and can be used as a dictionary. In addition, this class exposes
utility methods to map from word/character space to token space. utility methods to map from word/character space to token space.
Args: Args:
data (`dict`): data (`dict`):
Dictionary of lists/arrays/tensors returned by the encode/batch_encode methods ('input_ids', Dictionary of lists/arrays/tensors returned by the `__call__`/`encode_plus`/`batch_encode_plus` methods
'attention_mask', etc.). ('input_ids', 'attention_mask', etc.).
encoding (`tokenizers.Encoding` or `Sequence[tokenizers.Encoding]`, *optional*): encoding (`tokenizers.Encoding` or `Sequence[tokenizers.Encoding]`, *optional*):
If the tokenizer is a fast tokenizer which outputs additional information like mapping from word/character If the tokenizer is a fast tokenizer which outputs additional information like mapping from word/character
space to token space the `tokenizers.Encoding` instance or list of instance (for batches) hold this space to token space the `tokenizers.Encoding` instance or list of instance (for batches) hold this
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment