Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Necessary steps to run Scheme 2? #48

Closed
hanglearning opened this issue Apr 30, 2022 · 9 comments
Closed

Necessary steps to run Scheme 2? #48

hanglearning opened this issue Apr 30, 2022 · 9 comments

Comments

@hanglearning
Copy link

Dear VITA-Group,

I have read your awesome paper You are caught stealing my winning lottery ticket! Making a lottery ticket claim its ownership and I am interested in tuning the idea of QR Code embedding and verification, and leverage it into our own project. Currently, I wish to debug the entire code process of Scheme 2 to understand the nitty gritties.

I could successfully run the code main_imp_new.py, but I have difficulties running Scheme 2. The documentation only has this one line of command

Scheme 2

python embed_res20s_cifar10.py

The code couldn't run by just this command. I have also tried to run main_imp_new.py to create a model for embed_res20s_cifar10.py to load, but then there would be more exceptions.

May I ask how I can execute Scheme 2?

Thanks for your help!

@xxchenxx
Copy link
Collaborator

Thank you for your interest; I will update a more detailed steps to help run the codes. Maybe later this week/weekend and thank you for your patience.

@hanglearning
Copy link
Author

Thank you so much for your prompt response! Your help is much appreciated and will help big on our project! 👍

@xxchenxx
Copy link
Collaborator

btw, could you please share me the errorlog? Thanks!

@xxchenxx
Copy link
Collaborator

xxchenxx commented May 1, 2022

Hi Hang,

I have ran with our previous codes and I got the following outputs:

0.19369237907088122
layer2.1.conv1.weight_mask
0.5267538644470868
dict_keys(['layer1.0.conv1.weight_mask', 'layer1.0.conv2.weight_mask', 'layer1.1.conv1.weight_mask', 'layer1.1.conv2.weight_mask', 'layer1.2.conv1.weight_mask', 'layer1.2.conv2.weight_mask', 'layer2.0.conv1.weight_mask', 'layer2.0.conv2.weight_mask', 'layer2.1.conv1.weight_mask', 'layer2.1.conv2.weight_mask', 'layer2.2.conv1.weight_mask', 'layer2.2.conv2.weight_mask', 'layer3.0.conv1.weight_mask', 'layer3.0.conv2.weight_mask', 'layer3.1.conv1.weight_mask', 'layer3.1.conv2.weight_mask', 'layer3.2.conv1.weight_mask', 'layer3.2.conv2.weight_mask'])
layer2.1.conv1.weight_mask
2 3
(29, 29)
-481
(4, 2254)
(4, 481)
0.19369237907088122

It seems fine at my side. So if you could please share your errorlog with me, I can debug with more efficiently. Thanks!

@hanglearning
Copy link
Author

hanglearning commented May 1, 2022

Hi Xuxi,

Sorry for the late reply! I should have replied to you in the afternoon as I actually thoroughly went through the main_imp_new.py today and generated a toy res20s_cifar10 ticket model (with 3 epochs per pruning state, total 3 pruning states as well), and I directed embed_res20s_cifar10.py to read that model at line 4, and removed assert False at line 44, now the code can run successfully! I then went to go through extract_qrcode_*.py and was planning to follow up for extract_qrcode_*.py if I have any questions. I apologize for the delay.

I do still have one question about embed_*.py. I see there is a pdf generated to visualize the final QR code. If I understand it correctly, this QR code is the final mask with the signature embedded. But the QR Code shown on my pdf does not contain those 3 big corners, therefore it cannot be scanned. Is this the correct behavior of the code? I thought the output should be like figure 3 or 4 in the paper.

Now I have difficulties running extract_qrcode_res20s_cifar10.py. I used my toy ticket model 2model_SA_best.pth.tar as its checkpoint. The code caught an exception in prune.CustomFromMask.apply(m, 'weight', mask=mask_dict[name+'.weight_mask']), prune_model_custom() in pruning_utils_2.py. . Unfortunately the error message does not seem to tell anything. Here is a screenshot.

Please advise, thanks!

Btw, should I open a new issue for questions about extract_qrcode_res20s_cifar10.py?

@xxchenxx
Copy link
Collaborator

xxchenxx commented May 1, 2022

Yes we remove the 3 big corners because they can be added back (and also hiding the big corners will make the attack more difficult because the location is not directly shown). In Figure 3 or 4 we actually add the corners back for better visualization.

You don't need to open a new issue - we can continue to discuss here. From my perspective of view I think this might be related to pytorch version problem. Can you share me the version of pytorch you used? Thanks!

@xxchenxx
Copy link
Collaborator

xxchenxx commented May 1, 2022

I hope you are not in some emergency need - I can update a more detailed instruction later in May and make everything clear

@hanglearning
Copy link
Author

Hi Xuxi,

I appreciate your quick response always! Got it. If it won't take you too much time, could you briefly explain how I may add the corners back? Or any useful resource would be highly appreciated!

I am using Pytorch 1.6.0 as directed in readme, with CUDA 10.2. I guess the issue may also be caused by the fact that I used too few epochs and pruning states. Could you share your checkpoint with me so I can verify if the issue is indeed caused by the Pytorch version?

I will be having a presentation in the coming week about the possibility of integrating the qrcode embedding into our project. I just have to prove that the concept is working. If it won't take you much time, I think once I have the extract code working with a checkpoint, I should be good for a while 😊

@xxchenxx
Copy link
Collaborator

xxchenxx commented May 1, 2022

The pruning states and few epochs won't cause this problem since the problem now is about pruning ... Let me work out a way to share files with you.

@xxchenxx xxchenxx closed this as completed May 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants