    def log_scalars(
        self,
        scalars: Dict[str, Union[int, float]],
        log_prefix: str = "",
        epoch: Optional[int] = None,
    ) -> None:
        """
        Required to be implemented by subclasses.

        Defines how batch or epoch scalar metrics are logged.
        """
        raise NotImplementedError
Required to be implemented by subclasses.

Defines how batch or epoch scalar metrics are logged.
allennlp/training/callbacks/log_writer.py