the num_labels in run_squad
## ❓ Questions & Help
In the run_squad, I have not find any code to define the num_labels. In the modeling_utils, the num_labels have been default as 2, but in the Question & Answer task it may predict the start_position and end_position in the inputs. Is there the code have missing consider the reset of num_labels, or 2 is the right setting of num_labels for the task?
<!-- A clear and concise description of the question. -->

Hey @zhujun5164, 2 is the right setting of num_labels for the task. If you look at the model they use (say Bert is BertForQuestionAnswering), you'll see that they get two outputs for each position which is from the num_labels = 2. The two outputs correspond to the start_logits position and the end_logits position.

```
        outputs = self.bert(input_ids,
                            attention_mask=attention_mask,
                            token_type_ids=token_type_ids,
                            position_ids=position_ids, 
                            head_mask=head_mask)

        sequence_output = outputs[0]

        logits = self.qa_outputs(sequence_output)
        start_logits, end_logits = logits.split(1, dim=-1)
        start_logits = start_logits.squeeze(-1)
        end_logits = end_logits.squeeze(-1)
```

Does that make sense?<|||||>thanks @cformosa, and i find that in the untils_squad.py(341-357) the start_position and end_position have defined as a position number in the sentence (may be in token by word piece), it means that the run_squad predict the position number of start_position and end_position. The split(1, dim = -1) in your copy code is split half of the data in the last dim, so it easier to make me misunderstand it have predict one-hot of the start_position and end_position.<|||||>This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
