§
    ÇPƒi·  ã                   óÂ   — d dl mZmZmZmZ d dlmZ d dlmZ d dl	m
Z
 ddddddd	œd
e
dedeeeef                  dedee         dee         dedeeef         defd„ZdS )é    )ÚAnyÚCallableÚDictÚOptional)ÚChosenRejectedToMessages)ÚPreferenceDataset)ÚModelTokenizerz RLHFlow/HH-RLHF-Helpful-standardNFÚtrain)ÚsourceÚ
column_mapÚtrain_on_inputÚnew_system_promptÚ	filter_fnÚsplitÚ	tokenizerr   r   r   r   r   r   Úload_dataset_kwargsÚreturnc          	      óJ   — t          |||¬¦  «        }t          d||| ||dœ|¤ŽS )að  
    Constructs preference datasets similar to `Anthropic's helpful/harmless RLHF
    data
    <https://huggingface.co/datasets/RLHFlow/HH-RLHF-Helpful-standard>`_. This is
    the processed helpful subset of the original dataset in a standardized format.

    Args:
        tokenizer (ModelTokenizer): Tokenizer used by the model that implements the ``tokenize_messages`` method.
        source (str): path to dataset repository on Hugging Face. For local datasets,
            define source as the data file type (e.g. "json", "csv", "text") and pass
            in the filepath in ``data_files``. See Hugging Face's ``load_dataset``
            (https://huggingface.co/docs/datasets/en/package_reference/loading_methods#datasets.load_dataset.path)
            for more details. Default is ``RLHFlow/HH-RLHF-Helpful-standard``.
        column_map (Optional[Dict[str, str]]): a mapping from the expected columns "chosen" and "rejected"
            in the message transform :class:`~torchtune.data.ChosenRejectedToMessages` to the new column names in
            the dataset. Keys should be "chosen" and "rejected" and values should be the actual column names.
            If None, keep the default columns "chosen" and "rejected".
        train_on_input (bool): Whether the model is trained on the prompt or not. Default is False.
        new_system_prompt (Optional[str]): if specified, prepend a system message to every sample for both chosen
            and rejected. This can serve as instructions to guide the model response. Setting this will OVERRIDE
            any system messages already present in the dataset. Default is None.
        filter_fn (Optional[Callable]): callable used to filter the dataset prior to any pre-processing. See
            the Hugging Face `docs <https://huggingface.co/docs/datasets/v2.20.0/process#select-and-filter>`_ for more
            details.
        split (str): ``split`` argument for ``datasets.load_dataset``. You can use this argument to load a subset
            of a given split, e.g. ``split="train[:10%]"``. Default is "train".
        **load_dataset_kwargs (Dict[str, Any]): additional keyword arguments to pass to ``load_dataset``.

    Returns:
        PreferenceDataset: The preference dataset built from source paired data.
    )r   r   r   )r   Úmessage_transformr   r   r   © )r   r   )	r   r   r   r   r   r   r   r   r   s	            úw/home/jaya/work/projects/VOICE-AGENT/VIET/agent-env/lib/python3.11/site-packages/torchtune/datasets/_hh_rlhf_helpful.pyÚhh_rlhf_helpful_datasetr      sZ   € õV 1Ø%ØØ+ðñ ô Ðõ ð ØØ+ØØØðð ð ðð ð ó    )Útypingr   r   r   r   Útorchtune.datar   Útorchtune.datasets._preferencer   Ú'torchtune.modules.transforms.tokenizersr	   ÚstrÚboolr   r   r   r   ú<module>r       s  ðð 1Ð 0Ð 0Ð 0Ð 0Ð 0Ð 0Ð 0Ð 0Ð 0Ð 0Ð 0à 3Ð 3Ð 3Ð 3Ð 3Ð 3Ø <Ð <Ð <Ð <Ð <Ð <Ø BÐ BÐ BÐ BÐ BÐ Bð 5Ø+/Ø Ø'+Ø$(Øð8ð 8ð 8Øð8ð ð8ð ˜˜c 3˜hœÔ(ð	8ð
 ð8ð   ”}ð8ð ˜Ô!ð8ð ð8ð    S œ>ð8ð ð8ð 8ð 8ð 8ð 8ð 8r   