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

PyTorch Hub verbose=False fix #7507

Closed
wants to merge 14 commits into from
Closed

PyTorch Hub verbose=False fix #7507

wants to merge 14 commits into from

Conversation

glenn-jocher
Copy link
Member

@glenn-jocher glenn-jocher commented Apr 20, 2022

Attempt to define environment variable before utils.general loads.

🛠️ PR Summary

Made with ❤️ by Ultralytics Actions

🌟 Summary

Refinement of logging and error messaging in YOLOv5's download and creation functions.

📊 Key Changes

  • Introduced environment variable YOLOv5_VERBOSE to control verbosity.
  • Changed certain print statements to LOGGER.info for better control over logging.
  • Used the LOGGER variable within the download functions for consistent logging.
  • Modified method signatures to use _verbose instead of verbose where appropriate.

🎯 Purpose & Impact

  • 🔧 Consistent Verbosity Control: The use of the YOLOv5_VERBOSE environment variable provides unified verbosity control across different parts of the code.
  • 📝 Enhanced Logging: Transitioning from print to LOGGER.info offers developers a more granular logging level, which can help with debugging.
  • 🧰 Developer Experience: Improved error handling and messaging during the download process can make development and troubleshooting smoother for users working with YOLOv5’s codebase.
  • 🔄 Minimal User Impact: Changes are largely under-the-hood; end users working with YOLOv5 models may notice more informative logging during installation or when errors occur, but overall functionality remains the same.

Attempt to define environment variable before utils.general loads.
@glenn-jocher glenn-jocher self-assigned this Apr 20, 2022
@glenn-jocher
Copy link
Member Author

Test code:

import torch

# Model
model = torch.hub.load('ultralytics/yolov5:update/verbose_hub', 'yolov5s', verbose=False)

# Images
dir = 'https://ultralytics.com/images/'
imgs = [dir + f for f in ('zidane.jpg', 'bus.jpg')]  # batch of images

# Inference
results = model(imgs)
results.print()  # or .show(), .save()

@glenn-jocher glenn-jocher added the help wanted Extra attention is needed label Apr 20, 2022
@glenn-jocher
Copy link
Member Author

Test fails, all output still seen in console. Seems that our custom verbose argument conflicts with the default torch hub verbose argument. https://pytorch.org/docs/stable/hub.html#torch.hub.load

@Powercube7
Copy link
Contributor

@glenn-jocher how about we rename our argument to yolo_verbose?

@glenn-jocher
Copy link
Member Author

@Powercube7 I can try that!

@glenn-jocher
Copy link
Member Author

Closing PR as replaced by PR #7550

@glenn-jocher glenn-jocher deleted the update/verbose_hub branch April 23, 2022 17:52
@glenn-jocher glenn-jocher removed the help wanted Extra attention is needed label Apr 23, 2022
@glenn-jocher
Copy link
Member Author

@Powercube7 I've implemented your idea now in PR #7550 with _verbose=False Thank you for your contributions to YOLOv5 🚀 and Vision AI ⭐

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.

2 participants