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

BCOTrainer conversational dataset support #2107

Merged
merged 8 commits into from
Sep 24, 2024
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
Next Next commit
update test
  • Loading branch information
qgallouedec committed Sep 24, 2024
commit 641d7a24a69952a008671cae02d980fe99fe6d69
20 changes: 7 additions & 13 deletions tests/test_bco_trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,19 +49,19 @@ def setUp(self):

@parameterized.expand(
[
["gpt2", True, True],
["gpt2", True, False],
["gpt2", False, True],
["gpt2", False, False],
["gpt2", True, True, "standard_unpaired_preference"],
["gpt2", True, False, "standard_unpaired_preference"],
["gpt2", False, True, "standard_unpaired_preference"],
["gpt2", False, False, "standard_unpaired_preference"],
["gpt2", True, True, "conversational_unpaired_preference"],
]
)
def test_bco_trainer(self, name, pre_compute, eval_dataset):
def test_bco_trainer(self, name, pre_compute, eval_dataset, config_name):
with tempfile.TemporaryDirectory() as tmp_dir:
training_args = BCOConfig(
output_dir=tmp_dir,
per_device_train_batch_size=2,
max_steps=3,
remove_unused_columns=False,
gradient_accumulation_steps=1,
learning_rate=9e-1,
eval_strategy="steps",
Expand All @@ -70,7 +70,7 @@ def test_bco_trainer(self, name, pre_compute, eval_dataset):
report_to="none",
)

dummy_dataset = load_dataset("trl-internal-testing/zen", "standard_unpaired_preference")
dummy_dataset = load_dataset("trl-internal-testing/zen", config_name)

if name == "gpt2":
model = self.model
Expand Down Expand Up @@ -129,7 +129,6 @@ def test_tokenize_and_process_tokens(self):
output_dir=tmp_dir,
per_device_train_batch_size=2,
max_steps=3,
remove_unused_columns=False,
gradient_accumulation_steps=1,
learning_rate=9e-1,
eval_strategy="steps",
Expand Down Expand Up @@ -192,7 +191,6 @@ def test_bco_trainer_without_providing_ref_model(self):
output_dir=tmp_dir,
per_device_train_batch_size=2,
max_steps=3,
remove_unused_columns=False,
gradient_accumulation_steps=4,
learning_rate=9e-1,
eval_strategy="steps",
Expand Down Expand Up @@ -230,7 +228,6 @@ def test_bco_trainer_udm(self):
output_dir=tmp_dir,
per_device_train_batch_size=2,
max_steps=3,
remove_unused_columns=False,
gradient_accumulation_steps=4,
learning_rate=9e-1,
eval_strategy="steps",
Expand Down Expand Up @@ -289,7 +286,6 @@ def test_bco_trainer_without_providing_ref_model_with_lora(self):
output_dir=tmp_dir,
per_device_train_batch_size=2,
max_steps=3,
remove_unused_columns=False,
gradient_accumulation_steps=4,
learning_rate=9e-1,
eval_strategy="steps",
Expand Down Expand Up @@ -330,7 +326,6 @@ def test_bco_trainer_generate_during_eval_no_wandb(self):
output_dir=tmp_dir,
per_device_train_batch_size=2,
max_steps=3,
remove_unused_columns=False,
gradient_accumulation_steps=1,
learning_rate=9e-1,
eval_strategy="steps",
Expand Down Expand Up @@ -376,7 +371,6 @@ def test_bco_lora_save(self):
output_dir=tmp_dir,
per_device_train_batch_size=2,
max_steps=3,
remove_unused_columns=False,
gradient_accumulation_steps=4,
learning_rate=9e-1,
eval_strategy="steps",
Expand Down