Skip to content

tsupei/transformer-tutorial

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

Intro.

  1. Review transformers both in in theory and in practice.
  2. Run several experiments using traditional-chinese corpus

Dataset

I crawl some articles from PTT-Gossiping here

Structure

.
├── README.md
├── data
│   ├── Gossiping-38650-39150.json
│   └── transformer.pkl
├── examples
│   └── pytorch_example.py
└── pytorch
    ├── positional_encoding.py
    └── transformer.py
  • data directory restore data and transformer.pkl is a example of trained model
  • pytorch directory lists useful models that I modified from Pytorch
  • pytorch_example.py list an example of training a transformer based model

Run

python ../examples/pytorch_example.py \
--epoch 1 \
--encoder_layer 3 \
--word_dimension 256 \
--hidden_dimension 300 \
--attention_head 8 \
--dropout 0.2 \
--learning_rate 0.05 \
--data /Users/admin/Practice/transformer-tutorial/data/Gossiping-38650-39150.json \
--model /Users/admin/Practice/transformer-tutorial/data/transformer.pkl

TensorboardX is also supported

python ../examples/pytorch_example.py \
...\
--tensorboard

About

Examples for using transformer model in Pytorch

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages