Skip to content

Commit

Permalink
Update dpo_trainer.py (#1049)
Browse files Browse the repository at this point in the history
  • Loading branch information
rdk31 authored Dec 1, 2023
1 parent baa8f09 commit a60ceef
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions trl/trainer/dpo_trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -632,15 +632,15 @@ def get_batch_samples(self, model, batch: Dict[str, torch.LongTensor]) -> Tuple[
if self.ref_model is None:
with self.accelerator.unwrap_model(self.model).disable_adapter():
reference_output = self.model.generate(
batch["prompt_input_ids"],
input_ids=batch["prompt_input_ids"],
attention_mask=batch["prompt_attention_mask"],
max_length=self.max_length,
do_sample=True,
pad_token_id=self.tokenizer.pad_token_id,
)
else:
reference_output = self.ref_model.generate(
batch["prompt_input_ids"],
input_ids=batch["prompt_input_ids"],
attention_mask=batch["prompt_attention_mask"],
max_length=self.max_length,
do_sample=True,
Expand Down

0 comments on commit a60ceef

Please sign in to comment.