# Missing keys when loading a model checkpoint (transformer)

**URL:** <https://discuss.huggingface.co/t/missing-keys-when-loading-a-model-checkpoint-transformer/11558>\
**Category:** Models\
**Created:** [November 10, 2021, 12:30pm UTC](https://discuss.huggingface.co/t/missing-keys-when-loading-a-model-checkpoint-transformer/11558 "2021-11-10T12:30:34Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![pem](https://avatars.discourse-cdn.com/v4/letter/p/7993a0/32.png) [@pem](https://discuss.huggingface.co/u/pem)\
**Post date:** [November 10, 2021, 12:30pm UTC](https://discuss.huggingface.co/t/missing-keys-when-loading-a-model-checkpoint-transformer/11558/1 "2021-11-10T12:30:34Z")

</div>

Downloaded bert transformer model locally, and missing keys exception is seen prior to any training

Torch 1.8.0 , Cuda 10.1 transformers 4.6.1  
bert model was locally saved using git command

`git clone https://huggingface.co/bert-base-uncased`

in the code below i am loading the model and state\_dict from the same exact folder where i have downloaded the model fresh from the huggingface repo.

```auto
from transformers import AutoModel
import torch
state_dict = torch.load(".../bert-base-uncased/pytorch_model.bin")
model = AutoModel.from_pretrained("..../bert-base-uncased/")
model.load_state_dict(state_dict, strict=False)

```

Exception

`IncompatibleKeys(missing_keys=['embeddings.position_ids', 'embeddings.word_embeddings.weight'` …

Any help is appreciated.
