Repository navigation
What is the standard formatter of train_dataset in PPOTrainer? #3578
Replies: 1 comment
|
Hi @caoyang-sufe, I believe the difference comes down to how PPO and GRPO handle their training inputs, rather than PPO requiring a fundamentally different dataset format. In the PPO example you referenced, the dataset is pre-tokenized into def prepare_dataset(dataset, tokenizer):
"""Pre-tokenize the dataset before training."""
def tokenize(element):
outputs = tokenizer(
element[dataset_text_field],
padding=False,
)
return {"input_ids": outputs["input_ids"]}
return dataset.map(
tokenize,
batched=True,
remove_columns=dataset.column_names,
num_proc=training_args.dataset_num_proc,
)This is a preprocessing choice, not necessarily a strict requirement that every PPO dataset must be stored in this format. 1. Why does the PPO example use
|
Uh oh!
There was an error while loading. Please reload this page.
I notice that in the TRL ppo-scripts, the formatter function is written as below:
Here it directly transforms a sample to tokenized input-ids, I suggest that this is really unusual, because in the official GRPO demo (https://huggingface.co/docs/trl/grpo_trainer), the dataset still formatted as "prompt" and "completion" columns.
I means PPO is somewhat similiar to GRPO ... for there is no official demo for PPO on huggingface TRL docs
Is it special for PPO? or I can simply follows "prompt" and "completion" format?
All reactions