API: summary mode=None keeps current mode (#331)#337
Conversation
|
Are there other modes besides train and eval? I'm wondering why we are deleting the enum - we should probably keep that around. |
To my knownledge, no.
Well, I feel like with the new behaviour, it does not make sense to create this class which would only be used exacly once. I think it brings more confusion than clarity or simplicity (as can probably be seen by the fact that PR removes ~15 lines of code). |
|
torchinfo is typed, so I prefer passing enum values over strings when possible. To most callers, it makes no difference, but I think it makes the internals easier to maintain in the long term, since it clearly states what string values are allowed from the API spec. Could you also update the README with this typing change as well? Thanks! |
|
I followed your preference and implemented the change using If this is an issue, feel free to build on this PR! Also, I couldn't run pre-commit because of my proxy issue, so I commited with All the best. Note: I noticed that the |
|
up |
|
Thanks for the bump. I think None is preferable over "same", but I can update that in a followup. Aiming for a version release at the start of 2025 where this will be included. |
Closes #331.
Changes the behaviour of
mode=Noneinsummary.Before: used global default
Mode.EVALNow: keeps current model mode.
Note that this changes the default behaviour.
I couldn't pass
tests/torchinfo_xl_test.py::test_flan_t5_smallbecause my proxy didn't allow model downloading. Also, I didn't test on GPU so GPU tests were not ran.Side questions: While running the tests, I noticed that depending on the mode (
"train"or"eval"), the summary would sometimes show or not show the top level number of parameters:Is there a specific reason to this behaviour?
Furthermore, in this case, the top level shows 6.4M params, while the total count shows 13M params and Google claims around 6.xM params. Any lead to understand this?
Thanks!