def predict(self, test_dataset: tf.data.Dataset) -> PredictionOutput:
    '\n        Run prediction and returns predictions and potential metrics.\n\n        Depending on the dataset and your use case, your test dataset may contain labels.\n        In that case, this method will also return metrics, like in :obj:`evaluate()`.\n\n        Args:\n            test_dataset (:class:`~tf.data.Dataset`):\n                Dataset to run the predictions on. The dataset should yield tuples of ``(features, labels)`` where\n                ``features`` is a dict of input features and ``labels`` is the labels. If ``labels`` is a tensor,\n                the loss is calculated by the model by calling ``model(features, labels=labels)``. If ``labels`` is\n                a dict, such as when using a QuestionAnswering head model with multiple targets, the loss is instead\n                calculated by calling ``model(features, **labels)``.\n        Returns:\n            `NamedTuple`:\n            predictions (:obj:`np.ndarray`):\n                The predictions on :obj:`test_dataset`.\n            label_ids (:obj:`np.ndarray`, `optional`):\n                The labels (if the dataset contained some).\n            metrics (:obj:`Dict[str, float]`, `optional`):\n                The potential dictionary of metrics (if the dataset contained labels).\n        '
    (test_ds, steps, num_examples) = self.get_test_tfdataset(test_dataset)
    return self.prediction_loop(test_ds, steps, num_examples, description='Prediction')
Run prediction and returns predictions and potential metrics.

Depending on the dataset and your use case, your test dataset may contain labels.
In that case, this method will also return metrics, like in :obj:`evaluate()`.

Args:
    test_dataset (:class:`~tf.data.Dataset`):
        Dataset to run the predictions on. The dataset should yield tuples of ``(features, labels)`` where
        ``features`` is a dict of input features and ``labels`` is the labels. If ``labels`` is a tensor,
        the loss is calculated by the model by calling ``model(features, labels=labels)``. If ``labels`` is
        a dict, such as when using a QuestionAnswering head model with multiple targets, the loss is instead
        calculated by calling ``model(features, **labels)``.
Returns:
    `NamedTuple`:
    predictions (:obj:`np.ndarray`):
        The predictions on :obj:`test_dataset`.
    label_ids (:obj:`np.ndarray`, `optional`):
        The labels (if the dataset contained some).
    metrics (:obj:`Dict[str, float]`, `optional`):
        The potential dictionary of metrics (if the dataset contained labels).
def predict(self, test_dataset: tf.data.Dataset) -> PredictionOutput:
    '\n        Run prediction and returns predictions and potential metrics.\n\n        Depending on the dataset and your use case, your test dataset may contain labels.\n        In that case, this method will also return metrics, like in :obj:`evaluate()`.\n\n        Args:\n            test_dataset (:class:`~tf.data.Dataset`):\n                Dataset to run the predictions on. The dataset should yield tuples of ``(features, labels)`` where\n                ``features`` is a dict of input features and ``labels`` is the labels. If ``labels`` is a tensor,\n                the loss is calculated by the model by calling ``model(features, labels=labels)``. If ``labels`` is\n                a dict, such as when using a QuestionAnswering head model with multiple targets, the loss is instead\n                calculated by calling ``model(features, **labels)``.\n        Returns:\n            `NamedTuple`:\n            predictions (:obj:`np.ndarray`):\n                The predictions on :obj:`test_dataset`.\n            label_ids (:obj:`np.ndarray`, `optional`):\n                The labels (if the dataset contained some).\n            metrics (:obj:`Dict[str, float]`, `optional`):\n                The potential dictionary of metrics (if the dataset contained labels).\n        '
    (test_ds, steps, num_examples) = self.get_test_tfdataset(test_dataset)
    return self.prediction_loop(test_ds, steps, num_examples, description='Prediction')