Get hash value of a pytorch architecture?
I would like to automatically check whether a certain architecture has already been trained on a task. My thought is: If I can get a hash value of the architecture and store this value in a .json file, then I can check whether it has already been trained by checking whether the architecture's hash value is in the .json file.
However, I'm not exactly sure what to hash: If I hash the module object, then it will be different each time I run the program since it'll have a different id, because it's in a different memory location. Also, different random initializations will probably cause a different hash value.
Is there a way I can get a hash value that will be the same so long as the module consists of the same layers with the same dimensions?

I think hashing the string representation of the model might be a solution to your problem.
hash(str(model))

