refactor(wandb): consolidate import
This PR consolidates the import logic of wandb as suggested [here](https://github.com/huggingface/transformers/pull/4946#discussion_r440070708)
# [Codecov](https://codecov.io/gh/huggingface/transformers/pull/5044?src=pr&el=h1) Report
> Merging [#5044](https://codecov.io/gh/huggingface/transformers/pull/5044?src=pr&el=desc) into [master](https://codecov.io/gh/huggingface/transformers/commit/f9f8a5312e92541ff9a5f483fc4907ec87da876e&el=desc) will **increase** coverage by `0.01%`.
> The diff coverage is `64.28%`.

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

```diff
@@            Coverage Diff             @@
##           master    #5044      +/-   ##
==========================================
+ Coverage   77.39%   77.40%   +0.01%     
==========================================
  Files         130      130              
  Lines       22018    22014       -4     
==========================================
  Hits        17041    17041              
+ Misses       4977     4973       -4     
```


| [Impacted Files](https://codecov.io/gh/huggingface/transformers/pull/5044?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [src/transformers/trainer\_utils.py](https://codecov.io/gh/huggingface/transformers/pull/5044/diff?src=pr&el=tree#diff-c3JjL3RyYW5zZm9ybWVycy90cmFpbmVyX3V0aWxzLnB5) | `78.26% <50.00%> (-21.74%)` | :arrow_down: |
| [src/transformers/trainer.py](https://codecov.io/gh/huggingface/transformers/pull/5044/diff?src=pr&el=tree#diff-c3JjL3RyYW5zZm9ybWVycy90cmFpbmVyLnB5) | `39.52% <100.00%> (-0.06%)` | :arrow_down: |
| [src/transformers/trainer\_tf.py](https://codecov.io/gh/huggingface/transformers/pull/5044/diff?src=pr&el=tree#diff-c3JjL3RyYW5zZm9ybWVycy90cmFpbmVyX3RmLnB5) | `18.69% <100.00%> (-0.30%)` | :arrow_down: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/huggingface/transformers/pull/5044?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/5044?src=pr&el=footer). Last update [f9f8a53...47b9975](https://codecov.io/gh/huggingface/transformers/pull/5044?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
<|||||>Thanks!