Training Models on stages #19249
Unanswered
bakerhassan
asked this question in
Lightning Trainer API: Trainer, LightningModule, LightningDataModule
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I would like to train my model in two stages. The first one is to train the model as usual and then at the end of testing, I train a linear model that would be injected between two layers. The second stage is to finetune the model. I found that training a linear model during the testing stage doesn't fit with torch lightning design pattern, so in order to add the necessary information (i.e., the linear model) obtained during testing in the first stage, I created this Callback:
covariate stage
is the stage number. Here is how I am planning to run the two stages trainer:My problem now is how to load everything in the second stage to the trainer except its
loops
information which controls the training flow. Here is one of my attempts to make the trainer load everything from the first stage and at the same time force it to start training from epoch 0 to max_epoch (i.e., running the usual flow) but it fails as I broke something in the flow:Another workaround but I am not sure if it is the right thing is to double the max_epochs per stage:
which works fine (meaning the code runs fine).
Any ideas on how to do it?
Beta Was this translation helpful? Give feedback.
All reactions