GithubHelp home page GithubHelp logo

intuitionmachine / attn_vis Goto Github PK

View Code? Open in Web Editor NEW

This project forked from abisee/attn_vis

0.0 2.0 0.0 302 KB

Interactive in-browser attention visualizer tool for recurrent networks

HTML 100.00%

attn_vis's Introduction

Attention Visualizer

This is a tool to visualize the distribution of attention in a text-based sequence-to-sequence task such as summarization. As you hover your mouse over the decoded words, the tool shows a heatmap of attention over the source words. A demo can be seen here (scroll down to "Example Output" section).

Additionally, for pointer-generator networks such as that described in this paper, the tool displays the generation probability of each decoded word. This tool was designed to work with the Tensorflow code for the paper.

To run

To run the visualizer, run

python -m SimpleHTTPServer

from this directory then navigate to http://localhost:8000/ in browser. The visualizer will show some example data.

To use your own data

To visualize your own data, you need to replace attn_vis_data.json with a similar file, either produced by this Tensorflow code, or by your own model. In particular attn_vis_data.json should contain the following fields:

  • article_lst: the article (or source text) as a list of words
  • decoded_lst: the decoded (i.e. machine-generated) summary as a list of words
  • abstract_str: the reference summary as a single string
  • attn_dists: a list same length as decoded_lst, containing lists of length "attention length", containing probabilities. Note attention length must be <= length of article_lst. e.g. your article may have 500 words but you only fed the first 200 words into the model, thus attention length is 200. In this case the visualizer will mark the truncation point in the article.
  • p_gens: a list same length as decoded_lst, containing the generation probabilities.

WARNING: Make sure that none of the strings in article_lst, decoded_lst, or abstract_str contain <angled brackets>. These will interfere with the HTML and can result in text not being displayed.

attn_vis's People

Contributors

abisee avatar

Watchers

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