通过以下方法可以解决:

pip uninstall torchmetrics

pip install torchmetrics==0.5

当然也可能出现以下情况:

torchmetrics==0.8.0报错:

ImportError: cannot import name ‘get_num_classes‘ from ‘torchmetrics.utilities.data‘

torchmetrics==0.5.0报错:

ImportError: cannot import name 'MeanMetric' from 'torchmetrics' 

 这时候这样处理就行

pip install torchmetrics==0.7.0

Logo

有“AI”的1024 = 2048,欢迎大家加入2048 AI社区

更多推荐