Lyken17 / pytorch-OpCounter

Count the MACs / FLOPs of your PyTorch model.
MIT License
4.85k stars 528 forks source link

thop/profile.py:12: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead. `if LooseVersion(torch.__version__) < LooseVersion("1.0.0"):` #200

Open glenn-jocher opened 1 year ago

glenn-jocher commented 1 year ago

I'm seeing a DeprecationWarning when running YOLOv8 tests. This looks pretty simple, I think we just need to update thop/profile.py:12 as mentioned to us pkg_resources as follows:

import pkg_resources as pkg

pkg.parse_version(torch.__version__)

I'll try to submit a PR.

glenn-jocher commented 1 year ago

See Ultralytics CI Tests for examples of the deprecation warning:

https://github.com/ultralytics/ultralytics/actions/runs/4380005063/jobs/7666578652

Screenshot 2023-03-10 at 19 21 46
GTziolas commented 4 months ago

@glenn-jocher I'm still seeing this DeprecationWarning. Would it be wise to reopen this PR?