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

Issue with Zero Shot Classifier #133

Open
ericbugin1 opened this issue May 9, 2023 · 0 comments
Open

Issue with Zero Shot Classifier #133

ericbugin1 opened this issue May 9, 2023 · 0 comments

Comments

@ericbugin1
Copy link

ericbugin1 commented May 9, 2023

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"],
)

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