ImportError: cannot import name ‘get_num_classes‘ from ‘torchmetrics.utilities.data‘
torchmetrics的版本问题
·
通过以下方法可以解决:
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
更多推荐


所有评论(0)