# Model weights warning while loading any model from HuggingFace models

**URL:** <https://discuss.huggingface.co/t/model-weights-warning-while-loading-any-model-from-huggingface-models/10147>\
**Category:** 🤗Transformers\
**Created:** [September 20, 2021, 4:16pm UTC](https://discuss.huggingface.co/t/model-weights-warning-while-loading-any-model-from-huggingface-models/10147 "2021-09-20T16:16:55Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![radhikabansal](https://avatars.discourse-cdn.com/v4/letter/r/b38774/32.png) [@radhikabansal](https://discuss.huggingface.co/u/radhikabansal)\
**Post date:** [September 20, 2021, 4:16pm UTC](https://discuss.huggingface.co/t/model-weights-warning-while-loading-any-model-from-huggingface-models/10147/1 "2021-09-20T16:16:55Z")

</div>

Hi ,  
I am trying to load the model from huggingface hub and it throws me some initialization warning. It is happening while trying to load any kind of model.

I am not able understand why this is happening. Can anyone please help me out here?

 ![image](https://us1.discourse-cdn.com/hellohellohello/original/2X/d/d6167a9fc2f139b6c00bd50e1655c5106717d247.png)

---

<div class="post-metadata">

**Author:** ![sgugger](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/sgugger/32/2291_2.png) [@sgugger](https://discuss.huggingface.co/u/sgugger)\
**Post date:** [September 20, 2021, 11:04pm UTC](https://discuss.huggingface.co/t/model-weights-warning-while-loading-any-model-from-huggingface-models/10147/2 "2021-09-20T23:04:47Z")

</div>

This warns you that some of the model weights have not been found in the checkpoint, and that there were therefore randomly initialized. This is because you are loading a model trained for masked language modeling (`bert-base-cased`) in a model for sequence classification, the classification head is randomly initialized.

The warnings ends by telling you that your model needs to be trained because of that random initialization.

---

<div class="post-metadata">

**Author:** ![radhikabansal](https://avatars.discourse-cdn.com/v4/letter/r/b38774/32.png) [@radhikabansal](https://discuss.huggingface.co/u/radhikabansal)\
**Post date:** [September 21, 2021, 3:31am UTC](https://discuss.huggingface.co/t/model-weights-warning-while-loading-any-model-from-huggingface-models/10147/3 "2021-09-21T03:31:31Z")

</div>

Hi Sylvain,

Thank you for the reply. It is very much clear now.
