-
Notifications
You must be signed in to change notification settings - Fork 17
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
Update examples/MNIST Manifest, including Julia 1.10 #254
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## dev #254 +/- ##
==========================================
+ Coverage 92.08% 92.11% +0.02%
==========================================
Files 12 12
Lines 316 317 +1
==========================================
+ Hits 291 292 +1
Misses 25 25 ☔ View full report in Codecov by Sentry. |
@@ -77,7 +77,7 @@ function MLJFlux.build(b::MyConvBuilder, rng, n_in, n_out, n_channels) | |||
MaxPool((2, 2)), | |||
Conv((k, k), c2 => c3, pad=(p, p), relu, init=init), |
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.
Instead of computing the required padding to perserve image size manually above and passing it here, one can just pass the singleton SamePad()
https://fluxml.ai/Flux.jl/stable/models/layers/#Convolution-Models
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.
Good to know. I will leave it as is, for less "hidden knowledge" for beginners, but will add your alternative in the form of a comment.
examples/mnist/notebook.jl
Outdated
batch_size=50, | ||
epochs=10, | ||
rng=123, | ||
) | ||
|
||
# You can add Flux options `optimiser=...` and `loss=...` here. At |
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.
# You can add Flux options `optimiser=...` and `loss=...` here. At | |
# You can add to the constructor Flux options `optimiser=...` and `loss=...` here. At |
because its later mention To run on a GPU, set acceleration=CUDALib() and omit rng.
which if followed by a call to machine
(so one may think they should add it the machine and not the constructor if that's not explicit.)
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.
Addressed in a new commit.
examples/mnist/notebook.jl
Outdated
@@ -129,7 +130,7 @@ fit!(mach, rows=1:500); | |||
# Computing an out-of-sample estimate of the loss: | |||
|
|||
predicted_labels = predict(mach, rows=501:1000); | |||
cross_entropy(predicted_labels, labels[501:1000]) |> mean | |||
cross_entropy(predicted_labels, labels[501:1000]) |
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.
I do personally prefer training and testing data to be separate data structures (or at least to make this more generic by deciding a split size initially that could be changed as needed).
It may confuse some that we are loading the training data of MNIST then using the first 500 examples for actual training and the second 500 for testing/validation.
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.
Addressed.
@@ -63,8 +65,6 @@ struct MyConvBuilder | |||
channels3::Int | |||
end | |||
|
|||
make2d(x::AbstractArray) = reshape(x, :, size(x)[end]) |
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.
There is another instance of this below around line 173, should it be also replaced with MLUtils.flatten
?
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.
Okay, it looks like make2d
is not used, and we can use vec
for make1d
. So I've done that.
examples/mnist/notebook.jl
Outdated
|
||
# **Note.** The the higher the number, the deeper the chain parameter. | ||
# **Note.** The higher the number, the deeper the chain parameter. |
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.
I don't get in what sense its deeper because perhaps this is using the same number of hidden layers regardless to epochs.
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.
We are reporting the mean value of weights for different layers. The higher the index, the deeper the layer we are averaging.
Added a comment to clarify, but let me know if this is still not clear or if you believe my assertion is not correct.
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.
OK. I hadn't seen the plot or noticed the div
operation when I commented. Now I understand that the higher the index in the means list, the deeper the layer. I think I initially understood "number" to be the epoch number.
Those we can either just assume users will conclude that "number" is the index in the plot or clarify it.
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.
@ablaom this comment.
Co-authored-by: Essam <[email protected]>
…nto mnist-update
OKay @EssamWisam I'm ready for you to have another look at this. |
Redefines perfection 👌. I think we are ready to merge this just after we resolve anything, if needed, in my comment above. |
Oh and also after exposing it in the documentation: obvious by moving the tutorial to the |
Sorry, which comment is that?
Mmm. I'm going to postpone that step, but thanks for flagging. |
This PR resolves #234. It updates the example/MNIST to use latest package versions and Julia 1.10
To do:
acceleration=CUDALibs()
).cc @EssamWissam