trishullab / bayou Goto Github PK
View Code? Open in Web Editor NEWSystem for synthesizing Java API idioms, powered by Neural Sketch Learning
Home Page: http://www.askbayou.com
License: Apache License 2.0
System for synthesizing Java API idioms, powered by Neural Sketch Learning
Home Page: http://www.askbayou.com
License: Apache License 2.0
In our current Evidence api call notation examples we show the user that:
{
Evidence.apicalls("getInputStream");
Evidence.types("BluetoothSocket");
}
Denotes something akin to"call getInputStream() on an instance of BluetoothSocket"
As such, when thinking about a corresponding /// notation do we want something verbatim like:
/// calls:getInputStream types:BluetoothSocket
Or something that is more reflective of the intended structure like:
/// BluetoothSocket.getInputStream()
They are getting too big for GH's limit.
After updating to model52 and trying to launch on master (afdb864) I get the following error.
$ ./start_bayou.sh
/build_scripts/out$ 2017-10-19 18:13:57.573:INFO::main: Logging initialized @12205ms to org.eclipse.jetty.util.log.StdErrLog
2017-10-19 18:13:58.237:INFO:oejs.Server:main: jetty-9.4.z-SNAPSHOT
2017-10-19 18:13:58.671:INFO:oejs.AbstractConnector:main: Started ServerConnector@75c072cb{HTTP/1.1,[http/1.1]}{0.0.0.0:8080}
2017-10-19 18:13:58.672:INFO:oejs.Server:main: Started @13305ms
2017-10-19 18:14:17.958477: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.1 instructions, but these are available on your machine and could speed up CPU computations.
2017-10-19 18:14:17.958537: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.2 instructions, but these are available on your machine and could speed up CPU computations.
2017-10-19 18:14:17.958555: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX instructions, but these are available on your machine and could speed up CPU computations.
===================================
Loading Model. Please Wait.
===================================
Traceback (most recent call last):
File "/home/barnett/workDev/bayou/repos/github/capergroup/bayou/master/tool_files/build_scripts/out/python/bayou/server/ast_server.py", line 176, in <module>
bp = BayesianPredictor(args.save_dir, sess) # create a predictor that can generates ASTs from evidence
File "/home/barnett/workDev/bayou/repos/github/capergroup/bayou/master/tool_files/build_scripts/out/python/bayou/experiments/low_level_evidences/infer.py", line 39, in __init__
config = read_config(json.load(f), chars_vocab=True)
File "/home/barnett/workDev/bayou/repos/github/capergroup/bayou/master/tool_files/build_scripts/out/python/bayou/experiments/low_level_evidences/utils.py", line 59, in read_config
config.evidence = bayou.experiments.low_level_evidences.evidence.Evidence.read_config(js['evidence'], chars_vocab)
File "/home/barnett/workDev/bayou/repos/github/capergroup/bayou/master/tool_files/build_scripts/out/python/bayou/experiments/low_level_evidences/evidence.py", line 51, in read_config
e.init_config(evidence, chars_vocab)
File "/home/barnett/workDev/bayou/repos/github/capergroup/bayou/master/tool_files/build_scripts/out/python/bayou/experiments/low_level_evidences/evidence.py", line 30, in init_config
self.__setattr__(attr, evidence[attr])
KeyError: 'num_layers'
1.0.0 RCO
This will help with clean AAT.
In the release, each source file needs to be annotated with the boilerplate notice for the license. This is not the case at this time.
src/main/java/edu/rice/cs/caper/bayou/core/synthesizer/Visitor.java
Error:(82, 19) java: method apply in class edu.rice.cs.caper.bayou.core.synthesizer.DCEOptimizor cannot be applied to given types;
required: org.eclipse.jdt.core.dom.Block
found: org.eclipse.jdt.core.dom.Block,edu.rice.cs.caper.bayou.core.dsl.DSubTree
reason: actual and formal argument lists differ in length
1.0.0 RC0
1.0.0 RC0
What is our motivation for this constraint?
This may be the very first script we want to run in a clean env. Make it easy to have the deps installed like other scripts.
Motivation:
The method that sets the field may be called by two different threads via two different instances concurrently.
java.lang.IllegalArgumentException: Invalid identifier : >StackTraceElement[]<
at org.eclipse.jdt.core.dom.SimpleName.setIdentifier(SimpleName.java:199) ~[bayou-1.1.0.jar:?]
at org.eclipse.jdt.core.dom.AST.newSimpleName(AST.java:2202) ~[bayou-1.1.0.jar:?]
at edu.rice.cs.caper.bayou.core.synthesizer.Visitor.postprocessLocal(Visitor.java:146) ~[bayou-1.1.0.jar:?]
at edu.rice.cs.caper.bayou.core.synthesizer.Visitor.visit(Visitor.java:96) ~[bayou-1.1.0.jar:?]
at org.eclipse.jdt.core.dom.MethodInvocation.accept0(MethodInvocation.java:231) ~[bayou-1.1.0.jar:?]
at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:2711) ~[bayou-1.1.0.jar:?]
at org.eclipse.jdt.core.dom.ASTNode.acceptChild(ASTNode.java:2759) ~[bayou-1.1.0.jar:?]
at org.eclipse.jdt.core.dom.ExpressionStatement.accept0(ExpressionStatement.java:145) ~[bayou-1.1.0.jar:?]
at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:2711) ~[bayou-1.1.0.jar:?]
at org.eclipse.jdt.core.dom.ASTNode.acceptChildren(ASTNode.java:2782) ~[bayou-1.1.0.jar:?]
at org.eclipse.jdt.core.dom.Block.accept0(Block.java:137) ~[bayou-1.1.0.jar:?]
at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:2711) ~[bayou-1.1.0.jar:?]
at org.eclipse.jdt.core.dom.ASTNode.acceptChildren(ASTNode.java:2782) ~[bayou-1.1.0.jar:?]
at org.eclipse.jdt.core.dom.Block.accept0(Block.java:137) ~[bayou-1.1.0.jar:?]
at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:2711) ~[bayou-1.1.0.jar:?]
at org.eclipse.jdt.core.dom.ASTNode.acceptChild(ASTNode.java:2759) ~[bayou-1.1.0.jar:?]
at org.eclipse.jdt.core.dom.MethodDeclaration.accept0(MethodDeclaration.java:635) ~[bayou-1.1.0.jar:?]
at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:2711) ~[bayou-1.1.0.jar:?]
at org.eclipse.jdt.core.dom.ASTNode.acceptChildren(ASTNode.java:2782) ~[bayou-1.1.0.jar:?]
at org.eclipse.jdt.core.dom.TypeDeclaration.accept0(TypeDeclaration.java:470) ~[bayou-1.1.0.jar:?]
at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:2711) ~[bayou-1.1.0.jar:?]
at org.eclipse.jdt.core.dom.ASTNode.acceptChildren(ASTNode.java:2782) ~[bayou-1.1.0.jar:?]
at org.eclipse.jdt.core.dom.CompilationUnit.accept0(CompilationUnit.java:212) ~[bayou-1.1.0.jar:?]
at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:2711) ~[bayou-1.1.0.jar:?]
at edu.rice.cs.caper.bayou.core.synthesizer.Synthesizer.execute(Synthesizer.java:62) ~[bayou-1.1.0.jar:?]
at edu.rice.cs.caper.bayou.application.api_synthesis_server.ApiSynthesisStrategyRemoteTensorFlowAsts.synthesiseHelp(ApiSynthesisStrategyRemoteTensorFlowAsts.java:205) ~[bayou-1.1.0.jar:?]
at edu.rice.cs.caper.bayou.application.api_synthesis_server.ApiSynthesisStrategyRemoteTensorFlowAsts.synthesise(ApiSynthesisStrategyRemoteTensorFlowAsts.java:139) ~[bayou-1.1.0.jar:?]
at edu.rice.cs.caper.bayou.application.api_synthesis_server.ApiSynthesisServlet.doPostHelp(ApiSynthesisServlet.java:227) ~[bayou-1.1.0.jar:?]
at edu.rice.cs.caper.bayou.application.api_synthesis_server.ApiSynthesisServlet.doPost(ApiSynthesisServlet.java:93) ~[bayou-1.1.0.jar:?]
at edu.rice.cs.caper.servlet.SizeConstrainedPostBodyServlet.doPost(SizeConstrainedPostBodyServlet.java:176) ~[bayou-1.1.0.jar:?]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:707) ~[bayou-1.1.0.jar:?]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) ~[bayou-1.1.0.jar:?]
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:841) ~[bayou-1.1.0.jar:?]
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:535) ~[bayou-1.1.0.jar:?]
at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:170) ~[bayou-1.1.0.jar:?]
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:473) ~[bayou-1.1.0.jar:?]
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141) ~[bayou-1.1.0.jar:?]
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132) ~[bayou-1.1.0.jar:?]
at org.eclipse.jetty.server.Server.handle(Server.java:564) ~[bayou-1.1.0.jar:?]
at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:317) ~[bayou-1.1.0.jar:?]
at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:251) ~[bayou-1.1.0.jar:?]
at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:279) ~[bayou-1.1.0.jar:?]
at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:110) ~[bayou-1.1.0.jar:?]
at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:124) ~[bayou-1.1.0.jar:?]
at org.eclipse.jetty.util.thread.Invocable.invokePreferred(Invocable.java:128) ~[bayou-1.1.0.jar:?]
at org.eclipse.jetty.util.thread.Invocable$InvocableExecutor.invoke(Invocable.java:222) ~[bayou-1.1.0.jar:?]
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:294) ~[bayou-1.1.0.jar:?]
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.produce(EatWhatYouKill.java:126) ~[bayou-1.1.0.jar:?]
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:672) [bayou-1.1.0.jar:?]
at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:590) [bayou-1.1.0.jar:?]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_131]```
It's getting annoying hand crafting the requests for direct performance profiling of the ast_server.
Allow declaration of evidences through comments such as the following.
/// readline bufferedreader
/// call:readline type:bufferedreader
These comments should be translated to calls to methods in the class Evidence before the synthesizer is invoked.
Such a comment should also lead to the automatic import of the edu.rice.cs.caper.bayou.annotations.Evidence class, so that the package does not have to be explicitly imported in the draft.
Advance to 1.1.0 in anticipation of next release.
I see no reference to installing Java. Does that ship with OS X?
This is not necessarily a bug, but in some cases, types in synthesized programs come with full package names, and sometimes they do not. On input
import edu.rice.cs.caper.bayou.annotations.Evidence;
public class TestIO {
/* Read from a file */
void read(String file) {
{
/// calls:readLine
}
}
}
we get
import edu.rice.cs.caper.bayou.annotations.Evidence;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.File;
import java.net.URI;
import java.io.IOException;
import java.io.BufferedReader;
public class TestIO {
/* Read from a file */
void read(String file) {
{
String s;
BufferedReader br;
FileReader fr;
try {
fr = new java.io.FileReader((f = new File(new URI(file))));
br = new java.io.BufferedReader(fr);
while ((s = br.readLine()) != null) {
}
br.close();
} catch (FileNotFoundException _e) {
} catch (IOException _e) {
}
}
}
}
Sometimes it is "FileReader", sometimes it is "java.io.FileReader". Probably it would be more natural to just have "FileReader" in both cases.
In our current Evidence api call notation examples we show the user that:
{
Evidence.apicalls("getInputStream");
Evidence.types("BluetoothSocket");
}
Denotes something akin to"call getInputStream() on an instance of BluetoothSocket"
As such, when thinking about a corresponding /// notation do we want something verbatim like:
/// calls:getInputStream types:BluetoothSocket
Or something that is more reflective of the intended structure like:
/// BluetoothSocket.getInputStream()
Swap out canned examples so as to use the /// syntax.
Most users would likely only care about Java, as opposed to Android. It is fine to get rid of all or most of the Android examples, and just have a couple of Java examples.
As of now, the keywords evidence is not working on beta.askbayou. The following query yields no result.
import edu.rice.cs.caper.bayou.annotations.Evidence;
public class TestIO {
void read(String file) {
{
/// read a line
}
}
}
In 1.0.0 RC0, for example, variable i in the else body of:
Input:
import edu.rice.cs.caper.bayou.annotations.Evidence;
import android.bluetooth.BluetoothAdapter;
public class TestBluetooth {
void readFromBluetooth(BluetoothAdapter adapter) {
String address = "00:43:A8:23:10:F0";
{
Evidence.apicalls("getInputStream");
Evidence.types("BluetoothSocket");
}
}
}
Output:
import edu.rice.cs.caper.bayou.annotations.Evidence;
import android.bluetooth.BluetoothAdapter;
import android.util.AttributeSet;
import android.content.Context;
import android.widget.PopupWindow;
public class TestBluetooth {
void readFromBluetooth(BluetoothAdapter adapter) {
String address = "00:43:A8:23:10:F0";
{
PopupWindow pw1;
PopupWindow pw;
int i;
AttributeSet as;
Context c;
boolean b;
if ((b = adapter.cancelDiscovery())) {
pw = new PopupWindow(c, (as = c.getResources().getAnimation(adapter.getState())),
(i = adapter.getScanMode()));
} else {
pw1 = new PopupWindow(c, as, i, i);
}
pw.setInputMethodMode(i);
}
}
}
1.0.0 RC0
In lle, evidence.py, we currently have
CONFIG_INFER = ['chars', 'vocab', 'vocab_size']
def init_config(self, evidence, chars_vocab):
for attr in CONFIG_ENCODER + (CONFIG_INFER if chars_vocab else []):
self.__setattr__(attr, evidence[attr])
def dump_config(self):
js = {attr: self.__getattribute__(attr) for attr in CONFIG_ENCODER + CONFIG_INFER}
return js
This does not make sense since are all inside the decoder, right? And, evidence does not have those attributes. Or, in lle, evidences are supposed to have the vocabulary since it uses a bag-of-words representation?
My config.json is this one /home/vm17/Work/bayou/trained/s3/model-10/model-10.49.tar.gz.
1.0.0 RC0
Displays
[Darwin: command not found
Here is some code I entered in Askbayou:
import edu.rice.cs.caper.bayou.annotations.Evidence;
public class TestIO1 {
void read(String file) {
Evidence.apicalls("readLine");
}
void foo(String file) {
Evidence.apicalls("readLine");
}
}
This leads to the message "Unexpected error. Please retry."
In general, Bayou should allow multiple holes in the draft. This could be a reasonable goal for version 1.2.0. However, at the very Instead, Bayou should return a message that clarifies that we currently only allow one hole in the code at one time, and Askbayou should deliver this message.
Don't reflect the current socket message formats.
This is in support of AskBayou.
The following input to synthesize.sh
import edu.rice.cs.caper.bayou.annotations.Evidence;
public class TestIO1 {
void read(String file) {
Evidence.apicalls("readLine");
}
void foo(String file) {
Evidence.apicalls("readLine");
}
}
Produces the following output:
$ ./synthesize.sh test.java
Exception in thread "main" java.io.IOException: Unexpected status code: 500
at edu.rice.cs.caper.bayou.core.bayou_services_client.ap_synthesis.ApiSynthesisClient.synthesizeHelp(ApiSynthesisClient.java:129)
at edu.rice.cs.caper.bayou.core.bayou_services_client.ap_synthesis.ApiSynthesisClient.synthesise(ApiSynthesisClient.java:78)
at edu.rice.cs.caper.bayou.application.api_synthesis_server.ApiSynthesisLocalClient.synthesise(ApiSynthesisLocalClient.java:54)
at edu.rice.cs.caper.bayou.application.api_synthesis_server.ApiSynthesisLocalClient.main(ApiSynthesisLocalClient.java:95)
on commit f29f888
Here is some code I entered:
import edu.rice.cs.caper.bayou.annotations.Evidence;
public class TestIO1 {
// Read from a file
void read(String file) {
Evidence.apicalls("readLine");
System.out.println("moo moo.");
}
}
In the output, the System.out.println statement got eaten. That is, Bayou returned programs like:
import edu.rice.cs.caper.bayou.annotations.Evidence;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;
public class TestIO1 {
// Read from a file
void read(String file) {
String s;
BufferedReader br;
InputStreamReader isr;
InputStream is;
try {
isr = new InputStreamReader((is = file.getClass().getResourceAsStream(file)));
br = new BufferedReader(isr);
while ((s = br.readLine()) != null) {
}
} catch (IOException _e) {
}
}
}
In fact, the same thing happens when we change one of the demo examples slightly:
import edu.rice.cs.caper.bayou.annotations.Evidence;
import android.bluetooth.BluetoothAdapter;
public class TestBluetooth {
/* Get an input stream that can be used to read from
* the given blueooth hardware address */
void readFromBluetooth(BluetoothAdapter adapter) {
String address = "00:43:A8:23:10:F0";
Evidence.apicalls("getInputStream");
Evidence.types("BluetoothSocket");
}
}
All I have done here is removed the braces from the evidence declarations. This erases the definition of "address". We get:
import edu.rice.cs.caper.bayou.annotations.Evidence;
import android.bluetooth.BluetoothAdapter;
import java.io.IOException;
import java.util.UUID;
import android.bluetooth.BluetoothSocket;
import java.io.OutputStream;
import java.io.InputStream;
public class TestBluetooth {
/* Get an input stream that can be used to read from
* the given blueooth hardware address */
void readFromBluetooth(BluetoothAdapter adapter) {
OutputStream os;
InputStream is;
BluetoothSocket bs;
try {
is = (bs = adapter.getRemoteDevice(address).createInsecureRfcommSocketToServiceRecord(UUID.randomUUID()))
.getInputStream();
os = bs.getOutputStream();
} catch (IOException _e) {
}
}
}
On the query:
import java.util.*;
public class TestStack {
void foo(Stack s) {
/// calls:pop calls:isEmpty
}
}
one of the top-3 outputs is:
import java.util.*;
public class TestStack {
void foo(Stack s) {
String s1;
boolean b;
if (b = s.isEmpty()) {
s1 = s.pop();
} else {
}
}
}
This error won't show up if we treat isEmpty and !isEmpty as distinct API calls. I think we should do so, for not just isEmpty but all API calls with boolean return values.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.