Skip to content
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

Bug if number of parameters is zero. #183

Open
levifussell opened this issue Mar 16, 2022 · 0 comments
Open

Bug if number of parameters is zero. #183

levifussell opened this issue Mar 16, 2022 · 0 comments

Comments

@levifussell
Copy link

Hi,

If the number of parameters of the model is zero, then the call for (line 102):

total_params_size = abs(total_params.numpy() * 4. / (1024 ** 2.))

will fail because the type is an integer, not a torch tensor. This may seem like a weird case (when are there no parameters), but I came across this after writing 'wrapper' Modules for modules with parameters. These wrappers had no parameters themselves.

The fix is just to check the parameter count is non-zero, otherwise remove the 'numpy()' call.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant