Code Monkey home page Code Monkey logo

nesa-demo's Introduction

Neuro-Symbolic Agent Demo

This repository contains a demo for Neuro-Symbolic Agent (NeSA), which is specifically Logical Optimal Action (LOA).

Setup

  • Anaconda 4.10.3
  • Tested on Mac and Linux
git clone --recursive [email protected]:IBM/nesa-demo.git
conda create -n nesa-demo python=3.8
conda activate nesa-demo
conda install pytorch=1.10.0 torchvision torchaudio -c pytorch
conda install gensim==3.8.3 networkx unidecode nltk=3.6.3
pip install -U spacy
python -m spacy download en_core_web_sm
python -m nltk.downloader 'punkt'
pip install -r requirements.txt
cp -r third_party/commonsense_rl/games static/


# Download models
wget -O results.zip https://ibm.box.com/shared/static/chr1vvgb70mmt2gr1yijlsw3g7fq2pgs.zip
unzip results.zip
rm -f results.zip


# Download AMR cache file
mkdir -p cache
wget -O cache/amr_cache.pkl https://ibm.box.com/shared/static/klsvx54skc5wlf35qg3klo35ex25dbb0.pkl

Execute

export AMR_SERVER_IP=localhost
export AMR_SERVER_PORT=
python app.py --release

If you want to train the model by yourself

  • commonsense-rl (DL-only method)
cd third_party/commonsense_rl/
python -u train_agent.py --agent_type knowledgeaware --game_dir ./games/twc --game_name *.ulx --difficulty_level easy --graph_type world --graph_mode evolve --graph_emb_type glove --world_evolve_type manual --initial_seed 0 --nruns 1
  • LOA (NeSA method)
cd third_party/loa/
# follow the setup steps in README.md
python train.py
cp results/loa-twc-dleasy-np2-nt15-ps1-ks6-spboth.pkl ../../results/

Citations

This repository provides code for the following paper, please cite the paper and give a star if you find the paper and code useful for your work.

  • Daiki Kimura, Subhajit Chaudhury, Masaki Ono, Michiaki Tatsubori, Don Joven Agravante, Asim Munawar, Akifumi Wachi, Ryosuke Kohita, and Alexander Gray, "LOA: Logical Optimal Actions for Text-based Interaction Games", ACL-IJCNLP 2021.

    Details and bibtex

    The paper presents an initial demonstration of logical optimal action (LOA) on TextWorld (TW) Coin collector, TW Cooking, TW Commonsense, and Jericho. In this version, the human player can select an action by hand and recommendation action list from LOA with visualizing acquired knowledge for improvement of interpretability of trained rules.

    @inproceedings{kimura-etal-2021-loa,
        title = "{LOA}: Logical Optimal Actions for Text-based Interaction Games",
        author = "Kimura, Daiki  and  Chaudhury, Subhajit  and  Ono, Masaki  and  Tatsubori, Michiaki  and  Agravante, Don Joven  and  Munawar, Asim  and  Wachi, Akifumi  and  Kohita, Ryosuke  and  Gray, Alexander",
        booktitle = "Proceedings of the 59th Annual Meeting of the Association for Computational Linguistics and the 11th International Joint Conference on Natural Language Processing: System Demonstrations",
        month = aug,
        year = "2021",
        address = "Online",
        publisher = "Association for Computational Linguistics",
        url = "https://aclanthology.org/2021.acl-demo.27",
        doi = "10.18653/v1/2021.acl-demo.27",
        pages = "227--231"
    }
    

License

MIT License

nesa-demo's People

Contributors

daiki-kimura avatar ibm-open-source-bot avatar sanchit-agarwal avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

nesa-demo's Issues

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.