Trainer optimizer

Hi, say I want to subclass the optimizer() method of Trainer by adding a new parameter. Then I need to change the method called the optimizer(), which is create_optimizer_and_scheduler(). Then I had to change the behavior of the flow one by one. I thought this is not an ideal way, is there any more elegant way?