class_docstr: Class for Stanford NLP SHP dataset from HuggingFace
docstr: Reformat the dataset to the format required by RLHF
  
  Args:
      data (List): dataset from HuggingFace
  
  Returns:
      List[Dict]: reformatted dataset
docstr_tok: ["Reformat","the","dataset","to","the","format","required","by","RLHF","Args",":","data","(","List",")",":","dataset","from","HuggingFace","Returns",":","List","[","Dict","]",":","reformatted","dataset"]
code: def reformat_dataset(self, data: List) -> List[Dict]:
      """Reformat the dataset to the format required by RLHF
  
      Args:
          data (List): dataset from HuggingFace
  
      Returns:
          List[Dict]: reformatted dataset
      """
  
      # initialize conversations
      conversations = []
  
      # loop over the dataset
      for i, d in enumerate(data):
          if d["score_A"] > d["score_B"]:
              response = d["human_ref_A"]
          else:
              response = d["human_ref_B"]
  
          # compose user_input template
          user_input = d["history"].rstrip("\n")
          user_input = "Human: " + d["history"] + "\n\n##\n\n"
  
          # compose completion template
          completion = "Assistant: " + response
          conv = {
              "user_input": user_input,
              "completion": completion,
              "score": None,
          }
          conversations.append(conv)
  
      return conversations
  
imports: import json
  import os
  import numpy
  from beartype.typing import Dict, List, Union
  from datasets import load_dataset
  from chatllama.rlhf.config import Config, ConfigActor, ConfigReward
  from chatllama.rlhf.reward import RewardModel, CriticModel
  from chatllama.rlhf.actor import ActorModel
label_desc: Use image node_id 2 for calling the StanfordNLPSHPDataset obj's underlying member method code with example usage: obj.reformat_dataset(data) and returns: conversations