Add cosine_with_min_lr_schedule_with_warmup_lr_rate scheduler in Trainer
Author: richardodliu
Pull request: yes

# What does this PR do?

Add cosine_with_min_lr_schedule_with_warmup_lr_rate scheduler in Trainer, which is based on https://github.com/huggingface/transformers/pull/29341.

As mentioned in the previous PR, it implemented "a warmup period during which it increases linearly between 0 and the initial learning rate set in the optimizer." However, I recently investigated the DeepSpeed framework and noticed that their function implements additional features, namely "warmup_min_ratio" in https://github.com/richardodliu/DeepSpeed/blob/master/deepspeed/runtime/lr_schedules.py#L774, which supports a warmup start learning rate ratio differs from 0. Considering that DeepSpeed is a crucial component framework in the implementation of Transformers, I aim to ensure consistency between the two in the implementation of learning rate schedulers through this PR. This is to prevent potential confusion for users who employ both frameworks simultaneously.

Our implementation is based on improvements from previous PR, providing significant benefits. Specifically, we allow the reuse of this method without modifying any input parameters(Don't worry; if you prefer to specify the parameter, you are certainly allowed to do so by simply passing it as an argument "warmup_lr_rate", which is used to specify the ratio between the start learning rate and the initial learning rate). In such cases, the implementation is equivalent to setting "warmup_lr_rate" to "1/warmup_steps". Regarding enhancements to the training process, since it is recommended to perform "optimizer.step()" before "lr_scheduler.step()", the learning rate for the batch corresponding to the first step would be zero under the previous implementation. This means that the gradients would not be updated for that batch, effectively wasting it. Our updated method addresses this issue. While this phenomenon may not be noticeable with larger dataset sizes, it becomes significant with smaller datasets where the total number of steps is limited. Additionally, our implementation ensures that the final small learning rate is reachable, rather than being updated only after the training is completed. Overall, our approach is better suited as an improvement to the existing method rather than a complete overhaul. Therefore, we implemented our idea by creating a new function, allowing users the flexibility to choose which implementation method they prefer.


Fixes: WarmupCosineLR missed in WarmupCosineLR


## Before submitting
- [ ] This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
- [x] Did you read the [contributor guideline](https://github.com/huggingface/transformers/blob/main/CONTRIBUTING.md#create-a-pull-request),
      Pull Request section?
- [ ] Was this discussed/approved via a Github issue or the [forum](https://discuss.huggingface.co/)? Please add a link
      to it if that's the case.
- [ ] Did you make sure to update the documentation with your changes? Here are the
      [documentation guidelines](https://github.com/huggingface/transformers/tree/main/docs), and
      [here are tips on formatting docstrings](https://github.com/huggingface/transformers/tree/main/docs#writing-source-documentation).
- [x] Did you write any new necessary tests?


## Who can review?

@muellerzr and @SunMarc


Comments:
The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/transformers/pr_31870). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

@muellerzr and @SunMarc : Hello, I submitted this PR over a week ago, but it hasn't been reviewed yet. I've checked the unit test results and confirmed that the failing tests don't seem to be caused by my code changes. Additionally, the test cases I've submitted are passing. Therefore, I believe this PR is ready for review.

@muellerzr and @ArthurZucker: Hello, I submitted this PR over three weeks ago, and @SunMarc has reviewed the PR. I've checked the unit test results and confirmed that the failing tests don't seem to be caused by my code changes. Additionally, the test cases I've submitted are passing. Therefore, I believe this PR is ready for merge.

I'm sorry I didn't check the relevant comments in time last fortnight due to my personal commitments, is there anything else I should be doing now? @ArthurZucker

@richardodliu do `pip install -e .[quality]; make fixup` and this should make the code quality tests pass!

now just rebasing and re-runing make fixup should work! 

@bot /style

@bot /style

Style fix is beginning .... [View the workflow run here](https://github.com/huggingface/transformers/actions/runs/16293691857).

@bot /style


Style bot fixed some files and pushed the changes.