class_docstr: A `TransformerTextField` is a collection of several tensors that are are a representation of text,
  tokenized and ready to become input to a transformer.
  
  The naming pattern of the tensors follows the pattern that's produced by the huggingface tokenizers,
  and expected by the huggingface transformers.
class_docstr_tok: ["A","`","TransformerTextField","`","is","a","collection","of","several","tensors","that","are","are","a","representation","of","text",",","tokenized","and","ready","to","become","input","to","a","transformer",".","The","naming","pattern","of","the","tensors","follows","the","pattern","that","'s","produced","by","the","huggingface","tokenizers",",","and","expected","by","the","huggingface","transformers","."]
code: def __init__(
      self,
      input_ids: Union[torch.Tensor, List[int]],
      # I wish input_ids were called `token_ids` for clarity, but we want to be compatible with huggingface.
      token_type_ids: Optional[Union[torch.Tensor, List[int]]] = None,
      attention_mask: Optional[Union[torch.Tensor, List[int]]] = None,
      special_tokens_mask: Optional[
          Union[torch.Tensor, List[int]]
      ] = None,
      offsets_mapping: Optional[Union[torch.Tensor, List[int]]] = None,
      padding_token_id: int = 0,
  ) -> None:
      self.input_ids = _tensorize(input_ids)
      self.token_type_ids = (
          None if token_type_ids is None else _tensorize(token_type_ids)
      )
      self.attention_mask = (
          None if attention_mask is None else _tensorize(attention_mask)
      )
      self.special_tokens_mask = (
          None
          if special_tokens_mask is None
          else _tensorize(special_tokens_mask)
      )
      self.offsets_mapping = (
          None
          if offsets_mapping is None
          else _tensorize(offsets_mapping)
      )
      self.padding_token_id = padding_token_id
  
file_path: allennlp/allennlp/data/fields/transformer_text_field.py
imports: from typing import Dict, Optional, List, Any, Union
  import torch
  import torch.nn.functional
  from allennlp.data.fields.field import Field
  from allennlp.nn import util
label_desc: Use image node_id 1 to create a new TransformerTextField object from inherited base classes: Field with example: obj = TransformerTextField(input_ids, token_type_ids, attention_mask, special_tokens_mask, offsets_mapping, padding_token_id)