Add transformer counter to profile#149
Open
HaoKang-Timmy wants to merge 19 commits into
Open
Conversation
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
| src = torch.rand((1, 1, 10)) # S,N,x | ||
|
|
||
|
|
||
| class Model_transformer(nn.Module): |
Owner
There was a problem hiding this comment.
Class name should be CamelCased.
Lyken17
reviewed
Oct 11, 2021
| nn.GRU: count_gru, | ||
| nn.LSTM: count_lstm, | ||
|
|
||
| nn.Transformer: count_Transformer, |
Owner
There was a problem hiding this comment.
function name should be lower case.
Lyken17
reviewed
Oct 11, 2021
| m.total_ops += torch.DoubleTensor([int(total_ops)]) | ||
|
|
||
|
|
||
| def count_Transformer(m: nn.Transformer, x, y): |
Contributor
Author
There was a problem hiding this comment.
fixed, also changed its subfunction, sorry for forgeting changing it after learning camelcase
added 2 commits
October 13, 2021 20:46
|
why not merge this pull? It is very necessary to calculate the flops and prams of transformer. |
|
Is there any update now |
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.
Uh oh!
There was an error while loading. Please reload this page.