Skip to content

Implement transformer that running on single gpu with tensorflow 2.3

Notifications You must be signed in to change notification settings

dwdb/transformer-xl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Transfomer-XL

使用Tensorflow 2.3 实现CPU或单个GPU的transformer-xl,有不完善的地方后面有空再优化。

参考github:https://github.com/GaoPeng97/transformer-xl-chinese

编译词典

修改data_utils.py中的vocab_file文件路径,并运行生成词典文件vocab.pkl;

训练

run.py文件中修改全局变量VOCAB_FIL指定词典文件路径,修改DATASET指定数据集路径,执行指令

>> python run.py train

训练损失:

推理

训练模型文件

https://drive.google.com/drive/folders/1PoPG8sTw9vDVtReO3UpVYIIor5cY07qQ?usp=sharing

执行指令:

>> python run.py inference

示例:

seed text >>> 人间三月天,
>> 人间三月天,年年称处称觞。殷借长江南极,後年风露细。看看朱颜青鬓,便似文章公子。平生此子胜而今,百载还同此。

About

Implement transformer that running on single gpu with tensorflow 2.3

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages