Code Monkey home page Code Monkey logo

neurips21-proto-program-guided-transformers-for-program-guided-tasks's Introduction

ProTo: Program-Guided Transformer for Program-Guided Tasks

This repository is the official implementation of ProTo: Program-Guided Transformer for Program-Guided Tasks.

Youtube link: https://www.youtube.com/watch?v=Dd8EHqMfOPI&t=24s

Exemplar program-guided tasks:

image-20211103105216886

ProTo model illustrated:

image-20211103103539274

Abstract:

Programs, consisting of semantic and structural information, play an important role in the communication between humans and agents. Towards learning general program executors to unify perception, reasoning, and decision making, we formulate program-guided tasks which require learning to execute a given program on the observed task specification. Furthermore, we propose the Program-guided Transformer (ProTo), which integrates both semantic and structural guidance of a program by leveraging cross-attention and masked self-attention to pass messages between the specification and routines in the program. ProTo executes a program in a learned latent space and enjoys stronger representation ability than previous neural-symbolic approaches. We demonstrate that ProTo significantly outperforms the previous state-of-the-art methods on GQA visual reasoning and 2D Minecraft policy learning datasets. Additionally, ProTo demonstrates better generalization to unseen, complex, and human-written programs.

News

2022.April.15 Docs finish construction.

2021.Nov.27 Code is available at Github. Docs are under constructing.

Requirements

To install requirements:

# create conda environment
conda create --name proto python=3.7
conda activate proto
# install general packages
pip install -r requirements.txt

GQA

  1. Dataset download from the official website:

    bash scripts/download_gqa.sh
    
  2. Feature extraction via bottom up attention. The pre-trained features are from meta modular networks.

# clone repo
git clone --recursive https://github.com/MILVLG/bottom-up-attention.pytorch
# install detectron2
cd detectron2
pip install -e .
cd ..
# install apex
git clone https://github.com/NVIDIA/apex.git
cd apex
python setup.py install
cd ..
# install bottom up attention repo
python setup.py build develop
pip install ray

Minecraft

The original data and code are not available due to license issue (the original Minecraft dataset is from the Google company). However, I can provide help if you drop me an email: [email protected].

Training

GQA

To train the model(s) in the paper, run this command:

python run_experiments.py

Using -h to see the possible options.

Minecraft

The original data and training code are not available due to license issue (the original Minecraft dataset is from the Google company). However, I can provide help if you drop me an email: [email protected].

Evaluation

To evaluate my model on ImageNet, run:

python run_experiments.py --do_eval

Reference and acknowledgement

Cite our paper:

@misc{zhao2021proto, title={ProTo: Program-Guided Transformer for Program-Guided Tasks}, author={Zelin Zhao and Karan Samel and Binghong Chen and Le Song}, year={2021}, eprint={2110.00804}, archivePrefix={arXiv}, primaryClass={cs.LG} }

Contributing

Please raise an issue if you found a bug and we welcome pull requests.

neurips21-proto-program-guided-transformers-for-program-guided-tasks's People

Stargazers

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

Watchers

 avatar  avatar

Forkers

huudatdo

neurips21-proto-program-guided-transformers-for-program-guided-tasks's Issues

Error about gqa file

I'm trying to train the model on GQA, but the following error occurs:

Traceback (most recent call last): File "run_experiments.py", line 17, in <module> from gqa_dataset import * File "/home/mcislab/data1/LXY/Multi_Path/ProTo/gqa/gqa_dataset.py", line 4, in <module> from gqa_mnnm_constants import * File "/home/mcislab/data1/LXY/Multi_Path/ProTo/gqa/gqa_mnnm_constants.py", line 84, in <module> with open('meta_info/GQA_hypernym.json') as f: FileNotFoundError: [Errno 2] No such file or directory: 'meta_info/GQA_hypernym.json'

So how can I get these files? Are they made by codes or downloaded from the url?

The accuracy is lower than the results reported in the paper.

The arguments are fixed.
we run python run_experiment.py --do_train", which means that we use **trainval_unbiased_all_fully** and testdev_pred" ( The data is directly from Meta)。

The results are as follows. We only get 55% (vs 65 in paper). Is there any wrong or I miss some important details?
image

Cannot run the codes because of missing files

@sjtuytc I'm trying to use the "generate_cand_dict" to generate type2can_dict.pkl, but this script is also not runnable... It requires 'mmnm_questions/list_trainval_all_fully.pkl', which does not exist. Also I searched the entire repo, and didn't find any code for generating the "list_trainval_all_fully.pkl".
Could you please provide a way to run the code?

关于预训练模型

您好,能否提供一下您的finetuned的模型,还有您将language转为program的transformer 模型

Release Full Code?

Hi, thanks for your valuable work!
I notice that the current repo only contains meta-NMN on GQA, so when do you plan to release the full code and models of your work? Can't wait for it :)

运行过程中的bug.

执行参数:python run_experiments.py --do_train
按照您的提示,一步步创建pkl文件,但是在gqa_dataset.py的130行,returns = entry[2],我们发现这个始终是空列表,从而在下面的执行中报错

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.