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

KeyError: 'train_subset' #4

Closed
hkunzhe opened this issue Jun 7, 2021 · 4 comments
Closed

KeyError: 'train_subset' #4

hkunzhe opened this issue Jun 7, 2021 · 4 comments

Comments

@hkunzhe
Copy link

hkunzhe commented Jun 7, 2021

Hi, thanks for sharing your codes!
I was able to run perturbation.py and main.py in the Sample-wise noise for unlearnable example on CIFAR-10 section. However, when I try to run perturbation.py in the Class-wise noise for unlearnable example on CIFAR-10 section, it raises the following error:

Traceback (most recent call last):
  File "perturbation.py", line 483, in <module>
    main()
  File "perturbation.py", line 469, in main
    noise = universal_perturbation(noise_generator, trainer, evaluator, model, criterion, optimizer, scheduler, random_noise, ENV)
  File "perturbation.py", line 191, in universal_perturbation
    for i, (images, labels) in tqdm(enumerate(data_loader[args.universal_train_target]), total=len(data_loader[args.universal_train_target])):
KeyError: 'train_subset'

Thus, I add an option --universal_train_target train_dataset to fix this error. Is this right to get the class-wise perturbation?
BTW, there are two typos (--perturb_type samplewse=>--perturb_type samplewise) in README.md.

@HanxunH
Copy link
Owner

HanxunH commented Jun 7, 2021

Hi,

Thanks for your interest in our work.

  • Yes, --universal_train_target train_dataset should be added to the options for classwise setting . The README is missing it. In case of other errors, for each corresponding experiment in the paper, there is exp_setting.sh documents all the options.
  • Thanks for the typos.
  • I have updated the README for the --universal_train_target train_dataset option as well as fixed the typos.

Best,

HanxunH added a commit that referenced this issue Jun 7, 2021
@hkunzhe hkunzhe closed this as completed Jun 7, 2021
@hkunzhe hkunzhe reopened this Jun 7, 2021
@hkunzhe
Copy link
Author

hkunzhe commented Jun 7, 2021

Thanks for your quick reply!
It seems you have added the --universal_train_target train_subset rather than --universal_train_target train_dataset in the README.md.

@HanxunH
Copy link
Owner

HanxunH commented Jun 7, 2021

Sorry for the confusion.

I have double checked this. For classwise, as stated in the paper, we use We use 20% of the training dataset., so this should indeed be tran_subset. To avoid the error, please use --use_subset in perturbation.py

Technically, it is also ok to use entire dataset to generate the noise. We use 20% to simulates that it can generalize to unseen data (the rest of 80%).

HanxunH added a commit that referenced this issue Jun 7, 2021
@hkunzhe
Copy link
Author

hkunzhe commented Jun 7, 2021

Thanks for your clarification!

@hkunzhe hkunzhe closed this as completed Jun 7, 2021
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