Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[P1] Add unit test for vanilla intervention at different positions and streams #32

Closed
frankaging opened this issue Jan 2, 2024 · 1 comment
Assignees

Comments

@frankaging
Copy link
Collaborator

Description:
Adding tests when using vanilla intervention on the GPT-2 model at different streams. This PR focuses on position-based intervention. It should cover a single position as well as multiple positions. It should also cover different layers.

@frankaging
Copy link
Collaborator Author

frankaging commented Jan 2, 2024

Testing Done:

...
  File "/juice/scr/wuzhengx/align-transformers/models/mlp/modelings_mlp.py", line 60, in forward
    self.act(
  File "/u/nlp/anaconda/main/anaconda3/envs/wuzhengx-bootleg/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1545, in _call_impl
    hook_result = hook(self, args, kwargs, result)
  File "/juice/scr/wuzhengx/align-transformers/models/alignable_base.py", line 604, in hook_callback
    selected_output = self._gather_intervention_output(
  File "/juice/scr/wuzhengx/align-transformers/models/alignable_base.py", line 392, in _gather_intervention_output
    selected_output = gather_neurons(
  File "/juice/scr/wuzhengx/align-transformers/models/modeling_utils.py", line 284, in gather_neurons
    tensor_output = torch.gather(
 (Triggered internally at ../torch/csrc/autograd/python_anomaly_mode.cpp:114.)
  Variable._execution_engine.run_backward(  # Calls into the C++ engine to run the backward pass
....
----------------------------------------------------------------------
Ran 13 tests in 4.751s

OK

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant