# AttributeError: 'TrainingArguments' object has no attribute 'model\_init\_kwargs'

**URL:** <https://discuss.huggingface.co/t/attributeerror-trainingarguments-object-has-no-attribute-model-init-kwargs/90080>\
**Category:** Beginners\
**Created:** [June 3, 2024, 1:41pm UTC](https://discuss.huggingface.co/t/attributeerror-trainingarguments-object-has-no-attribute-model-init-kwargs/90080 "2024-06-03T13:41:09Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![sgchavan09](https://avatars.discourse-cdn.com/v4/letter/s/34f0e0/32.png) [@sgchavan09](https://discuss.huggingface.co/u/sgchavan09)\
**Post date:** [June 3, 2024, 1:41pm UTC](https://discuss.huggingface.co/t/attributeerror-trainingarguments-object-has-no-attribute-model-init-kwargs/90080/1 "2024-06-03T13:41:09Z")

</div>

I have set the training parameters like this:

```training_arguments
    output_dir="./results",
    num_train_epochs=1,
    per_device_train_batch_size=4,
    gradient_accumulation_steps=1,
    optim="paged_adamw_32bit",
    save_steps=0,
    logging_steps=25,
    learning_rate=2e-4,
    weight_decay=0.001,
    fp16=False,
    bf16=False,
    max_grad_norm=0.3,
    max_steps=-1,
    warmup_ratio=0.03,
    group_by_length=True,
    lr_scheduler_type="True",
    report_to="tensorboard"
)

# Set supervised fine-tuning parameters
trainer = SFTTrainer(
    model=model,
    train_dataset=tokenized_dataset["train"],
    peft_config=peft_config,
    dataset_text_field="formatted_instruction",
    max_seq_length=max_seq_length,
    tokenizer=tokenizer,
    args=training_arguments,
    #args=SFTConfig(output_dir="/home/operation/snehal_code/tmp"),
    packing=packing, 
)

trainer.train()
trainer.model.save_pretrained(new_model)

```

I have got the following error:

```auto
~/venv/lib/python3.33/site-packages/huggingface_hub/utils/deprecation.py:101, in _deprecate_arguments.<locals>._inner_deprecate_positional_args.<locals>.inner_f(*args, **kwargs)
        message += "\n\n" + custom_message
     warnings.warn(message, FutureWarning)
return f(*args, **kwargs)

warnings.warn(
 "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:
          model_init_kwargs = {}
elif not isinstance(model, str):

packages/trl/trainer/sft_trainer.py:156) elif not isinstance(model, str): AttributeError: 'TrainingArguments' object has no attribute 'model_init_kwargs'

```

I do not understand where exactly attribute model\_init\_kwargs is and how I can resolve this error.

Any help in this would be highly appreciable!
