def evaluate(
    model_path: Optional[str] = None,
    reward_fn: Optional[Callable] = None,
    dataset: Optional[Iterable[Tuple[str, float]]] = None,
    prompts: Optional[List[str]] = None,
    eval_prompts: Optional[List[str]] = None,
    eval_plain_aes: Optional[List[str]] = None,
    metric_fn: Optional[Callable] = None,
    config: Optional[TRLConfig] = None,
    split_token: Optional[str] = None,
    logit_mask: Optional[List[List[bool]]] = None,
):
    """
    Dispatches online or offline reinforcement training depending on whether a reward function or a list of samples & rewards is given

    Args:
        model_path (Optional[str]): Path to either huggingface checkpoint or a local directory
        reward_fn (List[str] -> List[float]): Function to rate batches of generated samples
        dataset (List[str], List[float]): Lists of samples and rewards
        prompts (List[str]): Prompts to sample off from during online training
        eval_prompts (List[str]): Prompts to periodically validate training on
        metric_fn (Optional[Callable[List[str], List[float]]]): Function to compute statistics on validation samples
        split_token (Optional[str]): Split samples in the dataset on prompts and continuations
        logit_mask (Optional[List]): Bigram masking matrix
    """
    assert reward_fn is not None and eval_prompts is not None 

    if config is None:
        config = TRLConfig.load_yaml("configs/ppo_config_eval.yml")

    if model_path:
        config.model.model_path = model_path

    model: AcceleratePPOModel = get_model(config.model.model_type)(config)

    batch_size = config.train.batch_size * int(os.environ.get("WORLD_SIZE", 1))

    train_pipeline = PromptPipeline(eval_prompts, eval_plain_aes, model.tokenizer)
    eval_pipeline = PromptPipeline(eval_prompts, eval_plain_aes, model.tokenizer)
    orch: PPOOrchestrator = get_orchestrator(config.train.orchestrator)(
        model, train_pipeline, reward_fn=reward_fn, chunk_size=config.method.chunk_size
    )
    model.add_eval_pipeline(eval_pipeline)

    model.evaluate()
    return model

    Dispatches online or offline reinforcement training depending on whether a reward function or a list of samples & rewards is given

    Args:
        model_path (Optional[str]): Path to either huggingface checkpoint or a local directory
        reward_fn (List[str] -> List[float]): Function to rate batches of generated samples
        dataset (List[str], List[float]): Lists of samples and rewards
        prompts (List[str]): Prompts to sample off from during online training
        eval_prompts (List[str]): Prompts to periodically validate training on
        metric_fn (Optional[Callable[List[str], List[float]]]): Function to compute statistics on validation samples
        split_token (Optional[str]): Split samples in the dataset on prompts and continuations
        logit_mask (Optional[List]): Bigram masking matrix
    
promptist/trlx/trlx/trlx.py