Coder Social home page Coder Social logo

hiroakimikami / mlprogram Goto Github PK

View Code? Open in Web Editor NEW
18.0 3.0 3.0 9.25 MB

PyTorch library for synthesizing programs from natural language

License: MIT License

Python 99.87% Makefile 0.13%
deep-learning deep-neural-network natural-language-understanding deeplearning program-synthesis pytorch nl2code treegen

mlprogram's Introduction

mlprogram

A Library of Deep Learning (Machine Learning) for Programming Tasks. It provides a toolbox for implementing and evaluating deep learning methods related to programming.

Purpose

The main purpose of this repository is making my experiments easy. Recently, many papers proposed deep learning methods for programming, such as programming by example and auto reparing. But many of them requires complex and error-prone implementations. For example, beam search decoding with a programming language grammar is complex and unique to this task. I want to create and maintain well-tested implementations of such algorithms.

Focuses

  • Library for handling programming languages in deep learning tasks
  • Utilities for benchmark datasets of various tasks
  • Simple baseline solution for program generation

Now I do not place value on re-implementing exsiting papers. The machine learning for programming field is still immature. There are no de-fact benchmark tasks in this field (such as image classification w/ ImageNet and object detection w/ COCO in the image). Also, there are no de-fact model (such as ResNet in the image).

Feature Lists and Plans

Benchmark

NL2Prog (Hearthstone)

Method #params [MiB] training time [min] max time per example [sec] BLEU@top1 config name
tree LSTM 7.7 92 15 0.75020 hearthstone/baseline_evaluate_short
tree LSTM 7.7 92 180 0.76540 hearthstone/baseline_evaluate_long

Programming by Example without Inputs (CSG)

Method #params [MiB] training time [min] max time per example [sec] generation rate config file
tree LSTM 16 75 30 18/30 csg/baseline_evaluate_short
tree LSTM 16 75 360 22/30 csg/baseline_evaluate_long
tree LSTM + REINFORCESynthesizer 16 75 30 18/30 csg/baseline_evaluate_rl_synthesizer_short
tree LSTM + REINFORCESynthesizer 16 75 360 22/30 csg/baseline_evaluate_rl_synthesizer_short

Auto Repair

TODO

Usage Examples

tools/launch.py is the launcher script and configs directory contains the examples.

Train/Evaluate NL2Code with Hearthstone Dataset

It requires CUDA enabled GPU.

$ python tools/launch.py --config configs/nl2code/nl2code_train.py
$ python tools/launch.py --config configs/nl2code/nl2code_evaluate.py

Warning

  • The implementation is highly experimental, and I may change it significantly.
  • The reproduced algorithms may be different from the authors' implementations. For example, the original implementation of NL2Code uses the grammar of Python 2.7.x while this repository uses the grammar of running Python version.

mlprogram's People

Contributors

hiroakimikami avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

mlprogram's Issues

Reorganize modules

  • Put all language-specific code into a languages/<lang> module
  • Move utils/logging => logging
  • Move utils/random => random
  • Move random_split into utils/data
  • Merge top_k_model into SaveTopKModel
  • Move top_k_element into collections
  • Move asts to languages/

Reorganize module

  • entrypoint.parse => entrypoint.configs
  • entrypoint.torch etc => entrypoint.types.torch
  • ast_reference_sampler => SequentialProgramSampler

Reorganize utils

  • Remove save/load
  • Move Compose, Sequence, Map to functools
  • Move other functions to toplevel

Naming convention

  • AST or Ast
  • n_xxx or n_xxxs or num_xxx or xxx_num, etc...
  • type or kind
  • reference or query
  • value or token in ActionSequenceEncoder
  • IXxx for interface/abstract classes

Enable multi-process evaluation

The evaluation will be CPU-intensive in many tasks handled by mlprogram.
Instead of using a GPU, using multiple CPUs for evaluation might be a good idea.

Use PFRL in train_REINFORCE

I should use a reliable library for reinforcement learning because RL is a complex and error-prone method.
Now I plan to use PFRL.

Refactoring

  • Enable to use Colab
  • Make nl2code module
  • Fix API signature

Progress bar in nl2code_train

Hi, Is there any progress bar when running the python tools/launch.py -c configs/hearthstone/nl2code_train.gin ?
I can't tell whether it's running or the code hangs in my environment.

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.