Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enable multiple eval datasets #1052

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 16 additions & 11 deletions trl/trainer/sft_trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,17 +241,22 @@ def make_inputs_require_grad(module, input, output):
chars_per_token,
)
if eval_dataset is not None:
eval_dataset = self._prepare_dataset(
eval_dataset,
tokenizer,
packing,
dataset_text_field,
max_seq_length,
formatting_func,
infinite,
num_of_sequences,
chars_per_token,
)
_multiple = isinstance(eval_dataset, dict)
_eval_datasets = eval_dataset if _multiple else {"singleton": eval_dataset}
for _eval_dataset_name, _eval_dataset in _eval_datasets.items():
_eval_datasets[_eval_dataset_name] = self._prepare_dataset(
_eval_dataset,
tokenizer,
packing,
dataset_text_field,
max_seq_length,
formatting_func,
infinite,
num_of_sequences,
chars_per_token,
)
if not _multiple:
eval_dataset = _eval_datasets["singleton"]

if tokenizer.padding_side is not None and tokenizer.padding_side != "right":
warnings.warn(
Expand Down
Loading