class_docstr: Scenario for single document text summarization.
  Currently supports the following datasets:
  1. XSum (https://arxiv.org/pdf/1808.08745.pdf)
  2. CNN/DailyMail non-anonymized (https://arxiv.org/pdf/1704.04368.pdf)
  
  Task prompt structure
  
      Summarize the given document.
      Document: {tok_1 ... tok_n}
      Summary: {tok_1 ... tok_m}
  
  Example from XSum dataset
  
      Document: {Part of the Broad Road was closed to traffic on Sunday at about 18:00 GMT.
                 The three adults and three children have been taken to Altnagelvin Hospital
                 with non life-threatening injuries. The Fire Service, Northern Ireland Ambulance Service
                 and police attended the crash. The Broad Road has since been reopened.}
      Summary: {Three adults and three children have been taken to hospital following a crash involving
                a tractor and a campervan in Limavady, County Londonderry}
class_docstr_tok: ["Scenario","for","single","document","text","summarization",".","Currently","supports","the","following","datasets",":","1",".","XSum","(","https",":","\/\/arxiv.org\/pdf\/1808.08745.pdf",")","2",".","CNN\/DailyMail","non-anonymized","(","https",":","\/\/arxiv.org\/pdf\/1704.04368.pdf",")","Task","prompt","structure","Summarize","the","given","document",".","Document",":","{","tok_1","...","tok_n","}","Summary",":","{","tok_1","...","tok_m","}","Example","from","XSum","dataset","Document",":","{","Part","of","the","Broad","Road","was","closed","to","traffic","on","Sunday","at","about","18:00","GMT",".","The","three","adults","and","three","children","have","been","taken","to","Altnagelvin","Hospital","with","non","life-threatening","injuries",".","The","Fire","Service",",","Northern","Ireland","Ambulance","Service","and","police","attended","the","crash",".","The","Broad","Road","has","since","been","reopened",".","}","Summary",":","{","Three","adults","and","three","children","have","been","taken","to","hospital","following","a","crash","involving","a","tractor","and","a","campervan","in","Limavady",",","County","Londonderry","}"]
docstr: Initializes summarization scenario.
  Args:
      dataset_name: String identifier for dataset. Currently
                    supported options ["Xsum", "cnn-dm"].
      sampling_min_length: Int indicating minimum length for training
                           documents. Training examples smaller than
                           sampling_min_length will be filtered out.
                           Useful for preventing the adapter from sampling
                           really small documents.
      sampling_max_length: Int indicating maximum length for training
                           documents. Training examples larger than
                           sampling_max_length will be filtered out.
                           Useful for preventing the adapter from
                           sampling really large documents.
      doc_max_length: Int indicating the maximum length to truncate
                      documents. Documents in all splits will be
                      truncated to doc_max_length tokens.
                      NOTE: Currently uses whitespace tokenization.
docstr_tok: ["Initializes","summarization","scenario",".","Args",":","dataset_name",":","String","identifier","for","dataset",".","Currently","supported","options","[","``","Xsum","''",",","``","cnn-dm","''","]",".","sampling_min_length",":","Int","indicating","minimum","length","for","training","documents",".","Training","examples","smaller","than","sampling_min_length","will","be","filtered","out",".","Useful","for","preventing","the","adapter","from","sampling","really","small","documents",".","sampling_max_length",":","Int","indicating","maximum","length","for","training","documents",".","Training","examples","larger","than","sampling_max_length","will","be","filtered","out",".","Useful","for","preventing","the","adapter","from","sampling","really","large","documents",".","doc_max_length",":","Int","indicating","the","maximum","length","to","truncate","documents",".","Documents","in","all","splits","will","be","truncated","to","doc_max_length","tokens",".","NOTE",":","Currently","uses","whitespace","tokenization","."]
code: def __init__(
      self,
      dataset_name: str,
      sampling_min_length: Optional[int] = None,
      sampling_max_length: Optional[int] = None,
      doc_max_length: Optional[int] = None,
  ):
      """
      Initializes summarization scenario.
      Args:
          dataset_name: String identifier for dataset. Currently
                        supported options ["Xsum", "cnn-dm"].
          sampling_min_length: Int indicating minimum length for training
                               documents. Training examples smaller than
                               sampling_min_length will be filtered out.
                               Useful for preventing the adapter from sampling
                               really small documents.
          sampling_max_length: Int indicating maximum length for training
                               documents. Training examples larger than
                               sampling_max_length will be filtered out.
                               Useful for preventing the adapter from
                               sampling really large documents.
          doc_max_length: Int indicating the maximum length to truncate
                          documents. Documents in all splits will be
                          truncated to doc_max_length tokens.
                          NOTE: Currently uses whitespace tokenization.
      """
      super().__init__()
      if dataset_name not in ["xsum", "xsum-sampled", "cnn-dm"]:
          raise Exception(f"Unknown dataset_name: {dataset_name}")
      self.dataset_name = dataset_name
      self.sampling_min_length = sampling_min_length
      self.sampling_max_length = sampling_max_length
      self.doc_max_length = doc_max_length
  
file_path: H2O/h2o_hf/helm/src/helm/benchmark/scenarios/summarization_scenario.py
imports: import os
  import pickle
  from typing import List, Optional
  from helm.common.general import ensure_file_downloaded, ensure_directory_exists
  from .scenario import Scenario, Instance, Reference, TRAIN_SPLIT, VALID_SPLIT, TEST_SPLIT, CORRECT_TAG, Input, Output
label_desc: Use image node_id 1 to create a new SummarizationScenario object from inherited base classes: Scenario with example: obj = SummarizationScenario(dataset_name, sampling_min_length, sampling_max_length, doc_max_length)