class_docstr: The ETHICS dataset is a benchmark that spans concepts in justice, well-being, duties, virtues, and commonsense morality.
code: def _generate_examples(self, filepath, split):
      with open(filepath, newline="") as f:
          if self.config.name == "utilitarianism":
              contents = csv.DictReader(
                  f, fieldnames=["activity", "baseline"]
              )
          else:
              contents = csv.DictReader(f)
          # For subsets with grouped scenarios, tag them with an id.
          group_id = 0
          for key, row in enumerate(contents):
              if self.config.name == "deontology":
                  # Scenarios come in groups of 4.
                  if key % 4 == 0 and key != 0:
                      group_id += 1
                  yield key, {
                      "group_id": group_id,
                      "label": row["label"],
                      "scenario": row["scenario"],
                      "excuse": row["excuse"],
                  }
              elif self.config.name == "justice":
                  # Scenarios come in groups of 4.
                  if key % 4 == 0 and key != 0:
                      group_id += 1
                  yield key, {
                      "group_id": group_id,
                      "label": row["label"],
                      "scenario": row["scenario"],
                  }
              elif self.config.name == "commonsense":
                  yield key, {
                      "label": row["label"],
                      "input": row["input"],
                      "is_short": row["is_short"],
                      "edited": row["edited"],
                  }
              elif self.config.name == "virtue":
                  # Scenarios come in groups of 5.
                  if key % 5 == 0 and key != 0:
                      group_id += 1
                  scenario, trait = row["scenario"].split(" [SEP] ")
                  yield key, {
                      "group_id": group_id,
                      "label": row["label"],
                      "scenario": scenario,
                      "trait": trait,
                  }
              elif self.config.name == "utilitarianism":
                  yield key, {
                      "activity": row["activity"],
                      "baseline": row["baseline"],
                      "rating": "",
                  }
  
file_path: lm-evaluation-harness/lm_eval/datasets/hendrycks_ethics/hendrycks_ethics.py
imports: import csv
  import os
  import datasets
label_desc: Use image node_id 3 for calling the HendrycksEthics obj's underlying member method code with example usage: obj._generate_examples(filepath, split) without return types