Replies: 1 comment
-
Does this work for Roberta models? I feel it has issues pertaining to the token_type_ids. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Changes to explainer constructor
In previous versions the constructor for explainers allowed for text to passed along with the model and tokenizer, text could also be passed to the explainer instance and would replace the text passed in the constructor. This behavior was confusing and also didn't work with integrating into future explainers. This version changes that behavior so that only the model and tokenizer are passed to the constructor and text is always passed to the instance.
Old
New
Question Answering Explainer (Experimental release)
This release adds an initial implementation of an explainer for question-answering models from the Huggingface library called the
QuestionAnsweringExplainer
. This explainer is still somewhat experimental and has not been tested with a wide range of models and architectures.I'm still figuring some things out such as the default embeddings to explain attributions for. In some cases I can get the average attributions for three embedding types combined (word, position, token type) while in others this is not possible so I currently default to word attributions. While this was fine for the classification explainer, position ids and token type ids play a big role in calculating attributions for question-answering models.
How to create a QA explainer
Getting word attributions
word_attributions
are a dict with two keysstart
andend
the values for each key are a list of tuples. The values instart
are the word attributions for the predicted start position from thecontext
and the values inend
are for the predicted end position.We can get the text span for the predicted answer with
Like the classification explainer attributions can be visualized with
This will create a table of two rows, the first for start position attributions and the second for end position attributions.
Please report any bugs or quirks you find with this new explainer. Thanks
This discussion was created from the release v0.3.1 Constructor changes, Question Answering Explainer (experimental).
Beta Was this translation helpful? Give feedback.
All reactions