TransWikia.com

while re-training a pre-trained model, I'm facing this issue RuntimeError: You must compile your model before using it

Data Science Asked on September 28, 2021

model summary:

enter image description here
enter image description here
enter image description here

RuntimeError: You must compile your model before using it.

It says that the model needs to be compiled. But as far i know, if i compile a model, all the previous trained data will be lost, and the model will be trained from scratch. I don’t want this to happen because i want to use this model for further re-training purposes. Can you help me in this.

Can I re-train the model without compiling it and ,save it and use this model for future training ?

One Answer

There 2 techniques while using the pre-train model

1. Transfer learning: In the case of transfer learning, we use the pre-train model to train on new kind of dataset so generally, remove the last layer and add a new layer into the network. At this point, as you are adding a new layer the model should be compiled. But don't worry if you are compiling it then weights will not be lost.

2. Retraining (I guess this is your case): As you are not modifying the architecture but just training it on additional dataset then also it is not going to loose weights.

Answered by Swapnil Pote on September 28, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP