NotImplementedError: Cannot copy out of meta tensor; no data!
Author: 1390806607
Pull request: no

### System Info
```
Package                      Version
---------------------------- ------------
absl-py                      1.4.0
accelerate                   0.21.0
aiohttp                      3.8.4
aiosignal                    1.3.1
aliyun-python-sdk-core       2.13.36
aliyun-python-sdk-kms        2.16.1
annotated-types              0.6.0
antlr4-python3-runtime       4.9.3
anyio                        3.7.1
apphub                       1.0.0
argon2-cffi                  21.3.0
argon2-cffi-bindings         21.2.0
arrow                        1.2.3
asttokens                    2.2.1
astunparse                   1.6.3
async-timeout                4.0.2
attrs                        23.1.0
Babel                        2.12.1
backcall                     0.2.0
beautifulsoup4               4.12.2
bitsandbytes                 0.40.2
bleach                       6.0.0
blessed                      1.20.0
boltons                      23.0.0
brotlipy                     0.7.0
cachetools                   5.3.1
certifi                      2023.7.22
cffi                         1.15.1
chardet                      3.0.4
charset-normalizer           2.0.4
click                        7.1.2
cmake                        3.25.0
comm                         0.1.4
conda                        23.7.2
conda-content-trust          0.1.3
conda-libmamba-solver        23.5.0
conda-package-handling       2.1.0
conda_package_streaming      0.8.0
contourpy                    1.2.0
crcmod                       1.7
croniter                     1.3.15
cryptography                 39.0.1
cycler                       0.12.1
dateutils                    0.6.12
debugpy                      1.6.7
decorator                    5.1.1
deepdiff                     6.3.1
defusedxml                   0.7.1
diffusers                    0.18.2
ecdsa                        0.18.0
exceptiongroup               1.1.2
executing                    1.2.0
fastapi                      0.88.0
fastjsonschema               2.18.0
featurize                    0.0.24
filelock                     3.9.0
flatbuffers                  23.5.26
fonttools                    4.44.0
frozenlist                   1.4.0
fsspec                       2024.3.1
gast                         0.4.0
google-auth                  2.22.0
google-auth-oauthlib         1.0.0
google-pasta                 0.2.0
grpcio                       1.56.0
gunicorn                     21.2.0
h11                          0.14.0
h5py                         3.9.0
httpcore                     0.17.3
httptools                    0.6.1
httpx                        0.24.1
huggingface-hub              0.22.2
idna                         2.10
imageio                      2.31.1
imageio-ffmpeg               0.4.8
importlib-metadata           6.8.0
inquirer                     3.1.3
install                      1.3.5
ipykernel                    6.25.0
ipython                      8.14.0
ipython-genutils             0.2.0
itsdangerous                 2.1.2
jaxtyping                    0.2.20
jedi                         0.19.0
Jinja2                       3.1.2
jmespath                     0.10.0
joblib                       1.3.2
json5                        0.9.14
jsonpatch                    1.32
jsonpointer                  2.1
jsonschema                   4.18.6
jsonschema-specifications    2023.7.1
jupyter_client               8.3.0
jupyter_core                 5.3.1
jupyter-server               1.24.0
jupyterlab                   3.2.9
jupyterlab-pygments          0.2.2
jupyterlab_server            2.24.0
keras                        2.13.1
kiwisolver                   1.4.5
lazy_loader                  0.3
libclang                     16.0.6
libigl                       2.4.1
libmambapy                   1.4.1
lightning                    2.0.0
lightning-cloud              0.5.37
lightning-utilities          0.9.0
lit                          15.0.7
Markdown                     3.4.3
MarkupSafe                   2.1.2
matplotlib                   3.7.2
matplotlib-inline            0.1.6
mdurl                        0.1.2
mistune                      3.0.1
mpmath                       1.2.1
multidict                    6.0.4
nbclassic                    0.2.8
nbclient                     0.8.0
nbconvert                    7.7.3
nbformat                     5.9.2
nerfacc                      0.5.2
nest-asyncio                 1.5.7
networkx                     3.0
ninja                        1.11.1
notebook                     6.4.12
numpy                        1.24.1
nvdiffrast                   0.3.1
oauthlib                     3.2.2
omegaconf                    2.3.0
opencv-python                4.8.1.78
opt-einsum                   3.3.0
ordered-set                  4.1.0
oss2                         2.18.1
packaging                    23.0
pandas                       2.1.2
pandocfilters                1.5.0
parso                        0.8.3
peft                         0.10.0
pexpect                      4.8.0
pickleshare                  0.7.5
Pillow                       9.3.0
pip                          23.1.2
platformdirs                 3.10.0
pluggy                       1.0.0
prometheus-client            0.17.1
prompt-toolkit               3.0.39
protobuf                     4.23.4
psutil                       5.9.5
ptyprocess                   0.7.0
pure-eval                    0.2.2
pyasn1                       0.5.0
pyasn1-modules               0.3.0
pycosat                      0.6.4
pycparser                    2.21
pycryptodome                 3.18.0
pydantic                     1.10.11
pydantic_core                2.10.1
Pygments                     2.15.1
PyJWT                        2.8.0
pyOpenSSL                    23.0.0
pyparsing                    3.0.9
PySocks                      1.7.1
python-dateutil              2.8.2
python-dotenv                1.0.0
python-editor                1.0.4
pytorch-lightning            2.0.5
pytz                         2023.3.post1
PyYAML                       6.0.1
pyzmq                        25.1.0
readchar                     4.0.5
referencing                  0.30.0
regex                        2023.12.25
requests                     2.31.0
requests-oauthlib            1.3.1
rich                         13.4.2
rpds-py                      0.9.2
rsa                          4.9
ruamel.yaml                  0.17.21
ruamel.yaml.clib             0.2.6
safetensors                  0.4.2
scikit-image                 0.22.0
scikit-learn                 1.3.2
scipy                        1.11.3
seaborn                      0.13.0
Send2Trash                   1.8.2
sentencepiece                0.1.99
setuptools                   67.8.0
six                          1.16.0
sniffio                      1.3.0
socksio                      1.0.0
soupsieve                    2.4.1
sshpubkeys                   3.3.1
stack-data                   0.6.2
starlette                    0.22.0
starsessions                 1.3.0
sympy                        1.11.1
tabulate                     0.8.7
tensorboard                  2.13.0
tensorboard-data-server      0.7.1
tensorflow                   2.13.0
tensorflow-estimator         2.13.0
tensorflow-io-gcs-filesystem 0.33.0
termcolor                    2.3.0
terminado                    0.17.1
threadpoolctl                3.2.0
tifffile                     2023.9.26
tinycss2                     1.2.1
tokenizers                   0.15.2
toolz                        0.12.0
torch                        2.0.1+cu118
torchaudio                   2.0.2+cu118
torchmetrics                 1.0.1
torchvision                  0.15.2+cu118
tornado                      6.3.2
tqdm                         4.65.0
traitlets                    5.9.0
transformers                 4.39.3
trimesh                      3.22.4
triton                       2.0.0
typing_extensions            4.8.0
tzdata                       2023.3
urllib3                      1.25.11
uvicorn                      0.23.1
uvloop                       0.19.0
watchfiles                   0.21.0
wcwidth                      0.2.6
webencodings                 0.5.1
websocket-client             1.2.1
websockets                   11.0.3
Werkzeug                     2.3.6
wheel                        0.38.4
workspace                    0.1.0
wrapt                        1.15.0
xatlas                       0.0.7
yarl                         1.9.2
zstandard                    0.19.0
```
### Who can help?

@younesbelkada            @ArthurZucker

### Information

- [ ] The official example scripts
- [X] My own modified scripts

### Tasks

- [ ] An officially supported task in the `examples` folder (such as GLUE/SQuAD, ...)
- [ ] My own task or dataset (give details below)

### Reproduction
```python 
from transformers import AutoTokenizer, AutoModel, AutoModelForCausalLM
from peft import get_peft_model, LoraConfig, TaskType, PeftModel
from dataclasses import dataclass, field
from typing import List, Optional, Tuple, Union

import torch
import torch.nn as nn



model = AutoModelForCausalLM.from_pretrained(
                'mistralai/Mistral-7B-Instruct-v0.2',
                trust_remote_code= True,
                device_map='auto',
                force_download=True, 
                resume_download= False,

            )

model = model.to('cuda')
```
### Expected behavior

Model loading success

Comments:
Sorry but you are using `device_map` and then you want to put the model on `cuda` that is not supported. You should use either

This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.

Please note that issues that do not follow the [contributing guidelines](https://github.com/huggingface/transformers/blob/main/CONTRIBUTING.md) are likely to be ignored.