-
Notifications
You must be signed in to change notification settings - Fork 10
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
Your code currently operates one image at a time, is it possible to adjust the batch_size operation? I look forward to hearing from you! #6
Comments
Hi @tanlingp , In theory, we can of course generate adversarial images in batches. However, since this method currently requires backpropagation through multiple diffusion steps, many intermediate calculation graphs are stored, so even if only a single image is processed, the memory usage is approximately 16GB. Thus with only my current equipment (a single Rtx3090), I'm afraid I am not able to test turning the code into batches. However, if you have multiple GPUs or more memory, the most straightforward way I recommend is to use Hope this helps. |
Hi @WindVChen, This article proposes the Segment-wise Forwarding-Backwarding algorithm to address the memory issue in computational graphs, aiming to improve the efficiency of DiffAttack. |
Hi @yujinhan98, Thank you for sharing the article. I appreciate your insight in addressing the memory issue with Segment-wise Forwarding-Backwarding. However, it seems that this approach might prolong the optimization time, which might still fail to speed up the generation of the adversarial examples. While I haven't delved into all the intricacies of the article, Segment-wise Forwarding-Backwarding seems akin to the commonly used gradient checkpointing trick. This method involves recalculating computational graphs during the backpropagation phase, leading to increased processing time, contingent on the number of checkpoints set. @tanlingp's intention, I think, is to expedite the generation of adversarial examples by leveraging batch processing. Given the longer processing time per input associated with Segment-wise Forwarding-Backwarding (despite its reduced memory usage), it may not significantly enhance the speed, which is the primary concern here. Nonetheless, I appreciate your contribution. Many thanks for sharing your insights. Best regards. |
Your code currently operates one image at a time, is it possible to adjust the batch_size operation? I look forward to hearing from you!
The text was updated successfully, but these errors were encountered: