Closed machanic closed 4 years ago
When I use ImageNet dataset (224x224 resolution images) to test SimBA attack. The program failed and report error! The bug is located in https://github.com/cg563/simple-blackbox-attack/blob/master/run_simba.py#L137 The memory requirement is too high for current GPU (1339.86 GiB)!
Traceback (most recent call last): File "simba_attack/attack.py", line 441, in <module> attacker.attack_all_images(args, model, save_result_path) File "simba_attack/attack.py", line 258, in attack_all_images adv_images, success, query = self.attack_batch_images(model, images.cuda(), true_labels.cuda()) File "simba_attack/attack.py", line 176, in attack_batch_images x[left_indices] = left_vec[left_mask_remaining].view(-1, n_dims) RuntimeError: CUDA out of memory. Tried to allocate 1339.86 GiB (GPU 0; 10.92 GiB total capacity; 154.77 MiB already allocated; 1.95 GiB free; 39.23 MiB cached)
I have solved this problem, we only need to modify these parts: improved = left_probs.gt(prev_probs[remaining_indices]).bool() and queries_k[remaining_indices[~improved]] += 1.
improved = left_probs.gt(prev_probs[remaining_indices]).bool()
queries_k[remaining_indices[~improved]] += 1
When I use ImageNet dataset (224x224 resolution images) to test SimBA attack. The program failed and report error! The bug is located in https://github.com/cg563/simple-blackbox-attack/blob/master/run_simba.py#L137 The memory requirement is too high for current GPU (1339.86 GiB)!