Yunfan-Li / Twin-Contrastive-Learning

Code for the paper "Twin Contrastive Learning for Online Clustering" (IJCV 2022)
56 stars 11 forks source link

AttributeError: 'Namespace' object has no attribute 'gpu' #27

Open myymgkm123 opened 6 months ago

myymgkm123 commented 6 months ago

您好李博士,非常感谢您贡献的代码! 我在运行代码的时候出现了没有GPU属性,如下图所示。请问您,如何解决这个问题? 如果您能回复,我将不胜感激! image

myymgkm123 commented 6 months ago

当我在运行代码之前添加了参数parser.add_argument("--gpu", default=0, type=int, help="ID of the GPU to use")之后,运行又有如下错误。希望您回复。最后祝您科研顺利! image

Yunfan-Li commented 6 months ago

您好,请问运行代码的方式是按照ReadMe里面那样的吗?

myymgkm123 commented 6 months ago

非常感谢李博士您能在百忙之中回复我, 不胜感激! 我是在Window中运行的,使用这行代码,OMP_NUM_THREADS=1 python -m torch.distributed.launch --nproc_per_node=1 python train.py --batch_size 64 --model resnet18 --nb_cluster 30 --data_path datasets --dataset mydata --device cuda 一定程度上是系统问题。我现已在Linux上解决,非常感谢李博士您的回复! 最后,祝您科研顺利!

Yunfan-Li commented 6 months ago

谢谢您,祝您科研顺利~

showmeyourcodehaha commented 4 months ago

您好,请问运行代码的方式是按照ReadMe里面那样的吗?

您好!我的情况跟他几乎一摸一样,我是在jupyter里运行的,系统是linux,我在jupyter里使用run train.py后报错就是没有”gpu“这个属性。然后因为我只有一张卡,所以我干脆把整个变量改成了0,然后跟上面这哥们一样报进程未被初始化的错误。唯一不同的就是我的系统是linux并且使用的是jupyter