add comment for example_index and unique_id in single process

This commit is contained in:
erenup 2019-12-17 11:28:34 +08:00
parent 3c6efd0ca3
commit d000195ee6
2 changed files with 3 additions and 3 deletions

View File

@ -225,7 +225,7 @@ def squad_convert_example_to_features(example, max_seq_length,
span['token_type_ids'],
cls_index,
p_mask.tolist(),
example_index=0,
example_index=0, # Can not set unique_id and example_index here. They will be set after multiple processing.
unique_id=0,
paragraph_len=span['paragraph_len'],
token_is_max_context=span["token_is_max_context"],

View File

@ -592,8 +592,8 @@ class RobertaForQuestionAnswering(BertPreTrainedModel):
start_scores, end_scores = model(torch.tensor([input_ids]))
all_tokens = tokenizer.convert_ids_to_tokens(input_ids)
print(' '.join(all_tokens[torch.argmax(start_scores) : torch.argmax(end_scores)+1]))
# a nice puppet
# Note: 'roberta-large' model can not produce the right answer above. Waiting for 'roberta-large-finetuned-squad'
a nice puppet
Note: 'roberta-large' model can not produce the right answer above. Waiting for 'roberta-large-finetuned-squad'
to be uploaded.
"""
config_class = RobertaConfig