Skip to content
Merged
Show file tree
Hide file tree
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
3 changes: 1 addition & 2 deletions optimum/habana/trl/trainer/dpo_trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
DPODataCollatorWithPadding,
disable_dropout_in_model,
pad_to_length,
peft_module_casting_to_bf16,
)

from optimum.habana import GaudiConfig, GaudiTrainer, GaudiTrainingArguments
Expand Down Expand Up @@ -155,7 +154,7 @@ def make_inputs_require_grad(module, input, output):
# get peft model with the given config
model = get_peft_model(model, peft_config)
if args.bf16:
peft_module_casting_to_bf16(model)
model = model.to(torch.bfloat16)

# For models that use gradient_checkpoiting, we need to attach a hook that enables input
# to explicitly have `requires_grad=True`, otherwise training will either silently
Expand Down
3 changes: 1 addition & 2 deletions optimum/habana/trl/trainer/sft_trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
from trl.import_utils import is_peft_available
from trl.trainer.utils import (
DataCollatorForCompletionOnlyLM,
peft_module_casting_to_bf16,
)


Expand Down Expand Up @@ -143,7 +142,7 @@ def make_inputs_require_grad(module, input, output):

model = get_peft_model(model, peft_config)
if args.bf16:
peft_module_casting_to_bf16(model)
model = model.to(torch.bfloat16)

if tokenizer is None:
tokenizer = AutoTokenizer.from_pretrained(model.config._name_or_path)
Expand Down