src/transformers/pipelines/question_answering.py/QuestionAnsweringPipeline/_forward
class QuestionAnsweringPipeline:    def _forward(self, model_inputs):
        features = model_inputs["features"]
        example = model_inputs["example"]
        model_input_names = self.tokenizer.model_input_names
        fw_args = {k: [feature.__dict__[k] for feature in features] for k in model_input_names}

        if self.framework == "tf":
            fw_args = {k: tf.constant(v) for (k, v) in fw_args.items()}
            start, end = self.model(fw_args)[:2]
            start, end = start.numpy(), end.numpy()
        elif self.framework == "pt":
            # Retrieve the score for the context tokens only (removing question tokens)
            fw_args = {k: torch.tensor(v, device=self.device) for (k, v) in fw_args.items()}
            # On Windows, the default int type in numpy is np.int32 so we get some non-long tensors.
            fw_args = {k: v.long() if v.dtype == torch.int32 else v for (k, v) in fw_args.items()}
            start, end = self.model(**fw_args)[:2]
            start, end = start.cpu().numpy(), end.cpu().numpy()
        return {"start": start, "end": end, "features": features, "example": example}