unbias-one / interpret_model_pt.py
Jordan
Second changes - includes the generated text in images and videos
8d1b720
raw
history blame contribute delete
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)