-
Notifications
You must be signed in to change notification settings - Fork 124
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
AttributeError: 'tuple' object has no attribute 'size' #195
Conversation
I think the fix proposed here is a good start but too specific. It seems to work only for outputs of nested tuple types. It would be better if we take an approach where we traverse the data (in a nested way) to capture sizes of all individual tensors. An example of such nested traverse would be I also propose another test case where some of the hidden layers have nested output and inputs, with nested structure being complicated enough. By complicated enough, I mean dict inside list inside tuple, etc. This way seems more robust to me. |
Ok. 2 questions:
I'll update the pull request as you suggested. |
|
The summary output has a problem: |
Got it: in the I tested this by putting the following code into warnstr = "\n"
for layer_info in summary_list:
if layer_info.is_recursive:
continue
num_params = layer_info.num_params if layer_info.is_leaf_layer else layer_info.leftover_params()
warnstr += f"{layer_info.class_name}: {num_params}\n"
import warnings
warnings.warn(warnstr). # warnings.warn instead of print so that pytest doesn't suppress its output I applied the fix from this pull-request in Then, I ran the test provided in this pull-request, which tests the following model:
Summing them all up gives 76,961,152. Ignoring the negative number (-51,782,336) for I will (probably) open a pull-request addressing this problem and issue#141 soon, just wanted to answer my own question so that nobody is left hanging when they read this thread. |
Thanks for the work here all. Closing in favor of #212 . |
fixed #141 . I have tested it only on one huggingface model but it should work for every model.
The only problem is that I could not fixe the verification of the out file