Homework 1 ADL NTU 109 Spring

Environment

# If you have conda, we recommend you to build a conda environment called "adl"
make
# otherwise
pip install -r requirements.txt

Download trained models

# Please make sure you have change the argument of the downloaded model for later testing
bash download.sh

The downloaded model would locate at ./intent_best.pt and ./slot_best.pt.

Preprocessing

# To preprocess intent detection and slot tagging datasets
bash preprocess.sh

Please make sure you have directories for cache, ckpt and data after preprocessing.

Intent detection

python train_intent.py

Slot tagging

python train_slot.py

After training, the default model would locate at ./ckpt/intent/best.pt and ./ckpt/slot/best.pt. If you use the scripts to download models, move them to the corresponding directories or change the arguments in intent_cls.sh and slot_tag.sh.

Intent Testing

bash intent_cls.sh /path/to/test.json /path/to/pred.csv

Slot tagging

python test_slot.py /path/to/test.json /path/to/pred.csv