Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
myymgkm123 opened this issue Mar 17, 2024 · 5 comments
Open

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

myymgkm123 opened this issue Mar 17, 2024 · 5 comments

Comments

@myymgkm123
Copy link

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

@myymgkm123
Copy link
Author

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

@Yunfan-Li
Copy link
Owner

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

@myymgkm123
Copy link
Author

非常感谢李博士您能在百忙之中回复我, 不胜感激!
我是在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
Copy link
Owner

谢谢您,祝您科研顺利~

@showmeyourcodehaha
Copy link

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

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants