code: def on_train_begin(self, **kwargs):
          "Register the `Hooks` on `self.modules`."
          if not self.modules:
              self.modules = [m for m in flatten_model(self.learn.model)
                              if hasattr(m, 'weight')]
          self.hooks = Hooks(self.modules, self.hookf on_train_begin(self, **kwargs):
          "Register the `Hooks` on `self.modules`."
          if not self.modules:
              self.modules = [m for m in flatten_model(self.learn.model)
                              if hasattr(m, 'weight')]
          self.hooks = Hooks(self.modules, self.hook)
docs: Register the `Hooks` on `self.modules`.