This repository contains the source code of "Named Entity-Based Enrichment with BART" for the second subtask of NL4Opt. Refer to the NL4Opt page for details about the subtask.
This repository is based on the baseline code for the second subtask which can be found at the NL4Opt's official implementation. Check their README.md for details.
Use environment.yml
to setup the environment:
conda env create -f environment.yml -n <ENV_NAME>
conda activate <ENV_NAME>
Verify that it was installed:
conda env list
First, copy the dataset files train.jsonl
and dev.jsonl
to the data
subdirectory. The dataset files can be found under the generation_task
subdirectory in the dataset repository.
The config files for training are present in the configs
subdirectory.
baseline.json
: Config for the baseline model.default.json
: Config for our approach that we used for the final submission.
The training and testing pipeline can be run using train_and_evaluate.sh
. This script expects Miniconda installed under ~/miniconda3/
and test.jsonl
present under the data
subdirectory.
bash train_and_evaluate.sh
To train the model, run the following:
python train.py --config configs/default.json --seed 42
The important parameters in the training are:
-
use_copy
uses a copy mechanism that computes$P_\text{copy}$ over the input tokens. -
per_declaration
controls each training data sample to correspond to a single declaration of a given LP problem instead of the entire formulation (i.e. all declarations in the problem). -
enrich_ner
controls if the named entity information should be added to the input before feeding it to the model.
To evaluate the model, run the following:
python test.py --gpu <gpu id> --checkpoint <checkpoint.mdl> --test-file <test.jsonl> --batch-size <test_batch_size> --beam-size <beam_size>
For any queries, feel free to reach out to gangwar2 [at] illinois [dot] edu.