mousecpn / DG-YOLO

[ICIP2020] TOWARDS DOMAIN GENERALIZATION IN UNDERWATER OBJECT DETECTION
47 stars 5 forks source link

Error Running train.py RuntimeError: No CUDA GPUs are available #8

Open Vignesh048 opened 1 year ago

Vignesh048 commented 1 year ago

I'm facing the following issue while running the code for training.

Namespace(batch_size=8, checkpoint_interval=2, compute_map=False, data_config='config/coco.data', epochs=300, evaluation_interval=2, gradient_accumulations=2, img_size=416, model_def='config/yolov3.cfg', multiscale_training=True, n_cpu=4, pretrained_weights='/content/darknet53.conv.74')
/usr/local/lib/python3.7/dist-packages/torch/utils/data/dataloader.py:566: UserWarning: This DataLoader will create 4 worker processes in total. Our suggested max number of worker in current system is 2, which is smaller than what this DataLoader is going to create. Please be aware that excessive worker creation might get DataLoader running slow or even freeze, lower the worker number to avoid potential slowness/freeze if necessary.
  cpuset_checked))
/content/DG-YOLO/DG_model.py:200: UserWarning: indexing with dtype torch.uint8 is now deprecated, please use a dtype torch.bool instead. (Triggered internally at  ../aten/src/ATen/native/IndexingUtils.h:27.)
  loss_x = self.mse_loss(x[obj_mask]*dummy_w, tx[obj_mask])
/content/DG-YOLO/DG_model.py:201: UserWarning: indexing with dtype torch.uint8 is now deprecated, please use a dtype torch.bool instead. (Triggered internally at  ../aten/src/ATen/native/IndexingUtils.h:27.)
  loss_y = self.mse_loss(y[obj_mask]*dummy_w, ty[obj_mask])
/content/DG-YOLO/DG_model.py:202: UserWarning: indexing with dtype torch.uint8 is now deprecated, please use a dtype torch.bool instead. (Triggered internally at  ../aten/src/ATen/native/IndexingUtils.h:27.)
  loss_w = self.mse_loss(w[obj_mask]*dummy_w, tw[obj_mask])
/content/DG-YOLO/DG_model.py:203: UserWarning: indexing with dtype torch.uint8 is now deprecated, please use a dtype torch.bool instead. (Triggered internally at  ../aten/src/ATen/native/IndexingUtils.h:27.)
  loss_h = self.mse_loss(h[obj_mask]*dummy_w, th[obj_mask])
/content/DG-YOLO/DG_model.py:204: UserWarning: indexing with dtype torch.uint8 is now deprecated, please use a dtype torch.bool instead. (Triggered internally at  ../aten/src/ATen/native/IndexingUtils.h:27.)
  loss_conf_obj = self.bce_loss(pred_conf[obj_mask], tconf[obj_mask])
/content/DG-YOLO/DG_model.py:205: UserWarning: indexing with dtype torch.uint8 is now deprecated, please use a dtype torch.bool instead. (Triggered internally at  ../aten/src/ATen/native/IndexingUtils.h:27.)
  loss_conf_noobj = self.bce_loss(pred_conf[noobj_mask], tconf[noobj_mask])
/content/DG-YOLO/DG_model.py:207: UserWarning: indexing with dtype torch.uint8 is now deprecated, please use a dtype torch.bool instead. (Triggered internally at  ../aten/src/ATen/native/IndexingUtils.h:27.)
  loss_cls = self.bce_loss(pred_cls[obj_mask], tcls[obj_mask])
/content/DG-YOLO/DG_model.py:210: UserWarning: indexing with dtype torch.uint8 is now deprecated, please use a dtype torch.bool instead. (Triggered internally at  ../aten/src/ATen/native/IndexingUtils.h:27.)
  pen = penalty(prediction[..., 4][obj_mask],tconf[obj_mask])
Traceback (most recent call last):
  File "/content/DG-YOLO/DG_train.py", line 125, in <module>
    loss, outputs,features,pen = model(imgs, targets, da=True, IRM=True, dummy_w=scale)
  File "/usr/local/lib/python3.7/dist-packages/torch/nn/modules/module.py", line 1130, in _call_impl
    return forward_call(*input, **kwargs)
  File "/content/DG-YOLO/DG_model.py", line 274, in forward
    x, layer_loss,layer_pen = module[0](x, targets, img_dim,IRM=IRM,dummy_w = dummy_w)
  File "/usr/local/lib/python3.7/dist-packages/torch/nn/modules/module.py", line 1130, in _call_impl
    return forward_call(*input, **kwargs)
  File "/content/DG-YOLO/DG_model.py", line 210, in forward
    pen = penalty(prediction[..., 4][obj_mask],tconf[obj_mask])
  File "/content/DG-YOLO/DG_model.py", line 17, in penalty
    scale = torch.tensor(1.).cuda().requires_grad_()
  File "/usr/local/lib/python3.7/dist-packages/torch/cuda/__init__.py", line 217, in _lazy_init
    torch._C._cuda_init()
RuntimeError: No CUDA GPUs are available
mousecpn commented 1 year ago

do you have any GPU?

karthikiitm87 commented 1 year ago

@Vignesh048 : You may change the os.environ['CUDA_VISIBLE_DEVICES'] = "3" to os.environ['CUDA_VISIBLE_DEVICES'] = "0" and verify the execution. It should work provided you have installed the pytorch in GPU mode.