PiCO调BUG记录:偏标记学习-PiCO: Contrastive Label Disambiguation for Partial Label Learning

本文讲述了在配置环境时遇到的tensorflow信息弹出、GPU识别问题、numpy版本更新、Label类型转换以及Userwarning处理。作者提供了相应的解决方案,包括检查CUDA对应、调整numpy版本和过滤警告信息。
摘要由CSDN通过智能技术生成

主页链接:https://hbzju.github.io/pico/
代码链接:https://github.com/hbzju/pico

1. 环境配置

按照作者的环境配置即可。我的设备比较老,所以是按照这个配置的:

较老环境配置版本记录:
https://blog.csdn.net/m0_59741202/article/details/130308874

特别注意torch,torchvision和pillow
实操发现1080ti单卡也没问题。

2. 弹出很多有关tensorflow的信息

不知道为什么。作者提供的requirements里面没有提到tensorflow。但是我报了这个错误。所以按照上面提到的环境配置(较老环境配置版本记录)换了同时拥有tensorflow1.x和torch1.2.0的环境。(当然作者的环境配置更高)

3. train时打印NameSpace信息后直接结束

检查一下输出信息有没有:

gpu=None

这应该是没有找到GPU。我的设备比较老,是因为torch和torchvision,CUDA不对应。参见上面提到的文章。配置GPU环境。
配置完后检查:

import torch
print(torch.cuda.is_available())

如果为True说明没问题
(这个配置的过程极有可能改变numpy的版本,造成错误4)

4. numpy版本

FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
np_qint8 = np.dtype([("qint8", np.int8, 1)])
Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.

出现以上信息说明numpy版本有问题。建议安装对应版本。
我的numpy==1.16.0

5.Label问题

RuntimeError: Expected object of scalar type Long but got scalar type Float for sequence element 2 in sequence argument at position #1 'tensors'

把代码中的部分修改为:

pseudo_labels = torch.cat((pseudo_labels_b.long(), pseudo_labels_b.long(), self.queue_pseudo.clone().detach().long()), dim=0)

6.Userwarning

train.py:113: UserWarning: You have chosen to seed training. This will turn on the CUDNN deterministic setting, which can slow down your training considerably! You may see unexpected behavior when restarting from checkpoints.
  warnings.warn('You have chosen to seed training. '

其实应该不影响训练,加入

import warnings
warnings.filterwarnings("ignore")

可以让信息不输出。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值