Open askia318 opened 3 years ago
Hi, gpu_id
parameter does not exist anymore. In the args_parser()
method it is said that the gpu
parameter is set to None
when you intend to use CPU, while you have to specify the id of your GPU if you intend to use that.
However, this change is not reflected into the /src/federated_main.py
file.
You need to change the interested lines with the following:
if args.gpu:
torch.cuda.set_device(args.gpu)
device = 'cuda' if args.gpu else 'cpu'
Hopefully, @AshwinRJ will fix this, since is not a big deal :)
@AshwinRJ Can you please fix this? :)
if args.gpu: torch.cuda.set_device(args.gpu) device = 'cuda' if args.gpu else 'cpu'
If you have a gpu, change that part to the following
device = torch.device('cuda:0')
Hello: I ran 'python src/federated_main.py --model=cnn --dataset=mnist --iid=0 --epochs=10 --gpu=1' But keep receiving error message: Traceback (most recent call last): File "src/federated_main.py", line 34, in if args.gpu_id: AttributeError: 'Namespace' object has no attribute 'gpu_id'
I am using Windows 10 and make sure I have GPU and GPU 1 in my task manager.
if args.gpu: torch.cuda.set_device(args.gpu) device = 'cuda' if args.gpu else 'cpu'
You can modify the above lines of code to the following :
device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
I successfully solved the error in this way. Hope this helps you!
Hello: I ran 'python src/federated_main.py --model=cnn --dataset=mnist --iid=0 --epochs=10 --gpu=1' But keep receiving error message: Traceback (most recent call last): File "src/federated_main.py", line 34, in
if args.gpu_id:
AttributeError: 'Namespace' object has no attribute 'gpu_id'
I am using Windows 10 and make sure I have GPU and GPU 1 in my task manager. Thanks