【文件属性】:
文件名称:transformer:使用pytorch实现“注意就是您所需要的一切”
文件大小:1.45MB
文件格式:ZIP
更新时间:2021-04-30 18:14:40
pytorch dataset transformer attention Python
变压器
我自己的实现Transformer模型(注意就是您所需要的-Google Brain,2017年)
1.实作
1.1位置编码
class PositionalEncoding ( nn . Module ):
"""
compute sinusoid encoding.
"""
def __init__ ( self , d_model , max_len , device ):
"""
constructor of sinusoid encoding class
:param d_model: dimension of model
:param max_len: max sequence length
:param device: hardware device se
【文件预览】:
transformer-master
----paper()
--------attention is all you need.pdf(2.1MB)
----train.py(5KB)
----models()
--------layers()
--------embedding()
--------model()
--------blocks()
--------__init__.py(87B)
----data.py(974B)
----test.py(2KB)
----retrain.py(5KB)
----conf.py(491B)
----util()
--------tokenizer.py(637B)
--------bleu.py(1KB)
--------__init__.py(87B)
--------epoch_timer.py(308B)
--------data_loader.py(2KB)
----README.md(12KB)
----image()
--------positional_encoding.jpg(43KB)
--------layer_norm.jpg(35KB)
--------positionwise_feed_forward.jpg(32KB)
--------model.png(56KB)
--------multi_head_attention.jpg(25KB)
--------enc_dec.jpg(97KB)
--------scale_dot_product_attention.jpg(16KB)
--------transformer-model-size.jpg(58KB)
----saved()
--------transformer-base()
----graph.py(972B)
----.gitignore(54B)