Functional -> Sequential, get weights and load them into the Functional


I haven’t found a thread on the same topic, sorry if there is one already!

So, I am converting a model into a nn.Sequential model. Once trained, I would like to load those weights into the pre-Sequential (functional) model. Is there a way to map the Sequential model’s keys back to the original model?

Thank you very much!

You could manually load the state_dicts into the custom module and the actual approach would depend on the model architectures, the naming of the layers, etc.

Alright, thank you! I was hoping there might be a way to figure out the functional->sequential mapping of the layer names automatically, but manually it is :grin: