-
-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Replace thop
with torch.profiler
for FLOPs
#12634
base: main
Are you sure you want to change the base?
Conversation
@Burhan-Q as described replacement for thop. If this works well we can eliminate the dependency entirely.
thop
with torch.profiler
thop
with torch.profiler
for FLOPs
Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com>
Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com>
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #12634 +/- ##
==========================================
- Coverage 70.13% 66.46% -3.68%
==========================================
Files 124 124
Lines 15699 15678 -21
==========================================
- Hits 11011 10420 -591
- Misses 4688 5258 +570
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Ok after testing this seems to be mostly working (few edge cases left, but it's MUCH SLOWER than This speed reduction is terrible, especially for RTDETR and possibly SAM, so I think while this was a great experiment it may have to stay an experiment for now. |
Is this no longer needed due to #13282 ? |
@Burhan-Q as described replacement for thop. If this works well we can eliminate the dependency entirely.
🛠️ PR Summary
Made with ❤️ by Ultralytics Actions
🌟 Summary
Redefine how model FLOPs are calculated, enhancing compatibility and removing dependencies.
📊 Key Changes
get_flops
function that relied on thethop
package.get_flops
as a new method, leveraging the built-intorch.profiler
for FLOPs calculation, aimed at removing external dependencies and enhancing the function's integration with newer PyTorch versions.🎯 Purpose & Impact