| 108 | cache = {"i": 0, "attention_mask": None, "position_ids": None} |
| 109 | |
| 110 | class Catcher(nn.Module): |
| 111 | def __init__(self, module): |
| 112 | super().__init__() |
| 113 | self.module = module |
| 114 | |
| 115 | def forward(self, inp, **kwargs): |
| 116 | inps.append(inp) |
| 117 | attention_mask.append(kwargs["attention_mask"]) |
| 118 | position_ids.append(kwargs["position_ids"]) |
| 119 | # inps[cache['i']] = inp |
| 120 | # cache['i'] += 1 |
| 121 | # cache['attention_mask'] = kwargs['attention_mask'] |
| 122 | # cache['position_ids'] = kwargs['position_ids'] |
| 123 | raise ValueError |
| 124 | |
| 125 | layers[0] = Catcher(layers[0]) |
| 126 | for batch in dataloader: |
no outgoing calls
no test coverage detected