Spaces:
Running
Running
from transformers import AutoModelForSequenceClassification, AutoTokenizer | |
from transformers_interpret import MultiLabelClassificationExplainer | |
model_name = "j-hartmann/emotion-english-distilroberta-base" | |
model = AutoModelForSequenceClassification.from_pretrained(model_name) | |
tokenizer = AutoTokenizer.from_pretrained(model_name) | |
cls_explainer = MultiLabelClassificationExplainer(model, tokenizer) | |
word_attributions = cls_explainer("There were many aspects of the film I liked, but it was frightening and gross in parts. My parents hated it.") | |
print(word_attributions) |