def predict(
        self,
        model: Optional[LightningModule] = None,
        dataloaders: Optional[Union[DataLoader, LightningDataModule]] = None,
        output: Union[Output, str] = None,
        **kwargs,
    ):
        r"""Run inference on your data.

        This will call the model forward function to compute predictions.
        Useful to perform distributed and batched predictions. Logging is disabled in the prediction hooks.

        Args:
            model: The model to predict with.
            dataloaders: A :class:`torch.utils.data.DataLoader` or a sequence of them,
                or a :class:`~pytorch_lightning.core.datamodule.LightningDataModule` specifying prediction samples.
            output: The :class:`~flash.core.data.io.output.Output` to use to transform predict outputs.
            kwargs: Additional keyword arguments to pass to :meth:`~pytorch_lightning.Trainer.predict`.

        Returns:
            Returns a list of dictionaries, one for each provided dataloader containing their respective predictions.

        """
        # Note: Prediction on TPU device with multi cores is not supported yet
        if isinstance(self.accelerator, TPUAccelerator) and self.num_devices > 1:
            raise NotImplementedError(
                f"Prediction on TPU device with multi-cores (requested cores: {self.num_devices}) is not supported yet."
            )
        model = model or self.lightning_module
        output_transform = getattr(model, "_output_transform", None) or OutputTransform()
        if output is None:
            output = Output()
        if isinstance(output, str) and isinstance(model, Task):
            output = getattr(model, "outputs", FlashRegistry("outputs")).get(output).from_task(model)

        old_callbacks = self.callbacks
        self.callbacks = self._merge_callbacks(self.callbacks, [TransformPredictions(output_transform, output)])

        result = super().predict(model, dataloaders, **kwargs)

        self.callbacks = old_callbacks

        return result
Run inference on your data.

        This will call the model forward function to compute predictions.
        Useful to perform distributed and batched predictions. Logging is disabled in the prediction hooks.

        Args:
            model: The model to predict with.
            dataloaders: A :class:`torch.utils.data.DataLoader` or a sequence of them,
                or a :class:`~pytorch_lightning.core.datamodule.LightningDataModule` specifying prediction samples.
            output: The :class:`~flash.core.data.io.output.Output` to use to transform predict outputs.
            kwargs: Additional keyword arguments to pass to :meth:`~pytorch_lightning.Trainer.predict`.

        Returns:
            Returns a list of dictionaries, one for each provided dataloader containing their respective predictions.

        
src/flash/core/trainer.py