#104104th of 105 in ML frameworks and libraries
bertviz
Interactive attention visualizer for Transformer models in Jupyter and Colab
- Stars
- 8.2k
- License
- Apache-2.0
- Last commit
- Jan 2026
- Last release
- Jun 2025
- Language
- Python
7,937 on 1 Apr 20268,202 on 21 Oct 2026
From GitHub's daily star counts.
Checked on GitHub.
Overview
BertViz renders attention weights from Hugging Face Transformer models inside Jupyter or Colab notebooks through a Python API. It offers a head view, a model view across all layers and heads, and a neuron view of query/key vectors. Encoder-decoder models are supported in the head and model views.
Who it is for: ML researchers and engineers inspecting attention in Transformer models
Strengths
- Three views: per-layer head view, all-layer model view, and neuron view of query/key vectors
- Works with most Hugging Face models that return attention via output_attentions=True
- Handles encoder, decoder and cross attention for models such as BART and MarianMT
- Can export visualizations as standalone HTML via html_action='return'
Weaknesses
- Designed for short inputs; slow on long text or large models
- Neuron view only works with bundled custom BERT, GPT-2 and RoBERTa
- Needs a notebook environment; Colab can disconnect on long inputs
- Attention weights are not necessarily an explanation of predictions, per the README
What it needs
- GPU optional
- Needs Jupyter, ipywidgets, Hugging Face transformers
- Models: Hugging Face Transformers, BERT, GPT-2, RoBERTa, BART
Also in ML frameworks and libraries
See all 105| Rank | Project | Score |
|---|---|---|
| 1 | transformersPython library defining open models for text, vision, audio and multimodal tasks | 94 out of 100 |
| 2 | pytorchPython tensor library with GPU support and tape-based autograd for deep learning | 94 out of 100 |
| 3 | ultralyticsPython library and CLI for training and running YOLO vision models | 93 out of 100 |
| #4 | pytorch-image-modelsPyTorch library of image models, pretrained weights and reference training scripts | 92 out of 100 |
| #5 | supervisionPython toolkit for loading, annotating and counting computer vision detections | 91 out of 100 |