Giter Club home page Giter Club logo

atmt's Introduction

atmt assignment 4

to run the code

Run part04.sh for all predictions. Then plot with part01_plot.ipynb, plot03.py and plot04.py

Implementation

Part 03

Inside ‘get_best’ function in beam.py.

For all the potential predictions, recalculate their probabilities by adding length normalization.

Part 04

Inside translate_beam.py, annotated with ‘Part 04’

Since there is no need to add diversity at the first layer of the search tree, I recalculated the probability only for nodes at deeper layers, as long as that node is not a final node. And since the penalty is only used for selecting nodes across same layer, it should not be stored as the log probability. Otherwise the longer a prediction is, more severely it will be penalized.

atmt assignment 3

to run the code

We used pytorch 1.3 and cuda 10.1, runnable on Windows or Ubuntu machine with the two mentioned packages installed, or it can be run online on Google Colab.

We trained three models.

  1. Run train1.py for model 1 & 2
  2. Run train.py for model 3

The results for three models are inside results folder.

The plots we added in the report are generated from plot.ipynb

implementation

the loss term we added

We adapted train.py to train bidirectionally and then added an additional loss with function get_diff.

We want to let representations produced by encoders be the same for different languages.

Given one sentence in language en and de. And when we train from de-en, let's take the first word in en, (v1=attention*src-out) should represent this word, v2. We defined cos(v1, v2) as loss for our desired property. And to not constrain the representation power, we use cos(v1, v) for all other words in this sentence as normalization.

Notice that our normalization here is division. Whereas in lecture 9, the Unsupervised Sentence Similarity use addition, which should have better numerical stability.

small small changes

For bidirectional training, there are some small changes for that in utils.py. and We also made it runnable on gpu.

atmt's People

Contributors

louis-jin avatar southdam avatar chanberg avatar

Watchers

James Cloos 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.