HI Dear
i have this code
import json
with open(‘./data/squad/new_train.json’, ‘r’) as f:
squad = json.load(f)
from transformers import BertTokenizer, BertForQuestionAnswering
modelname = ‘deepset/bert-base-cased-squad2’
tokenizer1 = BertTokenizer.from_pretrained(modelname)
model1 = BertForQuestionAnswering.from_pretrained(modelname)
from transformers import pipeline
qa = pipeline(‘question-answering’, model=model1, tokenizer=tokenizer1)
answers =
qa({‘question’: squad[0][‘question’], ‘context’: squad[0][‘context’]})
and i’ve got the error:
File “C:\ProgramData\Anaconda3\lib\encodings\cp1252.py”, line 19, in encode
return codecs.charmap_encode(input,self.errors,encoding_table)[0]
UnicodeEncodeError: ‘charmap’ codec can’t encode characters in position 35-36: character maps to
Hoe could i solve this?