aks2203 / poisoning-benchmark

A unified benchmark problem for data poisoning attacks
https://arxiv.org/abs/2006.12557
MIT License
145 stars 21 forks source link

RuntimeError #22

Open suremangood opened 3 weeks ago

suremangood commented 3 weeks ago

A cuda problem occurred when running the script python test_model.py --model mobilenet_v2 --model_path "pretrained_models/MobileNetV2_Tinyimagenet_first.pth" although I have installed the compatible 10.1 version. Can you answer this question? ![Uploading 屏幕截图 2024-06-21 161337.png…]()

aks2203 commented 3 weeks ago

Hi there, that's not quite enough information for me to know what's wrong. I likely won't be so helpful in resolving Cuda bugs, they may very well be from driver/version/compatibility issues that have nothing to do with the Poisoning benchmark code itself anyway. If you can share more info and you can tell the issue is from our code, please let me know where we can be more helpful. Otherwise we can close this issue.

suremangood commented 2 weeks ago

Hello, I changed the window system and can run the first script. However, in the second script python poison_test.py --model resnet18 --model_path "pretrained_models\ResNet18_CIFAR10_adv.pth" --poisons_path "poison_examples\CIFAR-10_transfer\bp_poisons \num_poisons=25\2"No response when running

suremangood commented 2 weeks ago

屏幕截图 2024-06-27 172946

aks2203 commented 2 weeks ago

It appears that file does not have code that will run when called as directed in the Readme. This can be fixed by appending the following block to the end of the file.

  if __name__ == "__main__":

      parser = argparse.ArgumentParser(description="PyTorch poison test")
      parser.add_argument("--model_path")
      parser.add_argument("--model")
      parser.add_argument("--poisons_path", type=str, required=True, help="where are the poisons?")
      parser.add_argument("--dataset", type=str, required=True, help="dataset")
      parser.add_argument("--output", default="output_default", type=str, help="output subdirectory")

      args = parser.parse_args()
      set_defaults(args)
      main(args)

I don't know why this was missing from poison_test.py. Can you try adding this block to the end of the file and running again? If you encounter type errors or missing arg errors please let me know the best way to modify this block so the file runs as intended.