MCPcopy Create free account
hub / github.com/OpenBitSys/BitDistiller / Catcher

Class Catcher

test/general/wiki_ppl.py:63–74  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

61 cache = {'i': 0, 'attention_mask': None}
62
63 class Catcher(nn.Module):
64
65 def __init__(self, module):
66 super().__init__()
67 self.module = module
68
69 def forward(self, inp, **kwargs):
70 inps[cache['i']] = inp
71 cache['i'] += 1
72 cache['attention_mask'] = kwargs['attention_mask']
73 cache['position_ids'] = kwargs['position_ids']
74 raise ValueError
75
76 layers[0] = Catcher(layers[0])
77 for i in range(nsamples):

Callers 1

llama_evalFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected