cdpierse / cdpierse/transformers-interpret

Issue with Zero Shot Classifier

Open
#133 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Jupyter Notebook
Stars
1.4k
Forks
99
PR merge metrics
No merged PRs in 30d

Description

captum==0.6.0
transformers==4.28.1
transformers-interpret==0.10.0
python 3.7.4

When I run the code below, I get error `AssertionError: Forward hook did not obtain any outputs for given layer`
I have tried running it locally and in Google Colab with both having the same result

```
from transformers import AutoModelForSequenceClassification, AutoTokenizer
from transformers_interpret import ZeroShotClassificationExplainer

tokenizer = AutoTokenizer.from_pretrained("facebook/bart-large-mnli")

model = AutoModelForSequenceClassification.from_pretrained("facebook/bart-large-mnli")

zero_shot_explainer = ZeroShotClassificationExplainer(model, tokenizer)

word_attributions = zero_shot_explainer(
"Today apple released the new Macbook showing off a range of new features found in the proprietary silicon chip computer. ",
labels = ["finance", "technology", "sports"],
)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.