stack_exchange_paired_dataset¶
- torchtune.datasets.stack_exchange_paired_dataset(tokenizer: ModelTokenizer, *, source: str = 'lvwerra/stack-exchange-paired', column_map: Optional[Dict[str, str]] = None, train_on_input: bool = False, split: str = 'train', **load_dataset_kwargs: Dict[str, Any]) PreferenceDataset [source]¶
Family of preference datasets similar to the Stack Exchange Paired dataset.
It is recommended to configure the tokenizer with the
QuestionAnswerTemplate
in conjunction with this dataset.- Parameters:
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’sload_dataset
for more details. Default islvwerra/stack-exchange-paired
.column_map (Optional[Dict[str, str]]) – a mapping to change the expected “prompt”, “chosen”, and “rejected” column names to the actual column names in the dataset. Keys should be “prompt”, “chosen”, and “rejected” and values should be the actual column names. Default is None, keeping the default column names.
train_on_input (bool) – Whether the model is trained on the prompt or not. Default is False.
split (str) –
split
argument fordatasets.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:
The preference dataset built from source paired data.
- Return type: