IBM / nesa-demo

Demo for Neuro-Symbolic Agent (LOA)
MIT License
14 stars 5 forks source link
artificial-intelligence machine-learning neuro-symbolic neuro-symbolic-ai reinforcement-learning

Neuro-Symbolic Agent Demo

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

Setup

git clone --recursive git@github.com: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

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
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.

License

MIT License