HaileyStorm
commited on
Update chess-gpt-eval-contrastive/mamba_module.py
Browse files
chess-gpt-eval-contrastive/mamba_module.py
CHANGED
@@ -97,7 +97,8 @@ class MambaPlayer:
|
|
97 |
def hook(module, input, output, layer_idx=i):
|
98 |
self.activations[layer_idx]["current"] = output[0]#.detach().cpu().numpy()
|
99 |
|
100 |
-
|
|
|
101 |
|
102 |
def get_mamba_response(self, game_state: str, temperature: float, max_new_tokens: int, top_k: int):
|
103 |
game_state = game_state.split("\n\n")[-1].strip()
|
|
|
97 |
def hook(module, input, output, layer_idx=i):
|
98 |
self.activations[layer_idx]["current"] = output[0]#.detach().cpu().numpy()
|
99 |
|
100 |
+
hook_function = partial(hook, layer_idx=i)
|
101 |
+
self.hooks.append(layer.register_forward_hook(hook_function))
|
102 |
|
103 |
def get_mamba_response(self, game_state: str, temperature: float, max_new_tokens: int, top_k: int):
|
104 |
game_state = game_state.split("\n\n")[-1].strip()
|