The common two approaches are mentioned in the linked doc and are basically:

store the state_dicts and keep the model source code around. You can refactor the code and as long as the model’s __init__ method creates the same submodules you will be able to load the state_dict into the model. You could change the forward method of the model as the state_dict doesn’t have any knowledge about the forward pass.
store the model object directly and make sure the project structure is equal in your other setup where you would like to load the model

You could also check the new torch.package module, which might be useful for your use case.