Hello,
I’m working thru the Question Answering with SQuAD 2.0 module.
I’m stuck in this function:
def add_token_positions(encodings, answers):
start_positions = []
end_positions = []
for i in range(len(answers)):
start_positions.append(encodings.char_to_token(i, answers[i]['answer_start']))
end_positions.append(encodings.char_to_token(i, answers[i]['answer_end'] - 1))
# if start position is None, the answer passage has been truncated
if start_positions[-1] is None:
start_positions[-1] = tokenizer.model_max_length
if end_positions[-1] is None:
end_positions[-1] = tokenizer.model_max_length
encodings.update({'start_positions': start_positions, 'end_positions': end_positions})
add_token_positions(train_encodings, train_answers)
add_token_positions(val_encodings, val_answers)
and wondering what
encodings.update({'start_positions': start_positions, 'end_positions': end_positions})
is actualing doing.
I don’t find documentation or helpful information for this. Is there any information available?
And how can I see the result of this function?
Thanks in advance!