This repository contains the code and data used in the experiments for the paper "Beyond Pairwise: Global Zero-shot Temporal Graph Generation".
- Python 3.10
- Gurobi optimizer license https://www.gurobi.com
- Install the requirements.txt packages using pip:
- Create
dataandoutputdirectories in the root directory. - Create a
.envfile in the root directory and add your OpenAI/Gemini/Together API key/s:
OPENAI_API_KEY=your_openai_api_key
GOOGLE_API_KEY=your_google_api_key
TOGETHER_API_KEY=your_together_api_key
Dataset we used in our experiments (in the needed format):
- OmniTemp: https://github.com/AlonEirew/event-relation-resources/tree/main/tre_datasets/OmniTemp
- MATRES: https://github.com/AlonEirew/event-relation-resources/tree/main/tre_datasets/MATRES/_in_OmniTemp_format
- TBD: https://github.com/AlonEirew/event-relation-resources/tree/main/tre_datasets/TimeBankDense/_In_OmniTemp_format
- NT_6: https://github.com/AlonEirew/event-relation-resources/tree/main/tre_datasets/NarrativeTime/_In_OmniTemp_format/exclude_overlap_rel_a1
Download the dataset folders and place them in the data directory as follows:
OmniTemp/
test/
train/
MATRES/
test/
test_all_pairs_chunked
train/
TBD/
test/
test_converted_allpairs_chunked
train/
NT-6/
test/
test_18ment
train/
python scripts/run/run_zsl_tre.py --test_db omni --instruct timeline --api gpt --model_name gpt-4o --output_folder output/omni_gpt4o_exp --repeat 1--test_db : omni, matres, tbd, nt --instruct : timeline, global --api : gpt, gemini, together --model_name : model name according to the api used (e.g., gpt-3.5-turbo, gpt-4o, gemini-1.5, deepseek-ai/DeepSeek-R1, etc.) --repeat : number of times to repeat the experiment (for selfConsistency/globalConsistency)
eval_self_consistency.py --test_ds omni --test_folder output/omni_gpt4o_exp--test_ds : omni, matres, tbd, nt
--test_folder : folder containing the files generated by run_zsl_tre.py
eval_global_consistency.py --test_ds omni --test_folder output/omni_gpt4o_exp