Practical overview
When it fits
Use Ferret when you already have a Hugging Face Transformers text model and tokenizer and want to produce or benchmark token-level explanations in a shared workflow.
Who it is for
- Researchers comparing interpretability methods for Transformer text models
- Practitioners who want to inspect and evaluate token-level explanations for a Hugging Face text classifier
Documented uses
- Generate token-level explanations for a model prediction using gradient, integrated-gradient, Partition SHAP or LIME methods.
- Compare explanations using faithfulness and plausibility measures.
- Calculate and average evaluation scores across selected dataset samples.
Requirements & limits
- Ferret’s documented model support is for text models.
- The package expects a model and tokenizer for its Benchmark workflow.
- The default installation excludes dependencies for speech explainability; the README provides a separate speech extra.
- The repository lists an MIT license.
Check current requirements in the official documentation. Source-based guidance does not mean OpenViST has run or independently tested this project.
Generate and evaluate explanations for a text input
Use a loaded text-classification model to produce token-level explanations and view evaluation scores.
Before you start
- Python package ferret-xai and its Transformers dependency
- A Hugging Face Transformers text-classification model and matching tokenizer
- Jupyter Notebook or Colab for the documented formatted evaluation table
Steps
Install the package with the command below.
pip install -U ferret-xaiLoad a Transformers sequence-classification model and tokenizer.
Create
Benchmark(model, tokenizer)and callexplainwith a text input and target.Pass the explanations to
evaluate_explanationsand display the results withshow_evaluation_table.
Expected outcome
A formatted table of evaluation measures for explanations of the selected text input.
Guide limitations
- The README describes support for text models.
- The formatted table example is intended for Jupyter Notebook or Colab.
Sources & review
Source record details
- Source availability
- Active
- Sources checked
- 16 October 2026
- Original website title
- g8a9/ferret · Official homepage title · retained in its source language

