Giter Site home page Giter Site logo

bert-punctuation-restoration's Introduction

Punctuation Restoration with BERT

The aim of this experiment is to see how BERT performs on punctuation restoration. The purpose of this mini-experiment is to see how well the pre-trained (on English Wiki and BookCorpus with MLM and NSP as pre-training tasks) BERT performs on conversational data hence why I will be using movie transcripts.

Dataset

We will be using Download the dataset @ Cornell Movie Corpus

Setup & Installation

Clone the repo:

git clone https://github.com/matthiaslmz/BERT-Punctuation-Restoration.git

Next, create a new conda environment:

conda env create -f enviroment.yml
conda activate whatisbert

Make sure to download bert-base-uncased model, vocab and config file @:

  1. pytorch_model
  2. vocab
  3. config

CUDA

  1. If an error occurs, first make sure that you have a GPU that is available.
  2. If error persists, it could be that the defined training batch size is too large for the GPU, decrease if necessary
  3. By default in pipeline.py, if a GPU is available, torch.cuda.is_available() defaults to the first GPU, indexed 0. If you need to use the X^{th} GPU, make sure to edit like the following: DEVICE = "cuda:X-1" if torch.cuda.is_available() else cpu

IMPORTANT!

When deciding the number of punctuations you want to keep using the kept_punctuation parameter in create_moveis_dataset(), you MUST also make sure that the number of heads in the final layer of the model is same. This can be specified with the num_labels in BERTPuncResto

bert-punctuation-restoration's People

Contributors

matthiaslmz avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.