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

Method pre_forward_hook

knn_utils/saveEmbedMulti.py:150–153  ·  view source on GitHub ↗
(self, input_ids=None, attention_mask=None, labels=None, **kwargs)

Source from the content-addressed store, hash-verified

148 return dists, knns
149
150 def pre_forward_hook(self, input_ids=None, attention_mask=None, labels=None, **kwargs):
151 self.labels = labels
152 self.input_ids = input_ids
153 return self.original_forward_func(input_ids=input_ids, labels=labels, attention_mask=attention_mask, **kwargs)
154
155 def post_forward_hook(self, module, input, output):
156 batch, time_dim, vocab_size = output.shape

Callers 1

forward_wrapperMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected