Is there a way to get the model definition out of a saved model in Pytorch?

hello everyone, I hope you are having a great time.
Is there a way to access the model definition of a saved model? I know we have something kind of similar in jit traced models but I’m not sure if we have something like this in normal models.
what I’m looking for is to get my hands on the model definition that I have previously pruned! since the model is resnet18, its cumbersome to manually create/edit a new definition file for this model so I wonder whats my best options at the moment that I have my saved model, but without any definitions.
I dont want to train again and then save the traced model, this will work, but the training takes couple of days and I dont want to waste the days trained so far unless absolutely necessary.

Any suggestion /help is greatly appreciated
Thanks a lot in advance

If you are following the recommended way of storing the state_dicts only, you would have to store the model definition separately. I don’t think there is a clean way to store source code in Python without the danger of breaking it in several ways (but maybe you’ve seen something useful).

Thanks I must have been vague since you got me wrong.
to be more precise, I’m looking for a way to get an updated definition(i.e. latest representation of the model as is) based on the latest changes to the model structure, not the initial model definition.
For example during pruning some featuremaps are pruned and thus some layers that initially had x number of feature maps, now have x’ number. when the model is saved, the state_dicts are saved and thus I still need to find a (sane) way to also extract the model definition and save it along with the weights.
What are my options here?
I hope this makes it clearer.
Thanks a lot in advance