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

Assert --optimize not used with cuda device #8569

Merged
merged 1 commit into from
Jul 15, 2022

Conversation

democat3457
Copy link
Contributor

@democat3457 democat3457 commented Jul 13, 2022

TorchScript throws a lot of errors complaining about mobile-optimized models not working with CUDA devices when trying to use a mobile-optimized cuda-export-device model, regardless of whether the model is ran on cpu or a cuda device. This PR prevents that from occurring by ensuring that --optimize cannot be used with a cuda export device.

πŸ› οΈ PR Summary

Made with ❀️ by Ultralytics Actions

🌟 Summary

Improve export script by enforcing CPU device usage during optimization.

πŸ“Š Key Changes

  • Added a condition to assert that the --optimize flag requires --device cpu.

🎯 Purpose & Impact

  • 🎯 Purpose: Ensures users avoid compatibility issues when using the --optimize option by running the model optimization on CPU only.
  • πŸ’‘ Impact: Prevents potential errors for those attempting to optimize models with CUDA-enabled devices, leading to a smoother user experience when optimizing YOLOv5 models for deployment.

@glenn-jocher glenn-jocher merged commit f4b0568 into ultralytics:master Jul 15, 2022
@glenn-jocher glenn-jocher self-assigned this Jul 15, 2022
@glenn-jocher
Copy link
Member

@democat3457 PR is merged. Thank you for your contributions to YOLOv5 πŸš€ and Vision AI ⭐

@democat3457 democat3457 deleted the patch-2 branch July 29, 2022 16:41
ctjanuhowski pushed a commit to ctjanuhowski/yolov5 that referenced this pull request Sep 8, 2022
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