Hi,
First, you should not serialize models but just their state_dict() to avoid such problem. Then you can recreate the model and load_state_dict() into it to get all the weights back.
This is a problem of python serialization, you should have exactly the same imports as when you saved the model when loading. You should import the model module the same way as it was done when you saved.