This code works under google colab. What could be the problem in your case?
model = OurAlex()
optimizer = torch.optim.Adam(model.parameters(), lr=1e-2) 
epoch = 0
path = 'model.pth'

state = {
    "epoch": epoch,
    "state_dict": model.state_dict(),
    "optimizer": optimizer.state_dict(),
}
torch.save(state, path)

###############

checkpoint = torch.load(path)
model1 = OurAlex()
optimizer1 = torch.optim.Adam(model1.parameters(), lr=1e-2) 

model1.load_state_dict(checkpoint['state_dict'])
optimizer1.load_state_dict(checkpoint['optimizer'])