-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Refactor model summary + generalize example input array #1773
Conversation
ab1f83c
to
405fcf1
Compare
Codecov Report
@@ Coverage Diff @@
## master #1773 +/- ##
======================================
+ Coverage 87% 88% +1%
======================================
Files 68 68
Lines 5221 5235 +14
======================================
+ Hits 4544 4590 +46
+ Misses 677 645 -32 |
Let's make this example input area as property.. |
What would be the benefit of that? Could you clarify |
it would be read-only and also it MAY resolve soma attribute issue... |
405fcf1
to
fbf3eff
Compare
632a456
to
cf303ba
Compare
@Borda getting this failed import "assert_speed_parity". Which one should I use, absolute or relative speed parity? |
strange that master branch is passing the tests |
variant a variant b add test revert rename add changelog docs move changelog entry to top use hooks wip wipp layer summary clean up, refactor type hints rename remove obsolete code rename unused imports simplify formatting of table and increase readability doctest superclass object update examples print unknown sizes more docs and doctest testing unknown layers add rnn test remove main restore train mode test device wip device constant simplify model forward transfer return summary object in method extend tests fix summary for empty module extend tests refactor and added hook variant a variant b add test revert rename add changelog docs move changelog entry to top remove hardcoded string simplify test unknown shapes and all others comments for tests fix hparams attribute
This pull request is now in conflict... :( |
shape = [parse_batch_shape(el) for el in batch] | ||
return shape | ||
|
||
return UNKNOWN_SIZE | ||
|
||
|
||
def _format_summary_table(*cols) -> str: |
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 already have a table printer for Profiler, so lets general that function and use it here too
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 no utility for table printing in Profiler that can be extracted.
the shape, columns and rows of the table are all hardcoded and differ between Simple and AdvancedProfiler.
not sure how to extract this, seems this is a larger effort that does not fit well into this pr 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.
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 that's exactly what I was looking at.
This pull request is now in conflict... :( |
This pull request is now in conflict... :( |
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 🤖
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
Before submitting
What does this PR do?
Fixes #1556
currently blocked by #1756Before: Model summary with "example_input_array" would break if order defined layers is not consistent with order of execution in forward, e.g.,
if layers are called in the order
self.layer2(self.layer1(input))
but if we switched the order to
it would break.
Now: We solve this issue by installing a PyTorch hook on each layer. The hook will collect the input and output shape in the order of execution.
example_input_array
in order of executionOpen questions: