update codecarbon
Author: nhamanasu
Pull request: yes

# What does this PR do?

- Related to https://github.com/mlco2/codecarbon/pull/391, I found we need to update codecarbon to run test_trainer.py properly in Python 3.11 or above. In current main branch, "codecarbon==1.2.0" was set, so I rewrote this to "codecarbon>=2.8.1". It properly worked.
- test_trainer.py generates some output directories which could be staged through git. I added them in .gitignore


## 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).
- [ ] Did you write any new necessary tests?


## Who can review?

Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.

- trainer: @muellerzr and @SunMarc

Comments:
- The failure of `tests_generate` will be resolved in this PR: https://github.com/huggingface/transformers/pull/35246
- The failure of `tests_torch` will be resolved in this PR: https://github.com/huggingface/transformers/pull/35249

cc @ydshieh @muellerzr @SunMarc 

will let at least one of @muellerzr or @SunMarc to approve too.

I replaced "./test", "./examples", "./generation", and "./regression" with tmp_dir.

The only part left we need to find is the causes of producing "./None" dir, I think.

Maybe I did something unnecessary...

New failure `FAILED tests/trainer/test_trainer.py::TrainerIntegrationWithHubTester::test_push_to_hub - AssertionError: '__DUMMY_TRANSFORMERS_USER__/tmpnlv7o37x' != '__DUMMY_TRANSFORMERS_USER__/tmp_mcwovml'` may be related to the part I replaced. 

Testing push_to_hub requires the checkpoint dir which is not temporary I guess?

I'm ready to revert the last commit and just leave .gitignore intact.

I want your review @SunMarc .

Hi, the last commit of changing won't work as the tmp_dir is created within the scope of 

>         with tempfile.TemporaryDirectory() as tmp_dir:

outside the `with` block, the directory is removed automatically and the sequential code blocks won't be able to access it. 

It's my trivial mistake. Thank you for pointing it out.
I'll fix them.

I guess it's good to just revert that commit , keep this PR as doing what it intends to do. For the temp. directory, we can address them in another PR (if eventually we really wish )

Thank you for your comments! I reverted the last commit, and gonna make another PR to fix tmp_dir issue. 

→ I split the PR as @ydshieh suggested: https://github.com/huggingface/transformers/pull/35266

@ydshieh cc. @SunMarc 
Thank you for your last commit to fix .gitignore!

I wonder what kind of step is left to finally merge this PR. 
If there's something l still have to do, I'd be happy if you could let me know 🙇 

@ArthurZucker We need an approval from you :-) 🙏