Giter Site home page Giter Site logo

multihead-attention's Introduction

Multihead-Attention

Multihead Attention for PyTorch

项目简介

最近在尝试注意力机制提升模型效果,没有找到PyTorch版本非常合适的Multihead-Attention,就参考部分资料尝试写了一个。

模块结构

Attention里面有两个简单的Self-Attention和Multihead-Attention
Multihead-Attention修改自:
https://www.github.com/kyubyong/transformer
还参考了:
https://github.com/jadore801120/attention-is-all-you-need-pytorch
https://blog.csdn.net/stupid_3/article/details/83184691
一般来说,Q、K、V三者的通道数(即字/词的向量维度)是一致的,K通常等于V,不过PyTorch的nn.LayerNorm和自己实现的略有出入。

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.