This project involves creating an AI to predict a masked word in a text sequence using the BERT language model. The project is divided into two main parts:
- Implementing a program to predict masked words using BERT.
- Analyzing the attention diagrams generated by the model to understand what BERT's attention heads focus on.
- Python Version: The latest version of Python you should use is Python 3.12.
- Dependencies: Install the required dependencies using
pip3 install -r requirements.txt
.
To run the program, use the following command:
$ python mask.py
Text: We turned down a narrow lane and passed through a small [MASK].
We turned down a narrow lane and passed through a small field.
We turned down a narrow lane and passed through a small clearing.
We turned down a narrow lane and passed through a small park.