class_docstr: English CNNDM summarization dataset.
class_docstr_tok: ["English","CNNDM","summarization","dataset","."]
docstr: Initializes a Dataset wrapper for the the CNN DailyMail dataset.
  
  Args:
    split: The subset of the data to dowload from TFDS.
    max_examples: The number of examples to include from the TFDS dataset.
    max_seq_len: The maximum length to load for any document in the dataset.
    filepath: If provided, the dataset will be loaded from disk instead of
      downloaded from TFDS. This is useful for containerized demos where the
      process of downloading and processing the dataset with TFDS can cause
      the container to timeout and restart on a pseudo-inifinite loop.
docstr_tok: ["Initializes","a","Dataset","wrapper","for","the","the","CNN","DailyMail","dataset",".","Args",":","split",":","The","subset","of","the","data","to","dowload","from","TFDS",".","max_examples",":","The","number","of","examples","to","include","from","the","TFDS","dataset",".","max_seq_len",":","The","maximum","length","to","load","for","any","document","in","the","dataset",".","filepath",":","If","provided",",","the","dataset","will","be","loaded","from","disk","instead","of","downloaded","from","TFDS",".","This","is","useful","for","containerized","demos","where","the","process","of","downloading","and","processing","the","dataset","with","TFDS","can","cause","the","container","to","timeout","and","restart","on","a","pseudo-inifinite","loop","."]
code: def __init__(
      self,
      split: str = "validation",
      max_examples: Optional[int] = None,
      max_seq_len: int = 500,
      filepath: Optional[str] = None,
  ):
      """Initializes a Dataset wrapper for the the CNN DailyMail dataset.
  
      Args:
        split: The subset of the data to dowload from TFDS.
        max_examples: The number of examples to include from the TFDS dataset.
        max_seq_len: The maximum length to load for any document in the dataset.
        filepath: If provided, the dataset will be loaded from disk instead of
          downloaded from TFDS. This is useful for containerized demos where the
          process of downloading and processing the dataset with TFDS can cause
          the container to timeout and restart on a pseudo-inifinite loop.
      """
  
      if filepath:
          examples = self.load_datapoints(filepath)[:max_examples]
      else:
          ds = tfds.load(self.tfds_name, split=split)
          examples = []
          if max_examples is not None:
              ds = ds.take(max_examples)
          for record in ds:
              # format and truncate from the end to max_seq_len tokens.
              document = " ".join(
                  record["article"]
                  .numpy()
                  .decode("utf-8")
                  .replace("<br />", "")
                  .split()[-max_seq_len:]
              )
              reference = record["highlights"].numpy().decode("utf-8")
              examples.append(
                  {"document": document, "reference": reference}
              )
  
      self._examples = examples
  
file_path: lit/lit_nlp/examples/datasets/summarization.py
imports: from typing import Optional
  from lit_nlp.api import dataset
  from lit_nlp.api import types
  from lit_nlp.lib import file_cache
  import pandas
  import tensorflow_datasets
label_desc: Use image node_id 1 to create a new CNNDMData object from inherited base classes: lit_dataset with example: obj = CNNDMData(split, max_examples, max_seq_len, filepath)