Skip to content

Instantly share code, notes, and snippets.

@prakhar21
Created May 8, 2021 11:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save prakhar21/6f044a15771d2d62634f5ebd423102df to your computer and use it in GitHub Desktop.
Save prakhar21/6f044a15771d2d62634f5ebd423102df to your computer and use it in GitHub Desktop.
transformer-interpret_attributino.py
from transformers_interpret import SequenceClassificationExplainer
sample_text = """A very classy nice restaurant. A warm welcoming, followed by an excellent service, with a lot of attention to details on order to please you."""
multiclass_explainer = SequenceClassificationExplainer(model=model, tokenizer=tokenizer)
word_attributions = multiclass_explainer(text=sample_text)
print (word_attributions)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment