Without model.py, running the attacker script fails immediately. You must act as a reverse-engineer and read the tensor metadata from the binary file using a simple Python interactive command string on the terminal:
$ python -c "import torch; b = torch.load('leak.pt'); print({k: v.shape for k, v in b['state'].items()})"
Based on the model parameters of the above output you can recreate model.py:
import torch.nn as nn class SmallNet(nn.Module): def __init__(self): super().__init__() self.net = nn.Sequential( nn.Linear(_, _), // insert net.0.weight variables in reverse order [neurons, vecor_length] nn.ReLU(), // net.1 holds no weight matrices or bias vectors, it must be a parameterless non-linear function like ReLU nn.Linear(_, _) // final transformation layer (net.2, variables in reverse order) uses 16 internal dimensions and reduces them down to an output array of length 2 ) def forward(self, x): return self.net(x)