File size: 391 Bytes
10f417b
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
from transformers_interpret import SequenceClassificationExplainer, MultiLabelClassificationExplainer

def explainer(input_statement, model, tokenizer):
    # cls_explainer = SequenceClassificationExplainer(model, tokenizer)
    cls_explainer = MultiLabelClassificationExplainer(model, tokenizer)
    word_attributions = cls_explainer(input_statement)
    return dict(word_attributions)