Add Type Hints to modeling_utils.py Closes #3911 (#3948)
Add Type Hints to modeling_utils.py Closes #3911 (#3948)

* Add Type Hints to modeling_utils.py Closes #3911

Add Type Hints to methods in `modeling_utils.py`

Note: The coverage isn't 100%. Mostly skipped internal methods.

* Reformat according to `black` and `isort`

* Use typing.Iterable instead of Sequence

* Parameterize Iterable by its generic type

* Use typing.Optional when None is the default value

* Adhere to style guideline

* Update src/transformers/modeling_utils.py

* Update src/transformers/modeling_utils.py

Co-authored-by: Julien Chaumond <a2e75dc0f7a441a5f83dcee1a3f7492a8c3d1d78@gmail.com>
huggingface/transformers,huggingface/transformers,huggingface/pytorch-transformers,huggingface/transformers,huggingface/transformers