HiroakiMikami / mlprogram

PyTorch library for synthesizing programs from natural language
MIT License
18 stars 3 forks source link

How is the target vector (program rules sequence) in TreeGen created during training? #179

Open brando90 opened 3 years ago

brando90 commented 3 years ago

TreeGen learns by predicting the rules from the target program. Thus, I assume you make the target program into an AST and in that process you get a sequence (that is padded) indicating which rule was used. In particular to do that you need to decide on an ordering for the rules. Did you use DFS, BFS or something else for that? In what part of the code are you doing that? The code seems hard to follow due to the Profilers...perhaps it was only meant for you to use.

Thanks for your time!

HiroakiMikami commented 3 years ago

I converted the AST to a sequence of rules at https://github.com/HiroakiMikami/mlprogram/blob/master/mlprogram/actions/action_sequence.py#L310 by using DFS.