-
Notifications
You must be signed in to change notification settings - Fork 3
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
Batch struct #84
Batch struct #84
Conversation
…onality in there. The DataLoader should purely handle loading data (as the name suggests) and not drawing batches! the new function optimize_for_one_epoch optimizes for an entire epoch and outputs the average loss.
…e, it switches to CPU().
…bing self-attention.
Codecov Report
@@ Coverage Diff @@
## main #84 +/- ##
==========================================
- Coverage 70.71% 69.35% -1.37%
==========================================
Files 95 96 +1
Lines 2363 2382 +19
==========================================
- Hits 1671 1652 -19
- Misses 692 730 +38
... and 1 file with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
There is some Julia v1.8 issue that needs to be fixed, plus a rebase. |
…ic parameter names must be distinct. I tried fixing this with changing the name of the function argument.
…/GeometricMachineLearning.jl into transformer_description
Tests for struct Batch{seq_length}
batch_size::Integer
seq_length::Union{Nothing, Integer}
end
function Batch(batch_size, seq_length)
Batch{true}(batch_size, seq_length)
end
function Batch(batch_size::Integer)
Batch{false}(batch_size, nothing)
end to struct Batch{seq_length}
batch_size::Integer
seq_length::Union{Nothing, Integer}
function Batch(batch_size, seq_length)
new{true}(batch_size, seq_length)
end
function Batch(batch_size::Integer)
new{false}(batch_size, nothing)
end
end |
I see two issues here:
I would rather write this along the following lines:
|
Ok, I see, that's why for |
I guess you were a bit too quick and forgot to run your tests 😉 . There are a few more changes required, e.g.,
needs to become
etc. |
sorry 😅 . Should be working now. |
Introduced a new struct
Batch
that takes care of drawing new batches for a new epoch during training. This was previously (sloppily) done withDataLoader
. Some helper functions have also been added, most importantlyoptimize_for_one_epoch(::opt::Optimizer, model, ps, dl::DataLoader, batch::Batch, loss)
. I also tried to add and improve documentation for routines I changed/introduced.