metrics运行中遇到的问题

gcc和cuda的版本相适应关系:gcc与cuda版本对应关系_cuda和gcc版本对应-优快云博客
问题:RuntimeError: Failed to find C compiler. Please specify via CC environment variable.

解决方法:apt-get install build-essential( --no-upgrade 用不用都无所谓)

显示libc6升级 家人们可以升级,不影响cuda内核变动(帮你试过心惊胆战的半小时查找资料)

pytorch_lighting版本适配问题

pytorch、pytorch_lightning、torchmetrics版本对应_pytorch-lightning版本对应-优快云博客

torchmetrics== 0.7.0   triton==2.1.0

ModuleNotFoundError: No module named 'pytorch_lightning.metrics'

法一:修改

from pytorch_lightning.metrics import Accuracy, Precision, Recall, F1

为:(之前的版本被弃用了)

from torchmetrics import Accuracy, Precision, Recall, F1Score

ValueError: The `target` has to be an integer tensor.

使用计算函数前转换为long型

修改

accscore = acc_eval(pred.cpu(),mask.cpu())

为:

accscore = acc_eval(pred.cpu(), mask.cpu().long())

ValueError: Your data is binary and `num_classes=2`, but `multiclass` is not True. Set it to True if you want to transform binary data to multi-class format.

思路1:下载高版本的torchmetrics  ==1.5.1 导致triton-2.1.0被迫变为triton-2.0.0

思路2:直接pip下载  安装了torchmetrics-1.5.2 但是修改 triton-2.0.0
 

TypeError: Accuracy.__new__() missing 1 required positional argument: 'task'

from torchmetrics.classification import BinaryAccuracy
acc_eval = BinaryAccuracy()

AttributeError: module 'triton.language' has no attribute 'cumsum'

修改trion为>=2.1.0

成功运行!

module 'pytorch_lightning' has no attribute 'metrics'

改为以下代码
import torchmetrics
metrics = torchmetrics.Accuracy()

  

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值