-
Notifications
You must be signed in to change notification settings - Fork 0
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
Adv training #24
Adv training #24
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #24 +/- ##
==========================================
- Coverage 41.32% 40.66% -0.66%
==========================================
Files 10 10
Lines 242 241 -1
==========================================
- Hits 100 98 -2
- Misses 142 143 +1 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM although you could perhaps still add tests for the training functions? Guess local and manual testing is also sufficient for now though
) | ||
θ = Flux.params(model) | ||
vanilla_losses = [] | ||
train_loader = DataLoader((x_train, y_train), batchsize = batch_size, shuffle = true) | ||
train_loader = DataLoader((x_train, y_train), batchsize = batch_size, shuffle = true) |> gpu |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be Flux.get_device()
to keep it general? https://fluxml.ai/Flux.jl/stable/guide/gpu/#Using-device-objects
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Neat, didn't know that was a thing. I'll change this, and I'll also add some tests for the train, and the attacks (simple ones for now to check if the perturbation is within bounds)
clamp_range = (0, 1), | ||
) | ||
adv_losses = [] | ||
θ = Flux.params(model) | ||
train_loader = DataLoader((x_train, y_train), batchsize = batch_size, shuffle = true) | ||
train_loader = DataLoader((x_train, y_train), batchsize = batch_size, shuffle = true) |> gpu |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above
Solves issue #23. I have described as well as I can the issue, let me know if it's confusing.
Currently seems as though FGSM training actually works. Will test PGD training soon.
Edit: PGD training seems to work too. Only thing is if the adversary in train-time is too strong, the model doesn't seem to want to learn anything.
Also based on a few runs, what i notice looks like it makes sense. Classical training performs poorly on both FGSM and PGD adversaries. FGSM training does decent against FGSM adversary but poorly against PGD. PGD training did well against both. Checks out