pinocchio:

What worries me is that my Neural Net modules/object have many more things inside of them besides only parameters.


The state_dict will store all registered parameters and buffers.
If you need to serialize some tensors, you should thus create an nn.Parameter, if it’s trainable, or a buffer via self.register_buffer(name, tensor), if it’s not trainable.



 pinocchio:

Isn’t for my use case easier to simply use the pickle.dump function? Why would I use torch.save in general?


Answered in the other thread 444.



 pinocchio:

The easiest thing for me is if I could just save the whole python program state


That’s generally not recommended.
Instead you should store the state_dicts and the source files separately.
Storing e.g. the complete model could force you to recreate exactly the same file and folder structure.