unbias-one / interpret_model_pt.py
Jordan
Unbias - Version one push
10f417b
raw
history blame
391 Bytes
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)