Project: 001_RM-Bench_Benchmarking_Reward_Models_of_Language_Mo | Function: convert_robust_dataset_to_preference_dataset_list (iclr)

system: You are an expert Python programmer implementing algorithms from scientific papers.
Complete the masked function based on the algorithm description.
Follow Python best practices and maintain consistent code style.
Return **only** the complete Python function code.

user: Complete this Python function:

**DESCRIPTION:** Core data processing function converting robust datasets with multiple chosen/rejected pairs into standard preference dataset format. Transforms each sample's multiple (chosen[i], rejected[i]) pairs into separate preference datasets, enabling the paper's robustness evaluation framework.

**KEY TERMS:** {
  "robust_dataset": "Robust dataset format with multiple paired responses",
  "preference_dataset_list": "List of standard preference learning datasets after conversion",
  "chosen": "Chosen responses - positive examples in preference learning",
  "rejected": "Rejected responses - negative examples in preference learning",
  "num_pairs": "Number of comparison pairs per sample"
}

**CONTEXT CODE:** import logging
import numpy as np
from typing import List, Dict, Any, Tuple
import json
from datasets import Dataset, load_from_disk

try:
    from fastchat.conversation import Conversation
    from datasets import DatasetDict, Value, concatenate_datasets, load_dataset
    from transformers import PreTrainedTokenizer
    from rewardbench.utils import check_tokenizer_chat_template, prepare_dialogue, prepare_dialogue_from_tokenizer
    HAS_OPTIONAL_DEPS = True
except ImportError:
    HAS_OPTIONAL_DEPS = False
EXTRA_PREF_SETS = "allenai/pref-test-sets"

def convert_robust_dataset_to_preference_dataset_list(robust_dataset_path: str) -> List[Dataset]:
    raise NotImplementedError("Function implementation has been masked for testing")
    
def split_dataset_by_domain(dataset: List[Dict[str, Any]]) -> Dict[str, List[Dict[str, Any]]]:
    domains = ["chat","math","code","safety"]
    domain_dataset_dict = {}
    for domain in domains:
        domain_dataset_dict[domain] = [example for example in dataset if example['domain'].startswith(domain)]
    
    # pop the domain keys
    for domain in domain_dataset_dict:
        for example in domain_dataset_dict[domain]:
            example.pop('domain')
    
    return domain_dataset_dict


def compute_accuracy(results: List[Dict[str, Any]]) -> Dict[str, float]:
    raise NotImplementedError("Function implementation has been masked for testing")
    
def load_eval_dataset(
    raw_Dataset: Dataset = None,
    core_set: bool = True,
    custom_dialogue_formatting: bool = False,
    conv: Conversation = None,
    tokenizer: PreTrainedTokenizer = None,
    logger: logging.Logger = None,
    keep_columns: List[str] = ["text_chosen", "text_rejected", "id"],
    return_extra_data: bool = False,
    max_turns: int = None,
) -> Tuple[Dataset, List[str]]:
    """
    Loads either the core eval set for HERM or the existing preference data test sets.

    Args:
        core_set: if True, load the core eval set for HERM.
        custom_dialogue_formatting: if True, format the dialogue as needed for custom models (e.g. SHP and PairRM).
        conv: fastchat conversation template.
                If None (default) the passed tokenizer needs to have a usable chat template.
        tokenizer: HuggingFace tokenizer to use. The tokenizer's chat template, if available, has precedence over conv.
        logger: logger to use for logging. If None (default), no logging is done.
        keep_columns: list of columns to keep in the dataset.
        max_turns: maximum number of turns in the dialogue (usually even). If None (default), no filtering is done.

    Returns:
        dataset: loaded dataset with required properties.
        subsets: list of subsets for the corresponding samples in the dataset.
    """
    if raw_Dataset is not None:
        raw_dataset = raw_Dataset
    elif core_set:
        raw_dataset = load_from_disk("data/reward-bench")
        raw_dataset = raw_dataset['filtered']
    else:
        raw_dataset = load_dataset(EXTRA_PREF_SETS)
        modified_datasets = []

        # Iterate over each subset in the DatasetDict
        for subset_name, subdataset in raw_dataset.items():
            # if subset column exists, move to subsubset (for pref sets)
            if "subset" in subdataset.column_names:
                subdataset = subdataset.rename_column("subset", "subsubset")

            # Add a new column 'subset' to the dataset with the subset name
            subdataset = subdataset.add_column("subset", [subset_name] * len(subdataset))

            # Append the modified dataset to the list
            # remove pku_safer and pku_better from the dict, no longer part of the benchmark
            if subset_name not in ["pku_safer", "pku_better"]:
                modified_datasets.append(subdataset)

        # Concatenate all the modified datasets into one dataset
        raw_dataset = concatenate_datasets(modified_datasets)

    # Apply chat template
    if not custom_dialogue_formatting:
        usable_tokenizer = check_tokenizer_chat_template(tokenizer)

        # assert either conv is passed or tokenizer has chat_template
        assert conv is not None or usable_tokenizer

        if usable_tokenizer:
            if logger is not None:
                logger.info("*** Preparing dataset with HF Transformers ***")
            # docs https://huggingface.co/docs/transformers/main/en/chat_templating
            dataset = raw_dataset.map(
                prepare_dialogue_from_tokenizer,
                fn_kwargs={"tokenizer": tokenizer},
                num_proc=8,
                load_from_cache_file=False,
            )

        # else use FastChat to get chat template
        else:
            if logger is not None:
                logger.info("*** Preparing dataset with FastChat ***")
            dataset = raw_dataset.map(
                prepare_dialogue,
                fn_kwargs={"dialogue_template": conv},
                num_proc=8,  # using >1 process causes issues with re-assigning prompt in example


Complete the function implementation replacing "raise NotImplementedError".