Hi, how can I freeze layers and activate certain custom functions multiple times while using Pytorch lighting? I can freeze and unfreeze models multiple times in Pytorch easily, however, not sure how to do it in Pytorch Lighting and utilizing EarlyStop and BASEFINETUNING CallBacks.
So basically, I need to freeze and unfreeze the model/layers in the following steps:
-
freeze backbone and train the classifier only.
1.1 stop training once validation loss is not decreasing for certain epochs (Early stop callbacks in PL)? -
unfreeze backbone and train the whole model for another 200 epochs but stop if validation loss is not decreasing? (how to do two early stop callbacks here?)
-
activate multi-inputs (my model need to take multi inputs in certain layers in this step) and continue training for another 100 epochs but stop if validation loss is not decreasing
-
activate the attention mechanism in some blocks and train for some epochs and stop if validation loss is not decreasing.
Is it possible to do all these in a single Trainer? or do I have to save/load checkpoints multiple times and reinitialize a new Trainer object?
Thanks in advance