Adding Jit profile#150
Open
HaoKang-Timmy wants to merge 26 commits into
Open
Conversation
Contributor
HaoKang-Timmy
commented
Oct 10, 2021
- Adding class JitProfile, which can count macs and params
- fix some bugs in counter
count_Transformer for nn.Transformer
The answer is 2.76945964418343e+25 44151808.0.
no embeding ** 2
For one word, about 25G flops and 44M parameters
Lyken17
reviewed
Oct 11, 2021
| for p in m.parameters(): | ||
| total_params += torch.DoubleTensor([p.numel()]) | ||
| m.total_params[0] = total_params | ||
| m.total_params[0] = counter_parameters(m.parameters()) |
Owner
There was a problem hiding this comment.
Why call count_parameters() here? total_params already provides the number of parameters of the model.
Lyken17
reviewed
Oct 11, 2021
| results = dict() | ||
| graph = trace(model, args) | ||
| for node in graph.nodes: | ||
| for operators, func in handlers: |
Owner
There was a problem hiding this comment.
This is an O(N) operation and will become slow when the number of handlers increases. I suggest to rework it to dictionary.
Contributor
Author
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.