class_docstr: Custom Dataset wrapping language modeling sequences.
  
  Each sample will be retrieved by indexing the list of token_ids and their corresponding lengths.
  
  Input:
  ------
      params: `NameSpace` parameters
      data: `List[np.array[int]]
docstr: Do the padding and transform into torch.tensor.
docstr_tok: ["Do","the","padding","and","transform","into","torch.tensor","."]
code: def batch_sequences(self, batch):
      """
      Do the padding and transform into torch.tensor.
      """
      token_ids = [t[0] for t in batch]
      lengths = [t[1] for t in batch]
      assert len(token_ids) == len(lengths)
  
      # Max for paddings
      max_seq_len_ = max(lengths)
  
      # Pad token ids
      if self.params.mlm:
          pad_idx = self.params.special_tok_ids["pad_token"]
      else:
          pad_idx = self.params.special_tok_ids["unk_token"]
      tk_ = [
          list(t.astype(int)) + [pad_idx] * (max_seq_len_ - len(t))
          for t in token_ids
      ]
      assert len(tk_) == len(token_ids)
      assert all(len(t) == max_seq_len_ for t in tk_)
  
      tk_t = torch.tensor(tk_)  # (bs, max_seq_len_)
      lg_t = torch.tensor(lengths)  # (bs)
      return tk_t, lg_t
  
file_path: H2O/h2o_flexgen/benchmark/third_party/transformers/examples/research_projects/distillation/lm_seqs_dataset.py
imports: import numpy
  import torch
  from torch.utils.data import Dataset
  from utils import logger
label_desc: Use image node_id 9 for calling the LmSeqsDataset obj's underlying member method code with example usage: obj.batch_sequences(batch) and returns: tk_t,  lg_t