Error message when loading state dict

Hi, I want to load my saved model as described in the tutorials and it worked very well a few days ago. But now I get the following error message


  File "C:\ProgramData\Anaconda3\lib\site-packages\torch\nn\modules\", line 751, in load_state_dict
    state_dict = state_dict.copy()

AttributeError: 'function' object has no attribute 'copy'

The Code where it happens is:

def trace_Model(self):
        optimal_network = Network()
        optimal_network.load_state_dict(t.load('')) #error here    
        traced_model = t.jit.trace(optimal_network, t.rand(1,1,128,128)) 
        print(f"is Training Mode: {}")"")

It seems that there is a bug in the nn.Module class. How can I fix this? I get also the Message, that Code has been changed and I tried the advice but it did not help.
SourceChangeWarning: source code of class '__main__.Network' has changed. you can retrieve the original source code by accessing the object's source attribute or set `torch.nn.Module.dump_patches = True` and use the patch tool to revert the changes. warnings.warn(msg, SourceChangeWarning)