allenai / allennlp

An open-source NLP research library, built on PyTorch.
http://www.allennlp.org
Apache License 2.0
11.75k stars 2.24k forks source link

Model fine-tuning with different training objective on the same dataset. #4055

Closed jabhinav closed 4 years ago

jabhinav commented 4 years ago

Please first search our GitHub repository and Discourse forum for similar questions. While we are encouraging users to ask questions in our new Discourse forum, we are still accepting questions as GitHub issues as well.

If you don't find a similar example and you would like to ask a question on GitHub you can use the following template:

System (please complete the following information):

Question I am trying to train to sequence-to-sequence encoder-decoder model. Initially, the model is to be trained with MLE training objective for 100 epochs on dataset X and later the model has to be fine-tuned with a different training objective (RL, Reinforcement Learning based) on the same dataset X for a total of 5 epochs.

For this, I have prepared a custom trainer that accepts a training signal (MLE or RL) and trains the model. The model architecture stays the same for both the signals but the loss value computed in the output_dict = {'loss': loss} changes based on the provided training signal (The decoder's forward pass takes this training signal and computes this loss).

How do I fine-tune the model? The config file changes slightly where 'model' section that accepts training-objective specific parameters changes. But the available fine-tune command ignores the 'model' section. Any ideas?

schmmd commented 4 years ago

@matt-gardner would you have any suggestions here? We were unable to help during issue review.

dirkgr commented 4 years ago

@jabhinav, I think we have an improvement on this in v1.0.0rc1, but since you are on v0.9.0, I think you can do something else. You can take the archive file you have from pre-training, uncompress it, and change the config.json file inside, so that it has your new configuration. Run fine-tune on that, and it should do what you want.

jabhinav commented 4 years ago

Thanks .