Are you sure you want to delete this task? Once this task is deleted, it cannot be recovered.
|
|
7 years ago | |
|---|---|---|
| .. | ||
| LICENSE | 7 years ago | |
| README.md | 7 years ago | |
| __init__.py | 7 years ago | |
| model.py | 7 years ago | |
| test.py | 7 years ago | |
| test.txt | 7 years ago | |
| train.py | 7 years ago | |
| train.txt | 7 years ago | |
| utilities.py | 7 years ago | |
| valid.txt | 7 years ago | |
This is the PyTorch implementation of character-aware neural language model proposed in this paper by Yoon Kim.
The code is run and tested with Python 3.5.2 and PyTorch 0.3.1.
| HyperParam | value |
|---|---|
| LSTM batch size | 20 |
| LSTM sequence length | 35 |
| LSTM hidden units | 300 |
| epochs | 35 |
| initial learning rate | 1.0 |
| character embedding dimension | 15 |
Train the model with split train/valid/test data.
python train.py
The trained model will saved in cache/net.pkl.
Test the model.
python test.py
Best result on test set:
PPl=127.2163
cross entropy loss=4.8459
This implementation borrowed ideas from
https://github.com/jarfo/kchar
https://github.com/cronos123/Character-Aware-Neural-Language-Models
一款轻量级的自然语言处理(NLP)工具包,目标是减少用户项目中的工程型代码,例如数据处理循环、训练循环、多卡运行等
Python Jupyter Notebook Text CSV Markdown