Closed andyclsr closed 1 year ago
can concretely tell me how to store the attacked model after this step:
attack_dir
sets the folder_path
of Attack
instance, which is attack.folder_path
. This property is used in many places including saving method (see following)
https://github.com/ain-soph/trojanzoo/blob/1f417cc0da0c4ad0483a6f050f18930d0813f9e3/trojanvision/attacks/abstract.py#L110-L112
The save_fn
is passed to model._train
method and used in
https://github.com/ain-soph/trojanzoo/blob/1f417cc0da0c4ad0483a6f050f18930d0813f9e3/trojanzoo/utils/train.py#L201-L203
This structure is to save model during training intervals. If you simply want to save model in your main script after training, you can always use model._model
, which is a standard torch.nn.Module
. You can use torch.save(model._model.state_dict(), save_path)
To control the interval to save models, use validate_interval parameter (command-line argument as well)
To control the interval to save models, use validate_interval parameter (command-line argument as well)
what if i want to save multiple models? not just updating one model.
@andyclsr You have 2 options:
ok I know it. really thank you for your generous explanations! wish you a good day!
hi, your work is excellent but i encounter some problems. first , i read similar problems https://github.com/ain-soph/trojanzoo/issues/153 and your https://ain-soph.github.io/trojanzoo/trojanvision/configs.html ,but constructions about configs are hard to understand and the example you provide is limited like this : https://github.com/ain-soph/trojanzoo/blob/main/trojanzoo/configs/dataset.yml.
my problem is i don't know how to store intermediate results and i think it is my config problem i do something like this : and for example attack.yml is only " attack_dir: /data/attack/" and my file structure:
my main.py :
i still wonder about the use of config file and it seem like nothing was stored.
i hope you could give a concrete example about the use of it. thx anyway