Shredder.ipynb
xiaoyangx0 opened this issue · 2 comments
So sorry to bother you. I have some questions.
In Shredder.ipynb, the class SplitNN is not the subclass of nn.Module, and also does not define the attribute of train. So why there is a code of splitnn.train() in first line of nineteenth block, aslo the questions is the same as splitnn.zero_grads(),splitnn.backward().
The code and the reason of fault is as following.
THX
`splitnn.train()
for epoch in range(3):
epoch_loss = 0
epoch_outputs = []
epoch_labels = []
for i, data in enumerate(victim_train_dataloader):
splitnn.zero_grads()
inputs, labels = data
inputs = inputs.to(device)
labels = labels.to(device)
outputs = splitnn(inputs)
loss = criterion(outputs, labels)
loss.backward()
epoch_loss += loss.item() / len(victim_train_dataloader.dataset)
epoch_outputs.append(outputs)
epoch_labels.append(labels)
splitnn.backward()
splitnn.step()
print(epoch_loss, accuracy(torch.cat(epoch_labels),
torch.cat(epoch_outputs)))`
`---->Shredder.ipynb#ch0000013vscode-remote?line=0) splitnn.train()
Shredder.ipynb#ch0000013vscode-remote?line=1) for epoch in range(3):
Shredder.ipynb#ch0000013vscode-remote?line=2) epoch_loss = 0
AttributeError: 'SplitNN' object has no attribute 'train'`
Thank you for your report! I found a bug in the build process of this package and fixed it. I guess re-installing will help your errors. I have also prepared the example notebook with google colab.
https://colab.research.google.com/drive/1C2UTAfReN94IxsX8ZEdN6odI9Ans9V4m?usp=sharing
Thank you for your report! I found a bug in the build process of this package and fixed it. I guess re-installing will help your errors. I have also prepared the example notebook with google colab.
https://colab.research.google.com/drive/1C2UTAfReN94IxsX8ZEdN6odI9Ans9V4m?usp=sharing
Thanks for your reply!
I have solved the problem by re-installing.
There are also some little bugs ,mainly focued on the problems that weights are in gpu but inputs are in cpu. But it is easy to solve.
Thanks for your reply and your code again!