- Python 3.6+
- PyTorch 1.7+
- NumPy
- tqdm
- transformers
To begin, you will need to prepare datasets with data in data/{dataset name}-{range}
directory as follows:
$ python processRaw.py --dn={dataset name} --rn={range}
$ python prepare_datasets.py --dn={dataset name} --rn={range}
The data directory consists of json files end with "train.json", "val.json" and "test.json". An example element is as follows:
{
"src": "X0,{;c;c},0",
"tgt": "0,{c;c;},0#@,@,@"
}
To train the model with the specified dataset and range with args in cofig/config.json
:
$ python train --dn={dataset name} --rn={range}
for more notification about the arguments, simply consult
$ python train -h
To predict a satisfying trace from the ltl formulas in test.json
using the best model in bestModel/
(which is retrieved by copying the best model specified in training log and renamed as {dataset name}-{range}.pth
):
$ python translate.py --dn={dataset name} --rn={range} --tdn={target dataset name}
It will give you the prediction of all range in target dataset and output the prediction at data/preiction-{dataset name}-{range}
.
To evaluate the prediction produced by the model mentioned above:
$ python evaluate.py --dn={dataset name} --rn={range} --tdn={target dataset name}
It will output the syntactic accuracy and semantic accuracy of prediction at all range of target dataset.
Parts of code/scripts are borrowed/inspired from: