How to specify the device #423

Open
opened 2026-01-29 21:47:38 +00:00 by claunia · 2 comments
Owner

Originally created by @Crestina2001 on GitHub (Dec 25, 2023).

Hi, I am using the model for inference. I have several GPUs, and I would like to split the images for different GPUs to infer. How to move the restorer to different GPUs? restorer.to(device) does not work.

Originally created by @Crestina2001 on GitHub (Dec 25, 2023). Hi, I am using the model for inference. I have several GPUs, and I would like to split the images for different GPUs to infer. How to move the restorer to different GPUs? restorer.to(device) does not work.
Author
Owner

@Silas1704 commented on GitHub (Jan 23, 2024):

@Crestina2001 In PyTorch try using torch.nn.DataParallel or torch.nn.parallel.DistributedDataParallel .when using DataParallel, the model will be replicated across all available GPUs, and each GPU will process a portion of the input data Wrap the model with DataParallel:
restorer = nn.DataParallel(restorer).
Then concatenate the results

@Silas1704 commented on GitHub (Jan 23, 2024): @Crestina2001 In PyTorch try using torch.nn.DataParallel or torch.nn.parallel.DistributedDataParallel .when using DataParallel, the model will be replicated across all available GPUs, and each GPU will process a portion of the input data Wrap the model with DataParallel: restorer = nn.DataParallel(restorer). Then concatenate the results
Author
Owner

@jdc4429 commented on GitHub (Jul 20, 2024):

what about specifing a GPU other then 0? I am trying to get it to use gpu1 but my attempts have failed.

@jdc4429 commented on GitHub (Jul 20, 2024): what about specifing a GPU other then 0? I am trying to get it to use gpu1 but my attempts have failed.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: TencentARC/GFPGAN#423