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

Add verbose option #16

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

momo-the-monster
Copy link

Thanks for all your work on this project! I'm using it for Colab notebook experiments and found that it printed more lines to the console than I would like, so I added this -verbose flag in for myself so I could set it to 0 when I don't need as many updates.

@momo-the-monster
Copy link
Author

Hi @ProGamerGov! Just fixed the merged conflicts introduced with the latest and greatest from the master branch so I'm bumping this up for visibility. The -verbose flag is super helpful when running in Colab notebooks, especially as I have this in front of a group of designers at our company right now. Let me know if you have a thought on another way you'd like to see this implemented. Thanks!

@ProGamerGov
Copy link
Owner

ProGamerGov commented Nov 15, 2019

@momo-the-monster Nice work!

I'm not sure about using a ton of if statements to block all the print statements. It's fine to use that once in CaffeLoader to block printing the conv layers, but it looks a bit ugly to use it for every print statement.

I guess one could use: sys.stdout = open(os.devnull, 'w') to completely block printing until some point, but reenabling printing could be tricky.

Also, the verbose parameter doesn't need to use integers. It can just be a boolean flag.

@momo-the-monster
Copy link
Author

momo-the-monster commented Nov 16, 2019

Hm, agreed. I don't work in Python much -what do you think about using the built-in logging library (or a third-party one like loguru) where the user could configure what level they want to print? That way I could easily supress anything error or below.

Surya Buchwald added 3 commits January 13, 2020 15:14
…tyle-pt into feature/add-verbose-option

# Conflicts:
#	CaffeLoader.py
#	neural_style.py
…the-monster/neural-style-pt into feature/add-verbose-option

# Conflicts:
#	CaffeLoader.py
#	neural_style.py
@momo-the-monster
Copy link
Author

@ProGamerGov - had another go at this, much simpler this time around.

I just added a -log_level parameter and switched all the print() commands to logging.info() commands.

The log level is INFO by default, so everything shows up. If you pass -log_level 30 or higher, then you get no outputs. Future-compatible because any new code can just log using the appropriate level, the param supports all Python log levels.

It looks like you've got a couple of branches in various states so I made this off the latest master. Happy to redo it off another branch if that makes it more likely to get merged.

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 this pull request may close these issues.

None yet

2 participants