Giter VIP home page Giter VIP logo

pretraining-yourself-bert-from-scratch's Introduction

Pretraining-Yourself-Bert-From-Scratch

从头训练MASK BERT

In most cases, the Google pretrained BERT model or a further fine-tuning base on it is enough. Howerver, sometimes maybe you want to train a BERT or a small BERT with your specific dataset. This case is few but it does exist. This repo provides a mask BERT pretraining code, which has not been implemented in Pytorch at some popular repos of BERT, such as huggingface. Note that in this repo, the next sentence prediction is not jointed to pretraining.

How to start

  • Preparing your dataset, train and dev, and place them into the data directionary
  • Building a vocab as bert_vocab.txt. Note that the vocab should include [PAD] [UNK] [CLS] [SEP] [MASK]
  • Change the bert_config.json. Alternatively, you can change the model size to fit your memory. The current num_layer is set to 4, same as the MASS model (k=1) by microsoft. Besides, you also should change the vocab_size in the config file based on your vocab
  • python run_pretraining.py

pretraining-yourself-bert-from-scratch's People

Contributors

circlepi 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.