GithubHelp home page GithubHelp logo

transformer's Introduction

transformer

手动实现transformer,通过汉译英数据集训练与测试

代码对应的文章地址为 https://zhuanlan.zhihu.com/p/642454398

1. 安装依赖包

通过requirements.txt 安装所需的依赖库

pip install -r requirements.txt

2. 模型训练

通过命令以下训练

python train.py

3. 模型测试

执行以下命令,可以对测试集进行beam_seach解码,并计算BLEU。

python test.py

4. Attention可视化

通过visualization.ipynb 实现以下Attention 矩阵可视化效果

Encoder Self-Attention

Decoder Self-Attention

Decoder Cross-Attention

transformer's People

Contributors

wflying000 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.