def get_callbacks(self):
        """
        An InputSource might need some extra maintenance during training,
        which is done also through the Callback interface.
        This method returns the callbacks and the return value will be memoized.

        All callbacks will be automatically marked as `chief_only=False`,
        so they will run on all nodes.

        Callbacks returned by :class:`InputSource` only supports a subset of callback's functionalities:

        1. It cannot access the trainer, because an :class:`InputSource` can be used in pure inference.
        2. It cannot use the following methods: `trigger_{step,epoch}, {before,after}_epoch`.

        In other words, these callbacks should only have the basic functionality of `tf.train.SessionRunHooks`.

        Returns:
            list[Callback]: extra callbacks needed by this InputSource.
        """
        assert self.setup_done()
        ret = [CallbackFactory(
            before_train=lambda _: self.reset_state())] + self._get_callbacks()

        for r in ret:
            r.set_chief_only(False)    # no input callbacks should be chief-only
        return ret

        An InputSource might need some extra maintenance during training,
        which is done also through the Callback interface.
        This method returns the callbacks and the return value will be memoized.

        All callbacks will be automatically marked as `chief_only=False`,
        so they will run on all nodes.

        Callbacks returned by :class:`InputSource` only supports a subset of callback's functionalities:

        1. It cannot access the trainer, because an :class:`InputSource` can be used in pure inference.
        2. It cannot use the following methods: `trigger_{step,epoch}, {before,after}_epoch`.

        In other words, these callbacks should only have the basic functionality of `tf.train.SessionRunHooks`.

        Returns:
            list[Callback]: extra callbacks needed by this InputSource.
        
tensorpack/input_source/input_source_base.py