GithubHelp home page GithubHelp logo

fred-xue / annotated-transformer Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mgalley/annotated-transformer

0.0 0.0 0.0 5.45 MB

This fork of the Annotated Transformer works with PyTorch 1.3

Home Page: http://nlp.seas.harvard.edu/2018/04/03/attention.html

License: MIT License

Jupyter Notebook 99.99% Shell 0.01%

annotated-transformer's Introduction

Code for The Annotated Transformer:

http://nlp.seas.harvard.edu/2018/04/03/attention.html

Authors: Alexander Rush (@harvardnlp or [email protected]), with help from Vincent Nguyen and Guillaume Klein.

Modified by Michel Galley to make it work with PyTorch 1.3.

Setup

Assuming you have PyTorch 1.3 already installed, please run this before loading the notebook:

pip install -r requirements.txt
wget https://s3.amazonaws.com/opennmt-models/iwslt.pt
python -m spacy download en
python -m spacy download de

Then, Run All cells should work in one pass without any error.

Changes

The code differs from the original Annotated Transformer in the following ways:

  • Runs on PyTorch 1.3 (original code was for version 0.3);
  • As the original en-de OpenNMT doesn't load in recent versions of PyTorch, the last part of the notebook (attention visualization, etc.) uses an IWSLT rather than WMT model;
  • Removed some deprecations when possible;
  • Fixed seed for reproducibility;
  • Decoding with slightly more difficult examples.

Detailed changes are listed in annotated_transformer.nbdiff.

Credit

If you use this for anything, please give credit to Alexander Rush. Here is a paper you can cite:

@inproceedings{opennmt,
  author    = {Guillaume Klein and
               Yoon Kim and
               Yuntian Deng and
               Jean Senellart and
               Alexander M. Rush},
  title     = {OpenNMT: Open-Source Toolkit for Neural Machine Translation},
  booktitle = {Proc. ACL},
  year      = {2017},
  url       = {https://doi.org/10.18653/v1/P17-4012},
  doi       = {10.18653/v1/P17-4012}
}

annotated-transformer's People

Contributors

mgalley avatar srush 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.