zhuangdizhu / FedGen

Code and data accompanying the FedGen paper
233 stars 68 forks source link

run the code on cuda device #6

Closed daiqing98 closed 2 years ago

daiqing98 commented 2 years ago

It seems that the code does not supprt CUDA?

--device "cuda" can be set but it seems that it is always running on cpu

Thanks

hanjialiang commented 2 years ago

I am curious how you fix this issue. Your reply will be a great help, thank you!

daiqing98 commented 2 years ago

@hanjialiang It is not implemented. I manually moved the move and tensors to GPU. It is a quick modification and you can try it. When I check the code, it seems the the user_latent_loss (line:58) in userpFedGen.py is the real contribution but not mentioned in the paper if I am right. And the loss functions mentioned in the paper seem unuseful. You may do ablation study to validate it if you are interested.

hanjialiang commented 2 years ago

Thank you for your detailed reply. I have tried "os.environ["CUDA_VISIBLE_DEVICES"]", "torch.cuda.set_device()", and model.to(torch.device('cuda:0')), however, the model still runs on CPU. It will be of great help if you tell me how you made that adaption to GPU. Besides, I wonder if it is convenient for you to communicate with me via WeChat or other SNSs for further discussion. Thanks a lot!

daiqing98 commented 2 years ago

@hanjialiang Sure. You can email me your contact info.

hanjialiang commented 2 years ago

Sorry I did not find your email on your profile. Why not email me via hanjialiang1997@126.com, thank you!