Im trying to build an autoencoder trained on the CIFAR-10 dataset, and use the encoded features to input into a classifier to do classification. My issue is, I want to be able to train both the models in the same training loop as designed in this thread:
https://discuss.pytorch.org/t/autoencoder-and-classification-inside-the-same-model/36248
This means, I need to be able to write a custom training loop, but I want to be able to enclose it into a Fastai Learner so I can get all the nice features which come along with it.
Strangly, I am not finding much information on either the forums or the docs.
I understand that if we have one model, which takes some input and gives some output, Its pretty convenient to wrap it in a learner by doing model = Learner(model = model)
. But In my case, as shown in the link, I have three models, the encoder, decoder and the classifier, the output of the encoder serves as the input to both classifier and decoder, and both have differnt losses and update steps. How can I wrap this training loop in a Learner?
How can I use callbacks to do optimization steps for two models at once? Im a begineer in PyTorch, Kinda frustrating. Please Help.