GithubHelp home page GithubHelp logo

qikahh / cg-rl Goto Github PK

View Code? Open in Web Editor NEW

This project forked from deeplearnxmu/cg-rl

0.0 0.0 0.0 23.7 MB

Code for "Exploring Dynamic Selection of Branch Expansion Orders for Code Generation"

License: MIT License

Python 96.30% Shell 3.70%

cg-rl's Introduction

CG-RL

Source code for "Exploring Dynamic Selection of Branch Expansion Orders for Code Generation".

System Architecture

The source code is developed upon TranX, for technical details please refer to ACL '18 paper and EMNLP '18 demo paper.

File Structure is mainly composed of two components:

  • asdl defines a general-purpose transition system based on the ASDL formalism, and its instantiations in different programming languages and datasets. The transition system defines how an AST is constructed using a sequence of actions. This package can be used as a standalone library independent of tranX.

  • model contains the neural network implementation of the transition system defined in asdl, which computes action probabilities using neural networks.

Here is a detailed map of the file strcuture:

├── asdl (grammar-based transition system)
├── datasets (dataset specific code like data preprocessing/evaluation/etc.)
├── model (PyTorch implementation of neural nets)
├── components (helper functions and classes like vocabulary)

Usage

Step 1: Download the datasets

cd tranX
bash ./pull_data.sh # get datasets from the TranX

Step 2: Pre-train the model

sh scripts/django/train-pre.sh # pre-train model on the django dataset 

Step 3: Train the model

sh scripts/django/train.sh # train model on the django dataset 

At last, it will show the accuracy on test dataset.

Evaluation Results

We provide the trained model in checkpoint for convenience. Here is a list of performance results on four datasets using trained models in checkpoint

Dataset Results Metric
Django 78.22 Accuracy
CoNaLa 26.42 Corpus BLEU
ATIS 89.95 Accuracy
GEO 90.35 Accuracy

You can run sh scripts/<lang>/test.sh to get these results.

Conda Environments

Please note that Django dataset only support Python 2.7. The main example conda environment (config/env/tranx.yml) supports Python 3, and environment (config/env/tranx-py2.yml) supports Python 2. You can export the enviroments using the following command:

conda env create -f config/env/(tranx.yml,tranx-py2.yml)

Note

Most of this code and data are borrowed from:

https://github.com/pcyin/tranX

cg-rl's People

Contributors

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