# How to create custom optimizer and how does train\_args' optimizer interact with custom optimizer

**URL:** <https://discuss.huggingface.co/t/how-to-create-custom-optimizer-and-how-does-train-args-optimizer-interact-with-custom-optimizer/18925>\
**Category:** Beginners\
**Created:** [June 10, 2022, 2:17am UTC](https://discuss.huggingface.co/t/how-to-create-custom-optimizer-and-how-does-train-args-optimizer-interact-with-custom-optimizer/18925 "2022-06-10T02:17:23Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![LukeYang](https://avatars.discourse-cdn.com/v4/letter/l/ad7895/32.png) [@LukeYang](https://discuss.huggingface.co/u/LukeYang)\
**Post date:** [June 10, 2022, 2:17am UTC](https://discuss.huggingface.co/t/how-to-create-custom-optimizer-and-how-does-train-args-optimizer-interact-with-custom-optimizer/18925/1 "2022-06-10T02:17:23Z")

</div>

Currently I am trying to adding a custom optimizer to the train function by feeding an adamW and lr\_scheduler to the Seq2SeqTrainer. However, I’ve seen that Seq2SeqTrainer has an optimizers argument and Seq2SeqTrainingArguments also has a default optimizer. I wonder how do they interact?  
Moreover, I also want to let the model to iterate over multiple datasets in the training process. I wonder is that possible?
