Adds train_batch_size, eval_batch_size, and n_gpu to to_sanitized_dict output for logging.
Closes #5330 

``` 
>>> from transformers import TrainingArguments
>>> args = TrainingArguments("dir")
>>> args.to_sanitized_dict()
{
    "output_dir": "dir",
    "overwrite_output_dir": False,
    "do_train": False,
    ...
    "train_batch_size": 8,
    "eval_batch_size": 8,
    "n_gpu": 0,
}
```
# [Codecov](https://codecov.io/gh/huggingface/transformers/pull/5331?src=pr&el=h1) Report
> Merging [#5331](https://codecov.io/gh/huggingface/transformers/pull/5331?src=pr&el=desc) into [master](https://codecov.io/gh/huggingface/transformers/commit/0267668c3d648c6e41afda97f5df8671ee880ac3&el=desc) will **decrease** coverage by `1.03%`.
> The diff coverage is `80.40%`.

[![Impacted file tree graph](https://codecov.io/gh/huggingface/transformers/pull/5331/graphs/tree.svg?width=650&height=150&src=pr&token=9qOlN6Hb1c)](https://codecov.io/gh/huggingface/transformers/pull/5331?src=pr&el=tree)

```diff
@@            Coverage Diff             @@
##           master    #5331      +/-   ##
==========================================
- Coverage   77.01%   75.97%   -1.04%     
==========================================
  Files         128      138      +10     
  Lines       21615    24292    +2677     
==========================================
+ Hits        16646    18455    +1809     
- Misses       4969     5837     +868     
```


| [Impacted Files](https://codecov.io/gh/huggingface/transformers/pull/5331?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [src/transformers/configuration\_albert.py](https://codecov.io/gh/huggingface/transformers/pull/5331/diff?src=pr&el=tree#diff-c3JjL3RyYW5zZm9ybWVycy9jb25maWd1cmF0aW9uX2FsYmVydC5weQ==) | `100.00% <ø> (ø)` | |
| [src/transformers/configuration\_ctrl.py](https://codecov.io/gh/huggingface/transformers/pull/5331/diff?src=pr&el=tree#diff-c3JjL3RyYW5zZm9ybWVycy9jb25maWd1cmF0aW9uX2N0cmwucHk=) | `97.05% <ø> (ø)` | |
| [src/transformers/configuration\_distilbert.py](https://codecov.io/gh/huggingface/transformers/pull/5331/diff?src=pr&el=tree#diff-c3JjL3RyYW5zZm9ybWVycy9jb25maWd1cmF0aW9uX2Rpc3RpbGJlcnQucHk=) | `100.00% <ø> (ø)` | |
| [src/transformers/configuration\_encoder\_decoder.py](https://codecov.io/gh/huggingface/transformers/pull/5331/diff?src=pr&el=tree#diff-c3JjL3RyYW5zZm9ybWVycy9jb25maWd1cmF0aW9uX2VuY29kZXJfZGVjb2Rlci5weQ==) | `100.00% <ø> (ø)` | |
| [src/transformers/configuration\_gpt2.py](https://codecov.io/gh/huggingface/transformers/pull/5331/diff?src=pr&el=tree#diff-c3JjL3RyYW5zZm9ybWVycy9jb25maWd1cmF0aW9uX2dwdDIucHk=) | `97.22% <ø> (ø)` | |
| [src/transformers/configuration\_longformer.py](https://codecov.io/gh/huggingface/transformers/pull/5331/diff?src=pr&el=tree#diff-c3JjL3RyYW5zZm9ybWVycy9jb25maWd1cmF0aW9uX2xvbmdmb3JtZXIucHk=) | `100.00% <ø> (ø)` | |
| [src/transformers/configuration\_openai.py](https://codecov.io/gh/huggingface/transformers/pull/5331/diff?src=pr&el=tree#diff-c3JjL3RyYW5zZm9ybWVycy9jb25maWd1cmF0aW9uX29wZW5haS5weQ==) | `97.14% <ø> (ø)` | |
| [src/transformers/configuration\_reformer.py](https://codecov.io/gh/huggingface/transformers/pull/5331/diff?src=pr&el=tree#diff-c3JjL3RyYW5zZm9ybWVycy9jb25maWd1cmF0aW9uX3JlZm9ybWVyLnB5) | `100.00% <ø> (ø)` | |
| [src/transformers/configuration\_roberta.py](https://codecov.io/gh/huggingface/transformers/pull/5331/diff?src=pr&el=tree#diff-c3JjL3RyYW5zZm9ybWVycy9jb25maWd1cmF0aW9uX3JvYmVydGEucHk=) | `100.00% <ø> (ø)` | |
| [src/transformers/configuration\_t5.py](https://codecov.io/gh/huggingface/transformers/pull/5331/diff?src=pr&el=tree#diff-c3JjL3RyYW5zZm9ybWVycy9jb25maWd1cmF0aW9uX3Q1LnB5) | `96.42% <ø> (ø)` | |
| ... and [170 more](https://codecov.io/gh/huggingface/transformers/pull/5331/diff?src=pr&el=tree-more) | |

------

[Continue to review full report at Codecov](https://codecov.io/gh/huggingface/transformers/pull/5331?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/huggingface/transformers/pull/5331?src=pr&el=footer). Last update [1af58c0...161e09d](https://codecov.io/gh/huggingface/transformers/pull/5331?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
<|||||>It seems that this is also true for the wandb config logging, but instead it uses `vars(args)` instead of `args.to_sanitized_dict()`.  Is there any reason the following line is not using`to_sanitized_dict()`?

https://github.com/huggingface/transformers/blob/1af58c07064d8f4580909527a8f18de226b226ee/src/transformers/trainer.py#L330

Here's a diff between my new implementation of `arg.to_sanitized_dict()` and `vars(args)`:

```
>>> from  transformers import TrainingArguments
>>> args = TrainingArguments("some_dir")
>>> set(vars(args).items()) - set(args.to_sanitized_dict().items())
{
    ("__cached__setup_devices", (device(type="cpu"), 0)),
    ("tpu_num_cores", None),
    ("per_gpu_train_batch_size", None),
    ("per_gpu_eval_batch_size", None),
    ("save_total_limit", None),
}
>>> set(args.to_sanitized_dict().items()) - set(vars(args).items())
{
    ("tpu_num_cores", "None"),
    ("per_gpu_train_batch_size", "None"),
    ("train_batch_size", 8),
    ("n_gpu", 0),
    ("eval_batch_size", 8),
    ("per_gpu_eval_batch_size", "None"),
    ("save_total_limit", "None"),
}
```

The main difference is that in `to_sanitized_dict()` the `__cached_setup_devices` property is not saved, and instead of `None`, the value is stringified to `"None"` (and of course, with my new changes `train_batch_size`, `eval_batch_size`, and `n_gpu` are also recoreded).

Gonna add another commit to make the wandb config logging use `to_sanitized_dict`.<|||||>Hi @JetRunner , was hoping I can get an update on this PR. The test fail seems to be unrelated to my committed code.<|||||>@jaymody OK please wait for another approval 