All Projects → pbloem → Former

pbloem / Former

Licence: mit
Simple transformer implementation from scratch in pytorch.

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Former

Bert Multitask Learning
BERT for Multitask Learning
Stars: ✭ 380 (-24%)
Mutual labels:  transformer
Pytorch Original Transformer
My implementation of the original transformer model (Vaswani et al.). I've additionally included the playground.py file for visualizing otherwise seemingly hard concepts. Currently included IWSLT pretrained models.
Stars: ✭ 411 (-17.8%)
Mutual labels:  transformer
Seq2seqchatbots
A wrapper around tensor2tensor to flexibly train, interact, and generate data for neural chatbots.
Stars: ✭ 466 (-6.8%)
Mutual labels:  transformer
Pvt
Stars: ✭ 379 (-24.2%)
Mutual labels:  transformer
Neural sp
End-to-end ASR/LM implementation with PyTorch
Stars: ✭ 408 (-18.4%)
Mutual labels:  transformer
Joeynmt
Minimalist NMT for educational purposes
Stars: ✭ 420 (-16%)
Mutual labels:  transformer
Flow Forecast
Deep learning PyTorch library for time series forecasting, classification, and anomaly detection (originally for flood forecasting).
Stars: ✭ 368 (-26.4%)
Mutual labels:  transformer
Nmt Keras
Neural Machine Translation with Keras
Stars: ✭ 501 (+0.2%)
Mutual labels:  transformer
Tsai
Time series Timeseries Deep Learning Pytorch fastai - State-of-the-art Deep Learning with Time Series and Sequences in Pytorch / fastai
Stars: ✭ 407 (-18.6%)
Mutual labels:  transformer
Omninet
Official Pytorch implementation of "OmniNet: A unified architecture for multi-modal multi-task learning" | Authors: Subhojeet Pramanik, Priyanka Agrawal, Aman Hussain
Stars: ✭ 448 (-10.4%)
Mutual labels:  transformer
Nlp Tutorials
Simple implementations of NLP models. Tutorials are written in Chinese on my website https://mofanpy.com
Stars: ✭ 394 (-21.2%)
Mutual labels:  transformer
Deepsvg
[NeurIPS 2020] Official code for the paper "DeepSVG: A Hierarchical Generative Network for Vector Graphics Animation". Includes a PyTorch library for deep learning with SVG data.
Stars: ✭ 403 (-19.4%)
Mutual labels:  transformer
Bert Pytorch
Google AI 2018 BERT pytorch implementation
Stars: ✭ 4,642 (+828.4%)
Mutual labels:  transformer
Gpt2 Chinese
Chinese version of GPT2 training code, using BERT tokenizer.
Stars: ✭ 4,592 (+818.4%)
Mutual labels:  transformer
Nlp Paper
NLP Paper
Stars: ✭ 484 (-3.2%)
Mutual labels:  transformer
Text Classification Models Pytorch
Implementation of State-of-the-art Text Classification Models in Pytorch
Stars: ✭ 379 (-24.2%)
Mutual labels:  transformer
Transformer Tts
A Pytorch Implementation of "Neural Speech Synthesis with Transformer Network"
Stars: ✭ 418 (-16.4%)
Mutual labels:  transformer
Lightseq
LightSeq: A High Performance Inference Library for Sequence Processing and Generation
Stars: ✭ 501 (+0.2%)
Mutual labels:  transformer
Awesome Visual Transformer
Collect some papers about transformer with vision. Awesome Transformer with Computer Vision (CV)
Stars: ✭ 475 (-5%)
Mutual labels:  transformer
Jukebox
Code for the paper "Jukebox: A Generative Model for Music"
Stars: ✭ 4,863 (+872.6%)
Mutual labels:  transformer

former

Simple transformer implementation from scratch in pytorch. See http://peterbloem.nl/blog/transformers for an in-depth explanation.

Limitations

The current models are designed to show the simplicity of transformer models and self-attention. As such they will not scale as far as the bigger transformers. For that you'll need a number of tricks that complicate the code (see the blog post for details).

All models so far are a single stack of transformer blocks (that is, no encoder/decoder structures). It turns out that this simple configuration often works best.

Use

You can clone the code and run the experiments from the root directory. E.g.

python experiments/classify.py

Hyperparameters are passed as command line arguments. The defaults should work well. The classification data is automatically downloaded, the wikipedia data is included in the repository.

You should be able to install as a package as well, with

pip install git+https://github.com/pbloem/former

but I haven't tried this. It's probably easier to just copy over the code you need. Let me know if you need this for anything and it doesn't work.

Requirements

Python 3.6+ is required.

The following should install all requirements pip install torch tb-nightly tqdm numpy torchtext

You may also need pip install future depending on the exact python version.

conda environment

The file environment.yml describes a complete conda environment with all dependencies. After cloning or downloading the project, you create the environment as follows:

conda env create -f environment.yml --name former
conda activate former
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].