Skip to content
Merged
Changes from all commits
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
10 changes: 3 additions & 7 deletions examples/scripts/ppo/ppo_tldr.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@

"""
python examples/scripts/ppo/ppo_tldr.py \
--dataset_name trl-internal-testing/tldr-preference-sft-trl-style \
--dataset_name trl-lib/tldr \
--dataset_test_split validation \
--learning_rate 3e-6 \
--output_dir pythia-1b-deduped-tldr-preference-sft-trl-style-ppo \
Expand All @@ -62,7 +62,7 @@

accelerate launch --config_file examples/accelerate_configs/deepspeed_zero2.yaml \
examples/scripts/ppo/ppo_tldr.py \
--dataset_name trl-internal-testing/tldr-preference-sft-trl-style \
--dataset_name trl-lib/tldr \
--dataset_test_split validation \
--output_dir pythia-1b-deduped-tldr-preference-sft-trl-style-ppo \
--learning_rate 3e-6 \
Expand Down Expand Up @@ -134,11 +134,7 @@ def prepare_dataset(dataset, tokenizer):
"""pre-tokenize the dataset before training; only collate during training"""

def tokenize(element):
input_ids = tokenizer.apply_chat_template(
element["messages"][:1],
padding=False,
add_generation_prompt=True,
)
input_ids = tokenizer(element["prompt"], padding=False)["input_ids"]
return {"input_ids": input_ids, "lengths": len(input_ids)}

return dataset.map(
Expand Down
Loading