From c69551682b70aff1ffa14bb787f81af693239510 Mon Sep 17 00:00:00 2001 From: Younes Belkada <49240599+younesbelkada@users.noreply.github.com> Date: Wed, 5 Jun 2024 17:20:02 +0200 Subject: [PATCH] Update sft_trainer.py --- trl/trainer/sft_trainer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/trl/trainer/sft_trainer.py b/trl/trainer/sft_trainer.py index a11c99128e..322a950177 100644 --- a/trl/trainer/sft_trainer.py +++ b/trl/trainer/sft_trainer.py @@ -151,7 +151,7 @@ def __init__( "You passed `model_init_kwargs` to the SFTTrainer, the value you passed will override the one in the `SFTConfig`." ) args.model_init_kwargs = model_init_kwargs - if args.model_init_kwargs is None: + if getattr(args, "model_init_kwargs", None) is None: model_init_kwargs = {} elif not isinstance(model, str): raise ValueError("You passed model_init_kwargs to the SFTConfig, but your model is already instantiated.")