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
      """
  
      conversations = []
      for _, d in enumerate(data):
          current_conv = d["chosen"]
          split_answer = current_conv.split("Assistant:")
  
          # take all the list element in split_answer except the last one
          # and joing them with "Assistant:" in a unique string
          previous_convers = split_answer[0]
          for i, s in enumerate(split_answer[1:-1]):
              previous_convers += "Assistant:" + s
  
          # remove the last characters if they are "\n" from the previous
          # conversation
          previous_convers = previous_convers.rstrip("\n")
          user_input = previous_convers + "\n\n##\n\n"
          completion = "Assistant: " + split_answer[-1]
  
          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 AnthropicRLHF obj's underlying member method code with example usage: obj.reformat_dataset(data) and returns: conversations