# Error while downloading BertForQuestionAnswering

**URL:** <https://discuss.huggingface.co/t/error-while-downloading-bertforquestionanswering/13120>\
**Category:** Beginners\
**Created:** [December 25, 2021, 4:31am UTC](https://discuss.huggingface.co/t/error-while-downloading-bertforquestionanswering/13120 "2021-12-25T04:31:41Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![yogawicak32](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/yogawicak32/32/3549_2.png) [@yogawicak32](https://discuss.huggingface.co/u/yogawicak32)\
**Post date:** [December 25, 2021, 4:31am UTC](https://discuss.huggingface.co/t/error-while-downloading-bertforquestionanswering/13120/1 "2021-12-25T04:31:41Z")

</div>

Hi, I just ran this code:  
""from transformers import BertTokenizer, BertForQuestionAnswering

modelname = ‘deepset/bert-base-cased-squad2’

tokenizer = BertTokenizer.from\_pretrained(modelname)  
model = BertForQuestionAnswering.from\_pretrained(modelname)""

but I got an error like this:  
""OSError: Can’t load weights for ‘deepset/bert-base-cased-squad2’. Make sure that:

- ‘deepset/bert-base-cased-squad2’ is a correct model identifier listed on ‘[Models - Hugging Face](https://huggingface.co/models)’

- or ‘deepset/bert-base-cased-squad2’ is the correct path to a directory containing a file named one of pytorch\_model.bin, tf\_model.h5, model.ckpt.""

I have ensured that those bert-base-cased-squad2 is available, but it still got an error.

Any one know the solution for this problem? Thanks

---

<div class="post-metadata">

**Author:** ![satpalsr](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/satpalsr/32/3553_2.png) [@satpalsr](https://discuss.huggingface.co/u/satpalsr)\
**Post date:** [December 25, 2021, 3:08pm UTC](https://discuss.huggingface.co/t/error-while-downloading-bertforquestionanswering/13120/2 "2021-12-25T15:08:42Z")

</div>

Hey, I ran this code in Colab and works perfectly fine for me. Can you please try the below code again?

```auto
from transformers import BertTokenizer, BertForQuestionAnswering

modelname = "deepset/bert-base-cased-squad2"

tokenizer = BertTokenizer.from_pretrained(modelname)
model = BertForQuestionAnswering.from_pretrained(modelname)

```
