Error while downloading BertForQuestionAnswering

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

  • 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

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

from transformers import BertTokenizer, BertForQuestionAnswering

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

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