

TITLE
Move generic PyTorch utils function from modeling_utils.py to pytorch_utils

COMMENTS
3

REACTIONS
+1: 0
-1: 0
laugh: 0
hooray: 0
heart: 0
rocket: 0
eyes: 0

BODY
# 🚀 Feature request

> Since we're creating a new module file, can we maybe move some other functions there? Like the no_init_weight context manager, and:
> 
> all pruning stuff
> apply_chunking_to_forward
> get_parameter_device
> get_parameter_dtype
> so that the modeling utils file stays focused on PreTrainedModel and the layers it defines?

Taken from comment here: https://github.com/huggingface/transformers/pull/15498#pullrequestreview-874783288

## Motivation

<!-- Please outline the motivation for the proposal. Is your feature request
     related to a problem? e.g., I'm always frustrated when [...]. If this is related
     to another GitHub issue, please link here too. -->

## Your contribution

<!-- Is there any way that you could help, e.g. by submitting a PR?
     Make sure to read the CONTRIBUTING.MD readme:
     https://github.com/huggingface/transformers/blob/master/CONTRIBUTING.md -->
