BERT PyTorch is an open-source PyTorch implementation of BERT, Google’s landmark 2018 transformer language model. The repository has gathered about 6,500 stars on GitHub and is released under the Apache-2.0 license, with code last updated in 2023.
This project re-implements BERT from scratch in PyTorch in a clean, readable codebase, covering both the pre-training procedure and the model architecture itself. It implements the two original BERT pre-training tasks, masked language modeling and next sentence prediction, together with the transformer encoder stack, token, segment and positional embeddings, and the training pipeline around them. Because the code prioritizes clarity over heavy abstraction, it has become a widely used reference for students and researchers who want to understand exactly how BERT works under the hood rather than treating it as a black box.
BERT PyTorch is completely free and open source under the Apache-2.0 license. There is no paid version or hosted service; you download the code and train or fine-tune models on your own hardware.
BERT PyTorch is for NLP researchers, students and PyTorch developers who want a transparent, hackable implementation of BERT for learning, experimentation or as a starting point for custom transformer projects.