def build_icl_dataloader(
    icl_task_type: str,
    dataset_uri: str,
    tokenizer: transformers.PreTrainedTokenizerBase,
    batch_size: int,
    hf_loading_vars: dict,
    hf_parsing_map: dict,
    destination_path: str = '',
    kwargs: Optional[dict[str, Any]] = None,
) -> DataSpec:
    """Factory method that builds the specific dataset for the specified.

    icl_task_type. See documentation for `get_icl_task_dataloader` for argument
    documentation.

    When writing a dataset for a new task, here you will need to:
        1. add the dataset to the factory and choose an appropriate string
        2. set the batch size for that task (see InContextLearningMultipleChoiceTaskDataset for why
            this might be different)
        3. set the `split_batch` function if necessary
    """
    # Add named parameters to kwargs
    if kwargs is None:
        kwargs = {}
    kwargs.update({
        'dataset_uri': dataset_uri,
        'tokenizer': tokenizer,
        'hf_loading_vars': hf_loading_vars,
        'hf_parsing_map': hf_parsing_map,
        'destination_path': destination_path,
    })
    dataset = construct_from_registry(
        name=icl_task_type,
        registry=registry.icl_datasets,
        partial_function=False,
        pre_validation_function=None,
        post_validation_function=None,
        kwargs=kwargs,
    )
    sampler = dist.get_sampler(dataset, drop_last=False, shuffle=False)

    return DataSpec(
        DataLoader(
            dataset,
            batch_size=dataset.get_effective_batch_size(batch_size),
            sampler=sampler,
            collate_fn=dataset.collate_fn,
        ),
        get_num_samples_in_batch=dataset.get_num_samples_in_batch,
        split_batch=dataset.split_batch,
    )
Factory method that builds the specific dataset for the specified.

    icl_task_type. See documentation for `get_icl_task_dataloader` for argument
    documentation.

    When writing a dataset for a new task, here you will need to:
        1. add the dataset to the factory and choose an appropriate string
        2. set the batch size for that task (see InContextLearningMultipleChoiceTaskDataset for why
            this might be different)
        3. set the `split_batch` function if necessary
    
llmfoundry/eval/datasets/in_context_learning_evaluation.py