Keras implementation for BERT and Transformer LM research
Top 44.4% on sourcepulse
This repository provides a Keras implementation of Google's BERT and OpenAI's Transformer LM, enabling transfer learning with pre-trained weights. It offers a flexible API for fine-tuning models on various NLP tasks, including sentence-level (e.g., classification) and token-level (e.g., PoS tagging) tasks, abstracting data generation and task management.
How It Works
The library utilizes a modular design, separating text encoding, language model generation, and task definitions. Users can define custom encoders (e.g., LSTMs) or leverage included implementations. A TaskMetaDatas
structure handles task-specific labels and masking, facilitating both pre-training and fine-tuning. The train_model
function orchestrates the process, supporting flexible training schedules via TaskWeightScheduler
and custom attention masks for controlling model behavior.
Quick Start & Requirements
pip install keras
(backend: TensorFlow recommended)tutorial.ipynb
, Colab notebooks linked in README.Highlighted Details
Maintenance & Community
@HighCWu
for TPU support.Licensing & Compatibility
Limitations & Caveats
The project is archived and will not receive further updates. BERT model loading and training are not supported on the Theano backend. The tutorial.ipynb
notebook is described as poorly designed.
6 years ago
1 day