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

Set TORCH_CPP_LOG_LEVEL=ERROR for reduced verbosity #12989

Merged
merged 2 commits into from May 12, 2024

Conversation

inisis
Copy link
Contributor

@inisis inisis commented May 8, 2024

πŸ› οΈ PR Summary

Made with ❀️ by Ultralytics Actions

🌟 Summary

Enhanced Logging Control in YOLOv5 Export Script ✨

πŸ“Š Key Changes

  • Added a line to set the environment variable TORCH_CPP_LOG_LEVEL to "ERROR" in export.py.

🎯 Purpose & Impact

  • Purpose: To reduce the verbosity of log messages from the PyTorch C++ backend during the export process. This change specifically filters out messages less severe than errors, making significant messages more noticeable.
  • Impact: Users exporting models will experience a cleaner console output, making it easier to spot and address actual errors. This can lead to a more user-friendly experience during model export, particularly for those troubleshooting export issues. πŸš€

Copy link
Contributor

github-actions bot commented May 8, 2024

CLA Assistant Lite bot All Contributors have signed the CLA. βœ…

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

πŸ‘‹ Hello @inisis, thank you for submitting a YOLOv5 πŸš€ PR! To allow your work to be integrated as seamlessly as possible, we advise you to:

  • βœ… Verify your PR is up-to-date with ultralytics/yolov5 master branch. If your PR is behind you can update your code by clicking the 'Update branch' button or by running git pull and git merge master locally.
  • βœ… Verify all YOLOv5 Continuous Integration (CI) checks are passing.
  • βœ… Reduce changes to the absolute minimum required for your bug fix or feature addition. "It is not daily increase but daily decrease, hack away the unessential. The closer to the source, the less wastage there is." β€” Bruce Lee

@inisis
Copy link
Contributor Author

inisis commented May 8, 2024

I have read the CLA Document and I sign the CLA

@glenn-jocher
Copy link
Member

@inisis thanks for the PR! What type of output are you seeing that will help suppress?

BTW we have an issue with ultralytics that we'd like to switch to PyTorch's built-in profiler but we have a similar problem that it is too verbose. Do you have any idea how we can silence these logging messages?

If we can figure out how to quiet the native FLOPs function down then we could migrate to it and ditch thop alltogether (would be awesome to eliminate an unmaintained dependency). The too-verbose output looks like this:

Screenshot 2024-05-05 at 19 35 54

@inisis
Copy link
Contributor Author

inisis commented May 12, 2024

@glenn-jocher for you first question, here are the screen shot.
image
and my pr can help fix it.

and for your second question, we can add export KINETO_LOG_LEVEL=5 to supress it,
image
I can help pr it.

@glenn-jocher
Copy link
Member

Thanks for the screenshots, @inisis! Your PR looks promising for addressing the log issue in the first screenshot. 😊 For suppressing verbose output from PyTorch's built-in profiler as indicated in the second screenshot, setting KINETO_LOG_LEVEL=5 sounds like a great approach. It would be fantastic if you could submit a PR for that as well! πŸš€

@inisis
Copy link
Contributor Author

inisis commented May 12, 2024

@glenn-jocher can you cc me in that issue in ultralytics , i searched but didn't find it. and I think this pr can be merged and closed.

@glenn-jocher glenn-jocher changed the title modify torch cpp log level to Error to avoid annoying print Set TORCH_CPP_LOG_LEVEL=ERROR for reduced verbosity May 12, 2024
@glenn-jocher glenn-jocher merged commit 2f6b91e into ultralytics:master May 12, 2024
@glenn-jocher
Copy link
Member

Hi @inisis! I'll make sure to mention you in the relevant issue on ultralytics once it's up for easier tracking. Regarding this PR, we'll review it shortly and merge if everything checks out. Thanks for your contributions! πŸ˜ŠπŸ‘

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

3 participants