bjascob / amrlib

A python library that makes AMR parsing, generation and visualization simple.
MIT License
216 stars 33 forks source link

Finetuning gsii #32

Closed ari-schwartz closed 2 years ago

ari-schwartz commented 2 years ago

In the comments of a PR, you explained how to fine-tune the trained T5 parse model on additional data. Is there also a simple way to do this for the gsii parse model?

bjascob commented 2 years ago

I have never done this but looking at the code, it looks like you can at least resume training.

In configs/model_parse_gsii.json there is resume_ckpt:null. Create a copy of this config file and change this to the path of the trained model's filename (xx/model.pt), plus whatever else you need to modify (ie.. training data locations) and change epochs. Since this is a resume, your epoch count starts at the last trained epoch + 1 so you need to be sure your config file has more than 200 epochs (the original model was trained to epoch 200). Note that the downloadable model does not have the optimizer state saved so that will be initialized from scratch.

If you run into issue look in parse_gsii/trainer.py and search for resume_ckpt. There not a lot of code here and it looks fairly straight-forward if you need to modify something.