stanfordnlp / pyvene

Stanford NLP Python Library for Understanding and Improving PyTorch Models via Interventions
http://pyvene.ai
Apache License 2.0
559 stars 50 forks source link

Bug in BoundlessRotatedSpaceIntervention #73

Closed jiudingsun01 closed 6 months ago

jiudingsun01 commented 6 months ago

In the new version, self.embed_dim in line 262 in interventions.py is initialized as None and never assigned value. This will cause the failure of running Doundless_DAS.ipynb:

Traceback (most recent call last): File "/work/frink/sun.jiu/function_vectors/src/compute_rotational_subspace.py", line 300, in intervenable = IntervenableModel(intervenable_config, model) File "/work/frink/sun.jiu/miniconda3/envs/fv/lib/python3.10/site-packages/pyvene/models/intervenable_base.py", line 111, in init intervention = intervention_function( File "/work/frink/sun.jiu/miniconda3/envs/fv/lib/python3.10/site-packages/pyvene/models/interventions.py", line 265, in init torch.arange(0, self.embed_dim), requires_grad=False TypeError: arange() received an invalid combination of arguments - got (int, NoneType), but expected one of:

Simply changing the line into:

self.embed_dim = embed_dim

Would solve the issue.

jiudingsun01 commented 6 months ago

Issue already fixed. I was running under a previous version. Sorry about the confusion.