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)