Skip to content

From-scratch PyTorch implementation of transformer from "Attention is All You Need"

Notifications You must be signed in to change notification settings

yimothysu/transformer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

transformer

From-scratch PyTorch implementation of transformer from "Attention is All You Need."

Requirements

Python 3.11

A GPU is recommended for training, but not at all necessary for inference.

Install

python3.11 -m venv venv
source venv/bin/activate
pip install -r requirements.txt

Train

Place training data in data/. The text in all files in this directory will be used for training.

To train, run

python train.py

By default, this will save the trained model at models/model.pt.

For a list of all options, run

python train.py --help

Run

To run a model that's already trained, run

python run.py --interactive --model_path <MODEL_PATH>

If model_path is not specified, it will default to models/model.pt.

For a list of all options, run

python run.py --help

About

From-scratch PyTorch implementation of transformer from "Attention is All You Need"

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages