fixing a bug about gradient accumulation in codeparrot_training
# What does this PR do?

The gradient accumulation was not pausing. In order to fix this issue, I modified the training loop in order to incorporate a better use of  `Accelerator` to handle gradient accumulation.

I also modified the declaration of accelerator  in order to incorporate the argument `gradient_accumulation_steps`.

To be tested.

Fixes #22541


## Before submitting
- [ ] This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
- [ ] Did you read the [contributor guideline](https://github.com/huggingface/transformers/blob/main/CONTRIBUTING.md#start-contributing-pull-requests),
      Pull Request section?
- [x] Was this discussed/approved via a Github issue #22541 ? 
- [ ] 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).
- [ ] Did you write any new necessary tests?

@lvwerra @loubnabnl 

The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/transformers/pr_22559). All of your documentation changes will be reflected on that endpoint.<|||||>This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.

Please note that issues that do not follow the [contributing guidelines](https://github.com/huggingface/transformers/blob/main/CONTRIBUTING.md) are likely to be ignored.