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

Improved float workspace arg for TRT exports #9407

Merged
merged 2 commits into from Mar 29, 2024

Conversation

zldrobit
Copy link
Contributor

@zldrobit zldrobit commented Mar 29, 2024

I would like to export a TensorRT model with about 250-500MB workspace size, yet the original repo does not allow setting workspace of fractional/float type:

builder = trt.Builder(logger)
config = builder.create_builder_config()
config.max_workspace_size = self.args.workspace * 1 << 30
# config.set_memory_pool_limit(trt.MemoryPoolType.WORKSPACE, workspace << 30) # fix TRT 8.4 deprecation notice

So, I tweaked the code to accept a float-type workspace. I guess using a lesser workspace (<1GB) is helpful for resource-constrained devices, such as Nvidia Jetson.

πŸ› οΈ PR Summary

Made with ❀️ by Ultralytics Actions

🌟 Summary

Improved configuration and memory handling in Ultralytics software components.

πŸ“Š Key Changes

  • Added "workspace" to CFG_FLOAT_KEYS for better configuration management.
  • Removed "workspace" from a list where it no longer belongs, streamlining configuration clarity.
  • Updated memory workspace size calculation in the TensorRT exporter for enhanced precision and compatibility.

🎯 Purpose & Impact

  • Enhanced Clarity and Management: The changes make it easier to understand and manage configuration parameters, enhancing user experience. 🌈
  • Improved Memory Handling: The more precise memory workspace size calculation means better performance and efficiency, especially for users leveraging TensorRT for neural network inference. πŸ’ΎπŸš€
  • Broad Compatibility: Adjusting the memory size calculation ensures compatibility with newer versions of TensorRT, ensuring users can stay up-to-date with the latest technology. πŸ†•

Copy link

github-actions bot commented Mar 29, 2024

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

@zldrobit
Copy link
Contributor Author

I have read the CLA Document and I sign the CLA

Copy link

@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 @zldrobit, thank you for submitting an Ultralytics YOLOv8 πŸš€ 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/ultralytics main 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 main locally.
  • βœ… Verify all YOLOv8 Continuous Integration (CI) checks are passing.
  • βœ… Update YOLOv8 Docs for any new or updated features.
  • βœ… 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

See our Contributing Guide for details and let us know if you have any questions!

Copy link

codecov bot commented Mar 29, 2024

Codecov Report

Attention: Patch coverage is 50.00000% with 1 lines in your changes are missing coverage. Please review.

Project coverage is 76.94%. Comparing base (4a7ccba) to head (339ddf7).

❗ Current head 339ddf7 differs from pull request most recent head e946f63. Consider uploading reports for the commit e946f63 to get more accurate results

Files Patch % Lines
ultralytics/engine/exporter.py 0.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #9407   +/-   ##
=======================================
  Coverage   76.94%   76.94%           
=======================================
  Files         117      117           
  Lines       14850    14850           
=======================================
+ Hits        11426    11427    +1     
+ Misses       3424     3423    -1     
Flag Coverage Ξ”
Benchmarks 36.73% <50.00%> (ΓΈ)
GPU 38.85% <50.00%> (ΓΈ)
Tests 72.07% <50.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

β˜” View full report in Codecov by Sentry.
πŸ“’ Have feedback on the report? Share it here.

@glenn-jocher
Copy link
Member

@zldrobit good change!

@glenn-jocher glenn-jocher changed the title Add support for float type workspace (exporting a model) Improved float workspace arg for TRT exports Mar 29, 2024
@glenn-jocher glenn-jocher merged commit 03d0ffd into ultralytics:main Mar 29, 2024
10 checks passed
hmurari pushed a commit to hmurari/ultralytics that referenced this pull request Apr 17, 2024
Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
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