MCPcopy Create free account
hub / github.com/LUMIA-Group/MemoryDecoder / post_forward_hook

Method post_forward_hook

knn_utils/saveEmbedMulti.py:415–420  ·  view source on GitHub ↗
(self, module, input, output)

Source from the content-addressed store, hash-verified

413 return self.original_forward_func(input_ids=input_ids, labels=labels, attention_mask=attention_mask, **kwargs)
414
415 def post_forward_hook(self, module, input, output):
416 captured_keys = self.activation_capturer.captured
417
418 self._save_step_data(keys = captured_keys, vals = self.labels)
419
420 return output
421
422 def register_hook(self, layer, func, pre=False):
423 handle = layer.register_forward_pre_hook(func) if pre else layer.register_forward_hook(func)

Callers

nothing calls this directly

Calls 1

_save_step_dataMethod · 0.95

Tested by

no test coverage detected