-
Notifications
You must be signed in to change notification settings - Fork 111
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] Intervention Locations more than Prefix and Suffix #122
Comments
@comeandcode Hey, what is your intervenable model config? And could you give an example of the |
Thank you very much for your reply! Consider I am applying loreft to 3 layers: [3, 6, 9], and I create a list: |
@comeandcode Thanks. This should be a basic usecase of pyvene APIs. Did you set up your call like: # run intervened forward pass
unit_locations = None
if "intervention_locations" in inputs:
unit_locations={"sources->base": (
None,
inputs["intervention_locations"].permute(1, 0, 2).tolist()
)}
_, cf_outputs = intervenable(
{
"input_ids": inputs["input_ids"],
"attention_mask": inputs["attention_mask"]
},
unit_locations=unit_locations,
labels=inputs["labels"],
subspaces=inputs["subspaces"].permute(1, 0, 2).tolist() if "subspaces" in inputs else None
) The |
Thank you for your reply! Yes, I followed the example you kindly provided in Pyreft/example/loreft, since using multiple intervention locations (3 or more) on the same layer is supported by pyvene, I will try to find out if there are any other mistakes and if so I will post them here! By the way, I found in the example/loreft, special tokens were skipped such as BOS or EOS right? Since I printed out the intervention locations and found they started from 1 but 0. So that only real prompts are intervened instead of affecting special tokens. I am not sure if I am correct on this. Thank you! |
Hi, did you find out the reason ? Thanks! |
Does the backbone pyvene support more than two intervention blocks on one layer? I met
anaconda3/envs/reft_train/lib/python3.10/site-packages/pyvene/models/intervenable_base.py", line 1092, in _wait_for_forward_with_parallel_intervention unit_locations_base[ IndexError: list index out of range
when I tried to add the third intervention block into one layer.The text was updated successfully, but these errors were encountered: