Data can be found here
-
Virtual env:
conda env create -f environment.yml python=3.6
-
Install the COMeT
- Follow the instruction here.
- There are some extra packages you need to install here.
conda install -c pytorch pytorch pip install ftfy
-
First, download the pretrained models from here.
-
Then untar the file:
tar -xvzf pretrained_models.tar.gz
- Then run the following script to interactively generate arbitrary ATOMIC event effects:
python scripts/interactive/atomic_single_example.py --model_file pretrained_models/atomic_pretrained_model.pickle
-
Some absolute paths have to be changed here.
-
How to use COMeT to convert sentence as knowledge graph?
python KG_gen/KG_gen.py
-
Install verbatlas SRL
- The file is located at
./verbatlas/src
- Installation follows here
- The file is located at
-
No need to prepare for verbnet parser. Location:
./semparse-core/
-
Install allennlp and allennlp-model based on HERE.
-
Install new comet-atomic 2020 HERE.
-
Pattern cannot used in python 3.7 Solution
-
No module named '_ctypes'
sudo apt-get install libffi-dev
- When run SRL, get
__init__() got an unexpected keyword argument 'max_n'
pip uninstall py-rouge
pip install py-rouge
cd verbatlas/src&&gunicorn --workers 4 --bind 0.0.0.0:5000 wsgi:app
cd verbnet-approach/src&&python main.py --trainer_type KG_diff_file --topk 2 --story_length 3 --KG_use --remain_div
cd verbnet-approach/src&&python main.py --trainer_type KG_diff_step_file --topk 5 --story_length 10 --KG_use --remain_div --look_ahead 1 --seed 3
Given a state, RM will output action space and then human choose an action, and RM will generate a new state. This is the code you need to run in the command line. However, there might need some modification for the absolute path. I have tried my best to convert all the absolute path to relative ones. Pls LMK if there still exist any absolute path. Thanks.
For generating action space and new state, the main file is here.
define_roles()
: Find role/ character names in the sentence.prepare_next_step()
: Use the parser, construct or add nodes in KGgenerate_actions()
: Given the KG and then generate all the possible action space.forward()
: Different round will trigger different functions. It will be called in main.py and move one sentence forward.
๐คฉ Features (defined here)
trainer_type
:QA
orgeneration
orKG
orKG_diff
orKG_diff_file
, We are usingKG_diff_file
as default.model_name_or_path
: GPT-2's pretrained model pathmapping_file
andverbnet_json
: path of verbnet files.target_path
: path to save kg visualizationmodel_file
: COMeT path- BART is used to fill in the verbs. The model is
facebook/bart-large
- GPT-2 finetuned on ROC is used to generate the sentence after we have verb and noun.
--KG_use
: whether to use KG to update the game state--topk
: int, # of sentence for each round we remain.--action_standard
: Use verb or sentence as actions. Now we are usingsentence
as default.--remain_div
: half of the candidates have different prompts--story_length
: length of the generated story--look_ahead
: only apply totrainer_type=KG_diff_step_file
ortrainer_type=KG_diff_step
,m_1
in the paper.