class_docstr: Unified interface for all CommonSense scenarios.
  
  - The "HellaSwag" benchmark from this paper:
    https://arxiv.org/pdf/1905.07830.pdf
  
  - The "OpenBookQA" benchmark from this paper:
    https://aclanthology.org/D18-1260.pdf
  
  - The "CommonSenseQA" benchmark from this paper:
    https://arxiv.org/pdf/1811.00937.pdf
  
  - The "PIQA" benchmark from this paper:
    https://arxiv.org/pdf/1911.11641.pdf
  
  - The "SIQA" benchmark from this paper:
    https://arxiv.org/pdf/1904.09728.pdf
class_docstr_tok: ["Unified","interface","for","all","CommonSense","scenarios",".","-","The","``","HellaSwag","''","benchmark","from","this","paper",":","https",":","\/\/arxiv.org\/pdf\/1905.07830.pdf","-","The","``","OpenBookQA","''","benchmark","from","this","paper",":","https",":","\/\/aclanthology.org\/D18-1260.pdf","-","The","``","CommonSenseQA","''","benchmark","from","this","paper",":","https",":","\/\/arxiv.org\/pdf\/1811.00937.pdf","-","The","``","PIQA","''","benchmark","from","this","paper",":","https",":","\/\/arxiv.org\/pdf\/1911.11641.pdf","-","The","``","SIQA","''","benchmark","from","this","paper",":","https",":","\/\/arxiv.org\/pdf\/1904.09728.pdf"]
code: def download_dataset(self):
      # Download the raw data
      data_path = os.path.join(self.output_path, "data", self.dataset)
      ensure_directory_exists(data_path)
  
      if self.dataset == "hellaswag":
          url = "https://raw.githubusercontent.com/rowanz/hellaswag/master/data/hellaswag_{}.jsonl"
          for split in ["train", "val", "test"]:
              ensure_file_downloaded(
                  source_url=url.format(split),
                  target_path=os.path.join(
                      data_path, f"hellaswag_{split}.jsonl"
                  ),
              )
      elif self.dataset == "openbookqa":
          ensure_file_downloaded(
              source_url="https://ai2-public-datasets.s3.amazonaws.com/open-book-qa/OpenBookQA-V1-Sep2018.zip",
              target_path=os.path.join(
                  data_path, "OpenBookQA-V1-Sep2018"
              ),
              unpack=True,
              unpack_type="unzip",
          )
      elif self.dataset == "commonsenseqa":
          url = "https://s3.amazonaws.com/commensenseqa/{}_rand_split.jsonl"
          split_mapping = {"train": "train", "val": "dev"}
          for split in ["train", "val"]:
              ensure_file_downloaded(
                  source_url=url.format(split_mapping[split]),
                  target_path=os.path.join(
                      data_path, f"commonsenseqa_{split}.jsonl"
                  ),
              )
      elif self.dataset == "piqa":
          url = "https://yonatanbisk.com/piqa/data/{}"
          split_mapping = {"train": "train", "val": "valid"}
          for split in ["train", "val"]:
              ensure_file_downloaded(
                  source_url=url.format(
                      f"{split_mapping[split]}.jsonl"
                  ),
                  target_path=os.path.join(
                      data_path, f"piqa_{split}_raw.jsonl"
                  ),
              )
              ensure_file_downloaded(
                  source_url=url.format(
                      f"{split_mapping[split]}-labels.lst"
                  ),
                  target_path=os.path.join(
                      data_path, f"piqa_{split}_labels.lst"
                  ),
              )
              data = [
                  json.loads(line)
                  for line in open(
                      os.path.join(data_path, f"piqa_{split}_raw.jsonl")
                  )
              ]
              labels = [
                  int(line.strip())
                  for line in open(
                      os.path.join(
                          data_path, f"piqa_{split}_labels.lst"
                      )
                  )
              ]
              assert len(data) == len(labels)
              for item, label in zip(data, labels):
                  item["label"] = label
              with open(
                  os.path.join(data_path, f"piqa_{split}.jsonl"), "w"
              ) as f:
                  for item in data:
                      f.write(json.dumps(item) + "\n")
      elif self.dataset == "siqa":
          ensure_file_downloaded(
              source_url="https://storage.googleapis.com/ai2-mosaic/public/socialiqa/socialiqa-train-dev.zip",
              target_path=os.path.join(
                  data_path, "socialiqa-train-dev"
              ),
              unpack=True,
              unpack_type="unzip",
          )
          split_mapping = {"train": "train", "val": "dev"}
          for split in ["train", "val"]:
              data = [
                  json.loads(line)
                  for line in open(
                      os.path.join(
                          data_path,
                          "socialiqa-train-dev",
                          "socialiqa-train-dev",
                          f"{split_mapping[split]}.jsonl",
                      )
                  )
              ]
              labels = [
                  int(line.strip())
                  for line in open(
                      os.path.join(
                          data_path,
                          "socialiqa-train-dev",
                          "socialiqa-train-dev",
                          f"{split_mapping[split]}-labels.lst",
                      )
                  )
              ]
              assert len(data) == len(labels)
              for item, label in zip(data, labels):
                  item["label"] = label
              with open(
                  os.path.join(data_path, f"siqa_{split}.jsonl"), "w"
              ) as f:
                  for item in data:
                      f.write(json.dumps(item) + "\n")
      else:
          raise ValueError(f"Unknown dataset: {self.dataset}")
  
file_path: H2O/h2o_hf/helm/src/helm/benchmark/scenarios/commonsense_scenario.py
imports: import json
  import os
  from typing import List
  from helm.common.general import ensure_file_downloaded, ensure_directory_exists
  from helm.common.hierarchical_logger import hlog
  from .scenario import Scenario, Instance, Reference, TRAIN_SPLIT, VALID_SPLIT, TEST_SPLIT, CORRECT_TAG, Input, Output
label_desc: Use image node_id 7 for calling the CommonSenseScenario obj's underlying member method code with example usage: obj.download_dataset() without return types