Skip to main content

A python package for NLP explainability

Project description

Latest PyPI version Documentation Status

A python package for benchmarking interpretability techniques.

from transformers import AutoModelForSequenceClassification, AutoTokenizer
from ferret import Benchmark

model = AutoModelForSequenceClassification.from_pretrained("bert-base-cased")
tokenizer = AutoTokenizer.from_pretrained("bert-base-cased")

bench = Benchmark(model, tokenizer)
explanations = bench.explain("You look stunning!")
bench.show_table(explanations)

Features

ferret builds on top of the transformers library. The library supports explanations using:

  • Gradients

  • Integrated Gradinets

  • Gradient x Input word embeddings

  • SHAP

  • LIME

TODOs

  • Possibility to run on select device (“cpu”, “cuda”)

  • Sample-And-Occlusion explanations

  • Discretized Integrated Gradients: https://arxiv.org/abs/2108.13654

Credits

This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.

History

0.1.0 (2022-05-30)

  • First release on PyPI.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ferret-xai-0.1.0.tar.gz (40.5 kB view hashes)

Uploaded Source

Built Distribution

ferret_xai-0.1.0-py2.py3-none-any.whl (45.2 kB view hashes)

Uploaded Python 2 Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page