Open Claus1 opened 1 year ago
We changed the name, use output_3.primary_attributions()
instead. Check here for more options and information.
After change it to output_3.primary_attributions()
, I got following errors:
╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮
│ in <module>:3 │
│ │
│ 1 text= "The countries of the European Union are:\n1. Austria\n2. Belgium\n3. Bulgaria\n4. │
│ 2 output = lm.generate(text, generate=20, do_sample=True) │
│ ❱ 3 output.primary_attributions() │
│ 4 │
│ │
│ /home/xxx/anaconda3/envs/py39/lib/python3.9/site-packages/ecco/output.py:252 in │
│ primary_attributions │
│ │
│ 249 │ │ importance_id = position - self.n_input_tokens │
│ 250 │ │ tokens = [] │
│ 251 │ │ │
│ ❱ 252 │ │ assert attr_method in self.attribution, \ │
│ 253 │ │ │ f"attr_method={attr_method} not found. Choose one of the following: {list(se │
│ 254 │ │ attribution = self.attribution[attr_method] │
│ 255 │ │ for idx, token in enumerate(self.tokens[0]): │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
AssertionError: attr_method=grad_x_input not found. Choose one of the following: []
Any ideas?
Right, you need to pass attribution="grad_x_input"
in the lm.generate
call
thx, after passing attribution=["grad_x_input"]
in the lm.generate()
, it works!
captum 0.5.0 torch 1.13.0+cu117
Language_Models_and_Ecco_PyData_Khobar.ipynb
AttributeError Traceback (most recent call last) Cell In [13], line 1 ----> 1 output_3.saliency()
AttributeError: 'OutputSeq' object has no attribute 'saliency'