MCPcopy Create free account
hub / github.com/boyiwei/alignment-attribution-code / no_act_recording

Class no_act_recording

lib/model_wrapper.py:60–72  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

58
59
60class no_act_recording:
61 def __init__(self, model):
62 self.model = model
63
64 def __enter__(self):
65 for name, module in self.model.named_modules():
66 if isinstance(module, ActLinear):
67 module.record_activation = False
68
69 def __exit__(self, exc_type, exc_val, exc_tb):
70 for name, module in self.model.named_modules():
71 if isinstance(module, ActLinear):
72 module.record_activation = True
73
74
75class set_mask:

Callers 3

prune_wandg_v1Function · 0.70
prune_wandgFunction · 0.70
model_wrapper.pyFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected