I have multi gpus, how to run the inference/predict with multi gpu?
e.g.
import os
os.environ["CUDA_VISIBLE_DEVICES"] = "1,0"
predictor = DefaultPredictor(cfg)
im = cv2.imread(full_filename)
outputs = predictor(im)
When I use the multiprocessing to run detectron2, the detectron2 only run on 1 gpu, then I get below memory error, how to automatically swtich into other gpu?
----ERROR MESSAGE-----
pixel_mean = torch.Tensor(cfg.MODEL.PIXEL_MEAN).to(self.device).view(num_channels, 1, 1)
RuntimeError: CUDA error: out of memory
cfg.MODEL.DEVICE='cuda:1' will let the predictor run on gpu 1.
Most helpful comment
cfg.MODEL.DEVICE='cuda:1'will let the predictor run on gpu 1.