-
Notifications
You must be signed in to change notification settings - Fork 478
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
EXAMPLE : Interpreter grounded Neural Program Synthesis [WIP] #81
EXAMPLE : Interpreter grounded Neural Program Synthesis [WIP] #81
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for this example @reshinthadithyan ! it mostly looks good aside from a few things. Could you also format the python files with black?
output.append(value_gen) | ||
return output | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you comment this file more? Maybe to separate the sections and an explanation at the top for the structure of the language/interpreter
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Strong agree. The documentation here is not clear.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding more documentation, thanks for the review.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added more documentation on the sampler.
*Program synthesis* is the task of automatically generating programs that solve a given task by satisfying an IO condition. In Neural Program Synthesis the synthesizer is a neural network which is a Language Model that takes in an input/output pair and tries to generate the program in the defined toy DSL's Grammar. | ||
|
||
## Toy List Manipulation DSL Grammar | ||
The DSL has the following grammar: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In addition to the DSL grammar, add some snippets
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added example snippets to showcase the atomic functions.
This looks fantastic! I think we should upload a trained model to hugging face hub that goes along with this tutorial, and allow people to validate their model against our uploaded one. What do you think Reshinth? |
@LouisCastricato Yes, the idea is to give a fully reproducible script for the anyone to train it by themselves and validate. |
LGTM, ready to merge with your approval @cat-state |
LGTM! thanks @reshinthadithyan ! |
Precommit is failing. Will merge after resolution. |
This PR adds an example of using
trlx
to ground LMs into the interpreter with a toy list manipulation DSL to make them generate more coherent programs to satisfy IO conditions.Questions:
ReadME.md
. Does the current directory structure look good ?Interpreter Grounded Program Synthesis
Program synthesis is the task of automatically generating programs that solve a given task by satisfying an IO condition. In Neural Program Synthesis the synthesizer is a neural network which is a Language Model that takes in an input/output pair and tries to generate the program in the defined toy DSL's Grammar.
Toy List Manipulation DSL Grammar
The DSL has the following grammar:
To generate training/testing data run,
python3 -m lang
. The dataset would be saved in./dataset/train.json
and./dataset/test.json
. To use the processed dataset refer to this google drive link.Each datapoint in the dataset would look like,
Training with TRLX
Run
python3 -m train_trlx.py
to run the training with grounded interpreter. Thereward_fn
, would return-1
if a sample generated is of invalid syntax. it would return0.5
if the generated syntax is valid but doesn't satisfy IO condition.