(_m, args, kwargs)
| 132 | return _hook |
| 133 | |
| 134 | def _final_hook(_m, args, kwargs): |
| 135 | x = kwargs.get("hidden_states") if kwargs else None |
| 136 | if x is None and args: |
| 137 | x = args[0] |
| 138 | final_hiddens.append(x.detach().to("cpu")) |
| 139 | |
| 140 | hooks = [ |
| 141 | layer.self_attn.register_forward_pre_hook(make_hook(i), with_kwargs=True) |
nothing calls this directly
no outgoing calls
no test coverage detected