    def add_callback(self, callback: Callback, singleton: bool = True):
        """
        Args:
            callback (`towhee.trainer.callback.Callback`):
                The callback need to be added.
            singleton (`bool`):
                If set true, only one instance of same `Callback` will remain in callbacklist.
        """
        if singleton:
            for old_callback in self.callbacks:
                if old_callback.__class__.__name__ == callback.__class__.__name__:
                    self.callbacks.remove(old_callback)
        self.callbacks.append(callback)
Args:
callback (`towhee.trainer.callback.Callback`):
The callback need to be added.
singleton (`bool`):
If set true, only one instance of same `Callback` will remain in callbacklist.
towhee/trainer/callback.py