Coder Social home page Coder Social logo

yanwords / lambdanet Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mrvplusone/lambdanet

0.0 1.0 0.0 19.17 MB

Probabilistic Type Inference using Graph Neural Networks

Scala 30.72% Mathematica 3.15% TypeScript 49.07% Shell 1.47% HTML 0.12% CSS 0.01% Python 0.51% JavaScript 14.73% Dockerfile 0.09% Java 0.13%

lambdanet's Introduction

LambdaNet Header

This is the source code repo for the ICLR paper LambdaNet: Probabilistic Type Inference using Graph Neural Networks. For an overview of how LambdaNet works, see our video from ICLR 2020.

Instructions

After cloning this repo, here are the steps to reproduce our experimental results:

  1. Install all the dependencies (Java, sbt, Typescript, etc.) See the "Using Docker" section below.
  2. To run pre-trained model
    1. download the model weights using this link (predicts user defined type) or this link (only library types), unzip the file, and put the models file under the project root.
    2. To run the model in interative mode, which outputs (source code position, predicted type) pairs for the specified files:
      1. Under project root, run sbt "runMain lambdanet.TypeInferenceService".
      2. After it finishes loading the model into memory, simply enter the directory path containing Typescript files.
      3. Note that currently, LambdaNet only works with Typescript files, so if you want to run it on Javascript files, you will need to change the file extensions to .ts.
    3. Alternatively, to run the model in batched mode, which outputs human-readable HTML files and accuracy statistics:
      1. download the parsedRepos file, unzip the file and put the directory under <project root>/data.
      2. Check the file src/main/scala/lambdanet/RunTrainedModel.scala and change the parameters under the todo comments depending on which model you want to run and where your test TypeScript files are located.
      3. Under project root, use sbt runTrained to run the model.
  3. To train LambdaNet from scratch
    1. Download the Typescript projects used in our experiments.
    2. Filter and prepare the TS projects into a serialization format.
    3. start the training.

The Typescript files used for manual comparison with JSNice are put under the directory data/comparison/.

Using Docker

We also provide a Docker file to automatically download and install all the dependencies. Here are the steps to run pre-trained LambdaNet model inside a Docker Container:

  1. First, make sure you have installed Docker.

  2. Put pre-trained model weights under models/.

  3. Under project root, run docker build -t lambdanet:v1 . && docker run --name lambdanet --memory 14g -t -i lambdanet:v1 . (Make sure the machine you are using has enough memory for the docker run command.)

  4. After the Docker container has successfully started, run sbt runTrained, and you should see LambdaNet outputs "libAccuracy" and "projectAccuracy" after a few minutes. LambdaNet also stores its predictions into an Html file under <test TS project>/predictions/ (<test TS project> is currently default to data/ts-algorithms, but you can change this in src/main/scala/lambdanet/RunTrainedModel.scala.)

lambdanet's People

Contributors

mrvplusone avatar maruthgoyal avatar ruricolist 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.