Fix None Type error while using MultiHeadAttention - #191
Open
GCS-ZHN wants to merge 6 commits into
Open
Conversation
1. Fix the bug of parameter number calculation when there are more than one output variables, including both sequence case and dict case. 2. Make multuple output variables split into multiple lines. 3. Remove the last line break of summary_string() 4. Enable argument "device" to accept both str and torch.device. 5. Fix a bug when the model requires "batch_size" to be a specific number. 6. Fix a bug caused by multiple input case when "dtypes=None". 7. Add text auto wrap when the layer name is too long. 8. Add docstring.
Support counting all parameters instead of `weight` and `bias`.
Using numpy sum/prod to calculate the total size may cause overflow problem. This modification would drop the numpy and use the python built-in method to calculate the size.
Fix the bug caused by layers with dict input values.
Fix the data type of the output params_info from torch.tensor to int.
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.
This PR is modified based on previous PR #165 by @cainmagi ,
Main change features:
not array likeelements in forward output list/tuple/dict. For example, MultiHeadAttention module return a tuple which contain a NoneType value as a placeholder of attention weight.-1tobatch_sizein dict/list/tuple output shape because I believe it will be more properly.