How to load two neural networks in pytorch
Let's say I have two jupyter notebooks, one for each neural network. They both are for binary classification. I want to combine the results of two networks, for example I want the probability of x belonging to a class to be 0.2model1(x)+0.8model2(x).
I saved both models with
torch.save(model.state_dict(), 'saved_networks/model1.pt')

Now I saw that in order to load a model I first have to create an object of this class
model = TheModelClass(*args, **kwargs)
model.load_state_dict(torch.load(PATH))

But I have these classes in two different notebooks, so my question is how does one usually handles such situations?

I would suggest you write the two classes properly in .py files. This way you can import those classes anywhere you want (let it be a notebook or another python file). For instance, if you have Model1 and Model2 classes defined in models.py you can then import them, initialize separate models and load their respective state dictionaries:
from models import Model1, Model2

model1 = Model1(*args, **kwargs)
model2 = Model2(*args, **kwargs)

model1.load_state_dict(torch.load(PATH1))
model2.load_state_dict(torch.load(PATH2))

