Skip to content

Commit

Permalink
model init when args are given (huggingface#1413)
Browse files Browse the repository at this point in the history
Co-authored-by: Lewis Tunstall <lewis.c.tunstall@gmail.com>
  • Loading branch information
kashif and lewtun committed Mar 15, 2024
1 parent 291adae commit cd0b4c9
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions trl/trainer/kto_trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,13 +126,17 @@ def __init__(
model_init_kwargs = {}
elif not isinstance(model, str):
raise ValueError("You passed model_kwargs to the KTOTrainer. But your model is already instantiated.")
else:
model_init_kwargs = args.model_init_kwargs

if args.ref_model_init_kwargs is None:
ref_model_init_kwargs = {}
elif not isinstance(ref_model, str):
raise ValueError(
"You passed ref_model_kwargs to the KTOTrainer. But your ref_model is already instantiated."
)
else:
ref_model_init_kwargs = args.ref_model_init_kwargs

if isinstance(model, str):
warnings.warn(
Expand Down

0 comments on commit cd0b4c9

Please sign in to comment.