-
-
Notifications
You must be signed in to change notification settings - Fork 335
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
Updated model script formats #210
Conversation
We should avoid adding environments per model, it's one thing that made the zoo very difficult to maintain |
Ok, then I will remove local environment files from here, and from some other places as well, and instead will Update the global environment file. |
Do you have a reference for this discussion? I would say quite the opposite: a general manifest for all of the examples in unmaintainable. No one will ever update all the scripts at the same time, so some of them will rot and some will go out of sync with the general manifest. Kind of the current situation |
I have a doubt. In the Conv.jl, we are saving the parameters as: |
you can use |
@dhairyagandhi96 @CarloLucibello I have updated few other models. Please have a look, and suggest changes wherever required. |
ref #173 |
The general manifest is expected to work with patch updates, else its a bug, and a major update would largely require a rewrite anyway |
problem is that after a major update no one is going to undertake the update of the whole repo (we have just seen this). What we can hope for (and what we consistently got in the past months) are pointwise PRs updating single scripts. This is why we should just have one manifest per example to have both manageability and consistency |
We had that earlier and it lead to a case where we missed the guarantee that the models would update accordingly. Maintaining multiple environments was also error prone. This time the reason was that we waited for some Zygote bugs to be resolved, a large change which took time to stabilize |
Sorry I had been busy writing my GSoC Proposal, because of which I wasn't able to work on this PR. Its almost done now, I will soon update format of other files as well. |
6ed5fed
to
7d3686e
Compare
@CarloLucibello @dhairyagandhi96 I have updated all models in text, other and vision section, except for one |
Is the device keyword of the Args struct in mlp.jl ever used? Is the model actually trained on the gpu? |
Sorry @jamblejoe, I haven't checked for the GPU support for all the scripts. This device keyword was left unused by mistake. I will update this shortly. Thanks for reminding! :) |
What remains to be done here? |
@dhairyagandhi96 I have updated all the models except Also for |
|
||
function loss(xs, ys) | ||
l = sum(crossentropy.(m.(gpu.(xs)), gpu.(ys))) | ||
l = sum(logitcrossentropy.(m.(xs), ys)) |
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.
is it ok to have a broadcast here?
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.
Yes, here without the broadcast, it throws the following error:
MethodError: no method matching isless(::Array{Float32,2}, ::Array{Float32,2})
Closest candidates are:
isless(!Matched::Missing, ::Any) at missing.jl:87
isless(::Any, !Matched::Missing) at missing.jl:88
as here xs
is an array of 50 elements where each element is a 2D array (N x 50) which is input for the model. However, I think here it would be better to have mean
rather than sum
. I was not much sure on that. So I left it as it was earlier.
@@ -79,7 +79,7 @@ function train(; kws...) | |||
@info("Constructing Model...") | |||
state, encode = Construct_model(args) | |||
|
|||
loss(x, yo, y) = sum(crossentropy.(model(x, yo, state, encode), y)) | |||
loss(x, yo, y) = sum(logitcrossentropy.(model(x, yo, state, encode), y)) |
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.
also here, do we want to broadcast?
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.
This also had the same problem as above.
b3e1b45
to
110f1ba
Compare
ok, let's rebase and merge this |
030f4b7
to
4c9018b
Compare
thanks for all this work! |
See #226 (comment), but also this PR did not update the project or manifest files, so the code does not currently run. |
The project file was not updated earlier because it was unclear how were we going to handle project dependencies. Though Dhairya earlier pointed out(comment) that having many project files makes it harder to handle, however at the same time having a single project file makes it tough at the time of making updates(comment). To this I suggested that it would be better if we have a section-wise Project and Manifest file like for Vision, Text, Other. However, this discussion didn't go to a conclusion at that time, and remain undecided. |
Having code in the zoo that needs a project file but doesn't have one definitely seems like the worst of all worlds. |
I have added the Project files, #232 |
I have updated the script formats of the following models:
I have also added Project.toml and Manifest.toml files for iris dataset. Will add Project.toml and Manifest.toml files for the mnist models as well, once there script format are updated. I am currently working on them. I will add them as well pretty soon. Please review these updates, and suggest further changes.
Update:
I have updated following models as well: