Bertviz

From VectorSpaceLab/AREX-Skill · View interactive version

Bertviz is an AI agent skill from the GitHub repository VectorSpaceLab/AREX-Skill. Route BertViz Transformer attention visualization, neuron-view, notebook, and HTML export workflows.

How to use this skill

Skill file

BertViz

Use this repo skill when a task involves BertViz, Transformer attention

visualization, head/model view rendering, neuron-level query/key inspection, or

saving BertViz notebook visualizations as HTML.

Install and quick check

For ordinary use:

pip install bertviz

For interactive notebooks also install and enable a notebook frontend such as

JupyterLab plus widgets:

pip install jupyterlab ipywidgets

Minimal package/API check:

python - <<'PY'
from bertviz import head_view, model_view
from bertviz.neuron_view import get_attention
print("bertviz import ok", head_view.__name__, model_view.__name__, get_attention.__name__)
PY

For a stronger no-network check, run CODE0.

Route by task

| User need | Read next |

| --- | --- |

| Visualize standard self-attention tensors from Hugging Face or another Transformer model. | CODE0 |

| Render sentence-pair head/model views with sentence_b_start. | CODE1 |

| Render encoder, decoder, or cross-attention for sequence-to-sequence models. | CODE0 |

| Save BertViz output as standalone HTML or use it outside a notebook display call. | CODE0, or CODE1 for neuron view |

| Inspect query/key neuron contributions using BertViz's modified model classes. | CODE0 |

| Diagnose package installation, notebook display, PyTorch/IPython dependency, or JS asset issues. | CODE0 |

| Check whether this skill matches the current BertViz checkout/version. | CODE0 |

Core distinctions

choice when the model can return Hugging Face-style attention weights with

output_attentions=True.

BERT/GPT-2/RoBERTa/XLNet classes because neuron view needs query and key

vectors, not only attention probabilities.

inspect attention patterns but should not be presented as proving causal

feature attribution.

Repo-level references and scripts

explains dependencies, notebook frontend expectations, backend assumptions,

and offline validation strategy.

cross-cutting install/import/display/runtime symptoms.

source snapshot and evidence paths used to build this skill.

checks imports, function signatures, packaged JavaScript assets, and optional

neuron-view imports without downloading models.

Safety defaults

when network/model downloads are not explicitly allowed.

attention-views/scripts/render_synthetic_attention.py, and

neuron-view/scripts/validate_toy_bert_attention.py.

BertViz does not require modifying its installed package files.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.