The code for training the BERTSUM model is open-sourced by the researchers of BERTSUM and it is available at https://github.com/nlpyang/BertSum. In this section, let's explore this and learn how to train the BERTSUM model. We will train the BERTSUM model on the CNN/DailyMail news dataset. We can also access the complete code from the GitHub repository of the book. In order to run the code smoothly, clone the GitHub repository of the book and run the code using Google Colab.
First, let's install the necessary libraries:
!pip install pytorch-pre-trained-bert
!pip install torch==1.1.0 pytorch_transformers tensorboardX multiprocess pyrouge
!pip install googleDriveFileDownloader
If you are working with Google Colab, switch to the content directory with the following code:
cd /content/
Clone the BERTSUM repository:
!git clone https://github.com/nlpyang/BertSum.git
Now switch to the bert_data directory:
cd /content/BertSum/bert_data/
The researchers have...