class_docstr: Special purpose Data object which assumes a single text tensorizer.  Packs
  tokens into a square batch with no padding.  Used for LM training. The object
  also takes in an optional language argument which is used for cross-lingual
  LM training.
class_docstr_tok: ["Special","purpose","Data","object","which","assumes","a","single","text","tensorizer",".","Packs","tokens","into","a","square","batch","with","no","padding",".","Used","for","LM","training",".","The","object","also","takes","in","an","optional","language","argument","which","is","used","for","cross-lingual","LM","training","."]
code: def __init__(
      self,
      data_source: DataSource,
      tensorizers: Dict[str, Tensorizer],
      batcher: Batcher = None,
      max_seq_len: int = Config.max_seq_len,
      sort_key: Optional[str] = None,
      # language is used in cross-lingual LM training
      language: Optional[str] = None,
      in_memory: Optional[bool] = False,
      init_tensorizers: Optional[bool] = True,
  ):
      super().__init__(
          data_source,
          tensorizers,
          batcher,
          sort_key,
          in_memory,
          init_tensorizers,
      )
      assert len(list(self.tensorizers.items())) == 1
      self.tensorizer_name, self.tensorizer = list(
          self.tensorizers.items()
      )[0]
      self.remainder: Dict[str, List[int]] = {
          "tokens": [],
          "segment_labels": [],
      }
      self.max_seq_len = max_seq_len
      self.language = language
      self.batch = {
          Stage.TRAIN: None,
          Stage.EVAL: None,
          Stage.TEST: None,
      }
  
file_path: pytext/pytext/data/packed_lm_data.py
imports: from typing import Dict, List, Optional, Type
  from pytext.common.constants import Stage
  from pytext.data import Batcher, Data
  from pytext.data.bert_tensorizer import BERTTensorizerBase
  from pytext.data.data import RowData
  from pytext.data.sources import DataSource
  from pytext.data.tensorizers import Tensorizer, TokenTensorizer
label_desc: Use image node_id 2 to create a new PackedLMData object from inherited base classes: Data with example: obj = PackedLMData(data_source, tensorizers, batcher, max_seq_len, sort_key, language, in_memory, init_tensorizers)