    def add_callback(self, callback: Callback, singleton: bool = True):
        """
        Users can add their custom callbacks into the trainer.

        Args:
            callback (`Callback`):
                Custom callback.
            singleton (`bool`):
                Whether this kind of callback is singleton.
                When singleton, the same class instance in `trainer.callbacks` will be replaced.
        """
        self.callbacks.add_callback(callback, singleton)
Users can add their custom callbacks into the trainer.

Args:
callback (`Callback`):
Custom callback.
singleton (`bool`):
Whether this kind of callback is singleton.
When singleton, the same class instance in `trainer.callbacks` will be replaced.
towhee/trainer/trainer.py