the-story-of-heads
This is a repository with the code for the ACL 2019 paper "Analyzing Multi-Head Self-Attention: Specialized Heads Do the Heavy Lifting, the Rest Can Be Pruned" and the ACL 2021 paper "Analyzing Source and Target Contributions to NMT Predictions".
File Explorer
Download Latest Version (.zip)- __init__.py
- attn.py
- attn_lrp.py
- basic.py
- concrete_gate.py
- lrp.py
- __init__.py
- dummy_provider.py
- horovod_provider.py
- __init__.py
- basic.py
- devices.py
- record_activations.py
- sliced_argmax.py
- __init__.py
- transformer.py
- transformer_head_gates.py
- transformer_lrp.py
- __init__.py
- concrete.py
- default.py
- mrt.py
- __init__.py
- bleu.py
- data.py
- inference.py
- strutils.py
- summary.py
- tickers.py
- voc.py
- __init__.py
- __init__.py
- apply_bpe.py
- average_npz.py
- __init__.py
- algorithms.py
- optimizers.py
- problem.py
- saveload.py
- tickers.py
- __init__.py
- data.py
- meta.py
- session.py
- util.py
- 1_Load_model_and_translate.ipynb
- 2_Look_at_attention_maps.ipynb
- 3_Look_which_heads_are_dead.ipynb
- acl19_heads-min_pad.png
- acl_empty.png
- concrete.gif
- concrete_crop.gif
- enc_head_gif_delay7-min.gif
- enc_head_gif_delay7.gif
- intro_large-min.png
- intro_large.png
- lrp_main-min.png
- lrp_main.png
- src_dst_main.gif
- nmt.py
- train_baseline.sh
- train_concrete_heads.sh
- train_fixed_alive_heads.sh
- train_mrt.sh
- 1_Load_model_and_evaluate_LRP.ipynb
- 2_Load_LRP_results_and_build_graphs.ipynb
- README.md
- .gitignore
- .Rhistory
- README.md
- requirements.txt
# Installation Guide
1. Get the code
git clone https://github.com/lena-voita/the-story-of-heads
Downloads the entire project code from GitHub to your computer.
cd the-story-of-heads
Moves into the project folder you just downloaded.
2. Python
Easy RecommendedPrerequisites
__Python:__ The code works with Python 3.5 and 3.6; we recommend using [anaconda](https://www.anaconda.com/). Install the rest of python packages with `pip install -r requirements.txt`. If you haven't build OpenMPI, remove `horovod` from the list of requirements.
Installs the Python libraries listed in requirements.txt (or similar).
If it runs without errors and prints output in the terminal, it worked.
Pulled directly from this repo's README.
// repository documentation
Was this content helpful?
(0 ratings)
