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

Log instead of print messages #5

Closed
radomirbosak opened this issue Sep 6, 2022 · 0 comments · Fixed by #6
Closed

Log instead of print messages #5

radomirbosak opened this issue Sep 6, 2022 · 0 comments · Fixed by #6

Comments

@radomirbosak
Copy link
Contributor

For code that is using pytorch2timeloop-converter it is sometimes undesirable to have text printed in stdout.

This package prints messages like

converting nn.Conv2d and nn.Linear in out model ...

on around four places, e.g.

print("converting {} in {} model ...".format("nn.Conv2d" if not convert_fc else "nn.Conv2d and nn.Linear", model_name))

A good mechanism for these kind of message is using the logging module, which can be turned on and off quite easily.

Other print statements found:

$ git grep -n 'print('
pytorch2timeloop/converter_pytorch.py:28:    print("converting {} in {} model ...".format("all", model_name))
pytorch2timeloop/converter_pytorch.py:52:    print("converting {} in {} model ...".format("nn.Conv2d" if not convert_fc else "nn.Conv2d and nn.Linear", model_name))
pytorch2timeloop/converter_pytorch.py:113:    print("conversion complete!\n")
pytorch2timeloop/utils/hooks.py:228:    print("unknown module type", module.__class__)
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

Successfully merging a pull request may close this issue.

1 participant