class_docstr: Task class for text classification.
class_docstr_tok: ["Task","class","for","text","classification","."]
docstr: Generate data for offline training.
docstr_tok: ["Generate","data","for","offline","training","."]
code: def generate_data(self):
      """Generate data for offline training."""
      if self.infer_without_label:
          column_num = 1
          text_ds = load_textline_dataset(
              self.paths_after_pre_process, column_num
          )
      else:
          column_num = 2
          label_ds, text_ds = load_textline_dataset(
              self.paths_after_pre_process, column_num
          )
  
      input_pipeline_func = self.get_input_pipeline(for_export=False)
  
      text_ds = text_ds.map(
          input_pipeline_func,
          num_parallel_calls=self.num_parallel_calls,
      )
  
      text_size_ds = text_ds.map(
          lambda x: compute_sen_lens(x, padding_token=utils.PAD_IDX),
          num_parallel_calls=self.num_parallel_calls,
      )
  
      text_ds = tf.data.Dataset.zip((text_ds, text_size_ds))
  
      if self.use_dense:
          dense = load_npy(self.dense_npy)
          dense_ds = load_dense_dataset(dense)
  
      if self.infer_without_label:
          if self.use_dense:
              data_set = tf.data.Dataset.zip((text_ds, dense_ds))
          else:
              data_set = text_ds
      else:
          label_ds = process_one_label_dataset(label_ds, self.config)
          if self.use_dense:
              data_set = tf.data.Dataset.zip(
                  (text_ds, dense_ds, label_ds)
              )
          else:
              data_set = tf.data.Dataset.zip((text_ds, label_ds))
  
      vocab_dict = load_vocab_dict(self.text_vocab_file_path)
      vocab_size = len(vocab_dict)
      if self.use_true_length and self.split_token != "":
          if self.split_token not in vocab_dict:
              raise ValueError(
                  "The Model uses split token: {}, not in corpus.".format(
                      self.split_token
                  )
              )
          self.config["data"]["split_token"] = int(
              vocab_dict[self.split_token]
          )
      self.config["data"]["vocab_size"] = vocab_size
      self.config["data"][
          "{}_data_size".format(self.mode)
      ] = get_file_len(self.paths_after_pre_process)
  
      return data_set
  
file_path: delta/delta/data/task/text_cls_task.py
imports: import collections
  import delta.compat
  from absl import logging
  from delta.data.task.base_text_task import TextTask
  from delta.data.utils.common_utils import load_npy
  from delta.data.utils.common_utils import get_file_len
  from delta.data.preprocess.text_ops import process_one_label_dataset
  from delta.data.preprocess.text_ops import load_dense_dataset
  from delta.data.preprocess.utils import load_vocab_dict
  from delta.data.preprocess.text_ops import load_textline_dataset
  from delta import utils
  from delta.utils.register import registers
  from delta.layers.utils import compute_sen_lens
label_desc: Use image node_id 2 for calling the TextClsTask obj's underlying member method code with example usage: obj.generate_data() and returns: data_set